[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_exdent_com
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_exdent_command): handle better exdent with empty argument text. |
Date: |
Sun, 29 Sep 2024 09:34:42 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 00a82d6457 * tp/Texinfo/Convert/HTML.pm (_convert_exdent_command):
handle better exdent with empty argument text.
00a82d6457 is described below
commit 00a82d6457b30dd4a26c40b6659ef6152f7af7aa
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jul 1 15:28:25 2024 +0200
* tp/Texinfo/Convert/HTML.pm (_convert_exdent_command): handle better
exdent with empty argument text.
* tp/Texinfo/XS/convert/convert_html.c: minor changes.
* tp/Makefile.tres, tp/t/08misc_commands.t (exdent_no_line): add a
test with exdent not followed by anything.
---
ChangeLog | 10 +++
tp/Makefile.tres | 1 +
tp/Texinfo/Convert/HTML.pm | 6 +-
tp/Texinfo/XS/convert/convert_html.c | 8 ++-
tp/t/08misc_commands.t | 2 +
tp/t/results/misc_commands/exdent_no_line.pl | 104 +++++++++++++++++++++++++++
6 files changed, 126 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d2aeca357c..630154afb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-07-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_exdent_command): handle better
+ exdent with empty argument text.
+
+ * tp/Texinfo/XS/convert/convert_html.c: minor changes.
+
+ * tp/Makefile.tres, tp/t/08misc_commands.t (exdent_no_line): add a
+ test with exdent not followed by anything.
+
2024-07-01 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/Text.pm (_convert),
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index acf1e1c4bf..5e983bdfbb 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1600,6 +1600,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/misc_commands/empty_center.pl \
t/results/misc_commands/empty_center_with_arg.pl \
t/results/misc_commands/empty_documentencoding.pl \
+ t/results/misc_commands/exdent_no_line.pl \
t/results/misc_commands/footnote_in_center.pl \
t/results/misc_commands/heading_command_in_commands.pl \
t/results/misc_commands/incorrect_allowcodebreaks_argument.pl \
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 6a97edd0bc..db91b9f30b 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -5507,8 +5507,10 @@ sub _convert_exdent_command($$$$)
my $command = shift;
my $args = shift;
-
- my $arg =
$self->get_pending_formatted_inline_content().$args->[0]->{'normal'};
+ my $arg = $self->get_pending_formatted_inline_content();
+ if ($args and defined($args->[0])) {
+ $arg .= $args->[0]->{'normal'};
+ }
if (in_string($self)) {
return $arg ."\n";
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 81a6d996e7..30fd0808cc 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -11156,7 +11156,8 @@ convert_exdent_command (CONVERTER *self, const enum
command_id cmd,
char *attribute_class;
STRING_LIST *classes;
- if (args_formatted->number > 0
+ /* args_formatted null does not seems to be possible in practice */
+ if (args_formatted && args_formatted->number > 0
&& args_formatted->args[0].formatted[AFT_type_normal]
&& strlen (args_formatted->args[0].formatted[AFT_type_normal]))
arg = args_formatted->args[0].formatted[AFT_type_normal];
@@ -11169,7 +11170,7 @@ convert_exdent_command (CONVERTER *self, const enum
command_id cmd,
free (pending_formatted);
}
if (arg)
- text_append (result, arg);
+ text_append (result, arg);
text_append_n (result, "\n", 1);
return;
}
@@ -11211,7 +11212,8 @@ convert_center_command (CONVERTER *self, const enum
command_id cmd,
char *attribute_class;
STRING_LIST *classes;
- if (args_formatted->number > 0
+ /* args_formatted null does not seems to be possible in practice */
+ if (args_formatted && args_formatted->number > 0
&& args_formatted->args[0].formatted[AFT_type_normal]
&& strlen (args_formatted->args[0].formatted[AFT_type_normal]))
arg = args_formatted->args[0].formatted[AFT_type_normal];
diff --git a/tp/t/08misc_commands.t b/tp/t/08misc_commands.t
index c72fc03871..541f5e485f 100644
--- a/tp/t/08misc_commands.t
+++ b/tp/t/08misc_commands.t
@@ -608,6 +608,8 @@ in example
@codekbdmacro{}
'],
+['exdent_no_line',
+'@exdent'],
);
# info and xml
diff --git a/tp/t/results/misc_commands/exdent_no_line.pl
b/tp/t/results/misc_commands/exdent_no_line.pl
new file mode 100644
index 0000000000..ba42bfe09d
--- /dev/null
+++ b/tp/t/results/misc_commands/exdent_no_line.pl
@@ -0,0 +1,104 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'exdent_no_line'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'exdent',
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'exdent_no_line'} = '@exdent';
+
+
+$result_texts{'exdent_no_line'} = '
+';
+
+$result_errors{'exdent_no_line'} = [
+ {
+ 'error_line' => 'warning: @exdent missing argument
+',
+ 'line_nr' => 1,
+ 'text' => '@exdent missing argument',
+ 'type' => 'warning'
+ }
+];
+
+
+$result_floats{'exdent_no_line'} = {};
+
+
+
+$result_converted{'plaintext'}->{'exdent_no_line'} = '';
+
+
+$result_converted{'html_text'}->{'exdent_no_line'} = '<p class="exdent">
+</p>';
+
+
+$result_converted{'latex'}->{'exdent_no_line'} = '\\documentclass{book}
+\\usepackage{amsfonts}
+\\usepackage{amsmath}
+\\usepackage[gen]{eurosym}
+\\usepackage{textcomp}
+\\usepackage{graphicx}
+\\usepackage{etoolbox}
+\\usepackage{titleps}
+\\usepackage[utf8]{inputenc}
+\\usepackage[T1]{fontenc}
+\\usepackage{float}
+% use hidelinks to remove boxes around links to be similar to Texinfo TeX
+\\usepackage[hidelinks]{hyperref}
+
+\\makeatletter
+\\newcommand{\\Texinfosettitle}{No Title}%
+
+% redefine the \\mainmatter command such that it does not clear page
+% as if in double page
+\\renewcommand\\mainmatter{\\clearpage\\@mainmattertrue\\pagenumbering{arabic}}
+\\newenvironment{Texinfopreformatted}{%
+
\\par\\GNUTobeylines\\obeyspaces\\frenchspacing\\parskip=\\z@\\parindent=\\z@}{}
+{\\catcode`\\^^M=13 \\gdef\\GNUTobeylines{\\catcode`\\^^M=13
\\def^^M{\\null\\par}}}
+\\newenvironment{Texinfoindented}{\\begin{list}{}{}\\item\\relax}{\\end{list}}
+
+% used for substitutions in commands
+\\newcommand{\\Texinfoplaceholder}[1]{}
+
+\\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{}
\\chaptertitle{}][][\\thepage]
+ {\\chaptername{} \\thechapter{}
\\chaptertitle{}}{}{\\thepage}}
+
+% allow line breaking at underscore
+\\let\\Texinfounderscore\\_
+\\renewcommand{\\_}{\\Texinfounderscore\\discretionary{}{}{}}
+\\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
+
+\\makeatother
+% set default for @setchapternewpage
+\\makeatletter
+\\patchcmd{\\chapter}{\\if@openright\\cleardoublepage\\else\\clearpage\\fi}{\\Texinfoplaceholder{setchapternewpage
placeholder}\\clearpage}{}{}
+\\makeatother
+\\pagestyle{single}%
+
+\\end{document}
+';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_exdent_command): handle better exdent with empty argument text.,
Patrice Dumas <=