[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_co
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_command), tp/Texinfo/XS/convert/convert_html.c (convert_heading_command), tp/init/book.pm (book_convert_heading_command): use only one variable for toc and mini toc or menu. |
Date: |
Tue, 01 Oct 2024 12:42:47 -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 d1eb9c5656 * tp/Texinfo/Convert/HTML.pm (_convert_heading_command),
tp/Texinfo/XS/convert/convert_html.c (convert_heading_command), tp/init/book.pm
(book_convert_heading_command): use only one variable for toc and mini toc or
menu.
d1eb9c5656 is described below
commit d1eb9c5656c0c83cac2ffc6afd3a96870388202c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jul 25 21:46:34 2024 +0200
* tp/Texinfo/Convert/HTML.pm (_convert_heading_command),
tp/Texinfo/XS/convert/convert_html.c (convert_heading_command),
tp/init/book.pm (book_convert_heading_command): use only one variable
for toc and mini toc or menu.
---
ChangeLog | 7 +++++++
tp/Texinfo/Convert/HTML.pm | 18 +++++++-----------
tp/Texinfo/XS/convert/convert_html.c | 30 +++++++++++-------------------
tp/init/book.pm | 21 ++++++++++-----------
4 files changed, 35 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 26df58564e..ac2dc207f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-07-25 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_convert_heading_command),
+ tp/Texinfo/XS/convert/convert_html.c (convert_heading_command),
+ tp/init/book.pm (book_convert_heading_command): use only one variable
+ for toc and mini toc or menu.
+
2024-07-25 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/input.c (set_input_encoding)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 7aab179858..2461d36b55 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -4964,7 +4964,7 @@ sub _convert_heading_command($$$$$)
$sections_list = $document->sections_list();
}
- my $tables_of_contents = '';
+ my $toc_or_mini_toc_or_auto_menu = '';
if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top'
and $cmdname eq 'top'
and $sections_list
@@ -4974,17 +4974,16 @@ sub _convert_heading_command($$$$$)
my $contents_text
= $self->_contents_inline_element($content_command_name, undef);
if ($contents_text ne '') {
- $tables_of_contents .= $contents_text;
+ $toc_or_mini_toc_or_auto_menu .= $contents_text;
}
}
}
}
- my $mini_toc_or_auto_menu = '';
- if ($tables_of_contents eq ''
+ if ($toc_or_mini_toc_or_auto_menu eq ''
and $sectioning_heading_commands{$cmdname}) {
if ($self->get_conf('FORMAT_MENU') eq 'sectiontoc') {
- $mini_toc_or_auto_menu = _mini_toc($self, $element);
+ $toc_or_mini_toc_or_auto_menu = _mini_toc($self, $element);
} elsif ($self->get_conf('FORMAT_MENU') eq 'menu') {
my $node = $element->{'extra'}->{'associated_node'}
if ($element->{'extra'} and $element->{'extra'}->{'associated_node'});
@@ -4998,7 +4997,6 @@ sub _convert_heading_command($$$$$)
if ($node->{'extra'}
and not $node->{'extra'}->{'menus'}
and $automatic_directions) {
- my $document = $self->get_info('document');
my $identifiers_target;
if ($document) {
$identifiers_target = $document->labels_information();
@@ -5007,7 +5005,7 @@ sub _convert_heading_command($$$$$)
= Texinfo::Structuring::new_complete_menu_master_menu($self,
$identifiers_target, $node);
if ($menu_node) {
- $mini_toc_or_auto_menu = $self->convert_tree($menu_node,
+ $toc_or_mini_toc_or_auto_menu = $self->convert_tree($menu_node,
'master menu');
}
}
@@ -5025,8 +5023,7 @@ sub _convert_heading_command($$$$$)
$result .= &{$self->formatting_function('format_separate_anchor')}($self,
$element_id,
$id_class);
$result .= $element_header;
- $result .= $tables_of_contents;
- $result .= $mini_toc_or_auto_menu;
+ $result .= $toc_or_mini_toc_or_auto_menu;
return $result;
}
}
@@ -5193,8 +5190,7 @@ sub _convert_heading_command($$$$$)
$result .= $content if (defined($content));
- $result .= $tables_of_contents;
- $result .= $mini_toc_or_auto_menu;
+ $result .= $toc_or_mini_toc_or_auto_menu;
return $result;
}
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index b013c1a651..e629f9ad29 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -10525,9 +10525,7 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
const char *element_id;
const OUTPUT_UNIT *output_unit = 0;
TEXT element_header;
- /* could use only one, but this is more similar to perl code */
- TEXT tables_of_contents;
- TEXT mini_toc_or_auto_menu;
+ TEXT toc_or_mini_toc_or_auto_menu;
enum command_id level_corrected_cmd;
int status;
char *heading;
@@ -10577,8 +10575,8 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
format_element_header (self, element_command_name (element), element,
output_unit, &element_header);
- text_init (&tables_of_contents);
- text_append (&tables_of_contents, "");
+ text_init (&toc_or_mini_toc_or_auto_menu);
+ text_append (&toc_or_mini_toc_or_auto_menu, "");
if (element->e.c->cmd == CM_top
&& self->conf->CONTENTS_OUTPUT_LOCATION.o.string
&& !strcmp (self->conf->CONTENTS_OUTPUT_LOCATION.o.string, "after_top")
@@ -10601,22 +10599,20 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
= contents_inline_element (self, cmd, 0);
if (contents_text)
{
- text_append (&tables_of_contents, contents_text);
+ text_append (&toc_or_mini_toc_or_auto_menu, contents_text);
free (contents_text);
}
}
}
}
- text_init (&mini_toc_or_auto_menu);
- text_append (&mini_toc_or_auto_menu, "");
- if (tables_of_contents.end <= 0
+ if (toc_or_mini_toc_or_auto_menu.end <= 0
&& (flags & CF_sectioning_heading)
&& self->conf->FORMAT_MENU.o.string)
{
if (!strcmp (self->conf->FORMAT_MENU.o.string, "sectiontoc"))
{
- mini_toc_internal (self, element, &mini_toc_or_auto_menu);
+ mini_toc_internal (self, element, &toc_or_mini_toc_or_auto_menu);
}
else if (!strcmp (self->conf->FORMAT_MENU.o.string, "menu"))
{
@@ -10637,7 +10633,7 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
{
add_tree_to_build (self, menu_node);
convert_to_html_internal (self, menu_node,
- &mini_toc_or_auto_menu,
+ &toc_or_mini_toc_or_auto_menu,
"master menu");
remove_tree_to_build (self, menu_node);
/* there are only new or copied elements in the menu */
@@ -10660,10 +10656,8 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
builtin_command_name (cmd), result);
text_append (result, element_header.text);
free (element_header.text);
- text_append (result, tables_of_contents.text);
- free (tables_of_contents.text);
- text_append (result, mini_toc_or_auto_menu.text);
- free (mini_toc_or_auto_menu.text);
+ text_append (result, toc_or_mini_toc_or_auto_menu.text);
+ free (toc_or_mini_toc_or_auto_menu.text);
return;
}
}
@@ -10918,10 +10912,8 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
if (content)
text_append (result, content);
- text_append (result, tables_of_contents.text);
- free (tables_of_contents.text);
- text_append (result, mini_toc_or_auto_menu.text);
- free (mini_toc_or_auto_menu.text);
+ text_append (result, toc_or_mini_toc_or_auto_menu.text);
+ free (toc_or_mini_toc_or_auto_menu.text);
}
void
diff --git a/tp/init/book.pm b/tp/init/book.pm
index ec357345b1..6f71c2b003 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -218,7 +218,7 @@ sub book_convert_heading_command($$$$$)
$sections_list = $document->sections_list();
}
- my $tables_of_contents = '';
+ my $toc_or_mini_toc_or_auto_menu = '';
if ($self->get_conf('CONTENTS_OUTPUT_LOCATION') eq 'after_top'
and $cmdname eq 'top'
and $sections_list
@@ -228,24 +228,25 @@ sub book_convert_heading_command($$$$$)
my $contents_text
= $self->_contents_inline_element($content_command_name, undef);
if ($contents_text ne '') {
- $tables_of_contents .= $contents_text;
+ $toc_or_mini_toc_or_auto_menu .= $contents_text;
}
}
}
}
- my $sub_toc = '';
- if ($tables_of_contents eq ''
+ if ($toc_or_mini_toc_or_auto_menu eq ''
+ and $element->{'extra'}
and $element->{'extra'}->{'section_childs'}
and scalar(@{$element->{'extra'}->{'section_childs'}})
# avoid a double of contents if already after title
and ($cmdname ne 'top'
or $self->get_conf('CONTENTS_OUTPUT_LOCATION') ne 'after_title')
and $Texinfo::Commands::sectioning_heading_commands{$cmdname}) {
- $sub_toc .= $self->html_attribute_class('ul',
[$toc_numbered_mark_class]).">\n";
- $sub_toc .= book_print_sub_toc($self, $element,
+ $toc_or_mini_toc_or_auto_menu
+ .= $self->html_attribute_class('ul', [$toc_numbered_mark_class]).">\n";
+ $toc_or_mini_toc_or_auto_menu .= book_print_sub_toc($self, $element,
$element->{'extra'}->{'section_childs'}->[0]);
- $sub_toc .= "</ul>\n";
+ $toc_or_mini_toc_or_auto_menu .= "</ul>\n";
}
if ($self->get_conf('NO_TOP_NODE_OUTPUT')
@@ -258,8 +259,7 @@ sub book_convert_heading_command($$$$$)
$result .= &{$self->formatting_function('format_separate_anchor')}($self,
$element_id,
$id_class);
$result .= $element_header;
- $result .= $tables_of_contents;
- $result .= $sub_toc;
+ $result .= $toc_or_mini_toc_or_auto_menu;
return $result;
}
}
@@ -424,8 +424,7 @@ sub book_convert_heading_command($$$$$)
$heading_id, $cmdname);
}
- $result .= $tables_of_contents;
- $result .= $sub_toc;
+ $result .= $toc_or_mini_toc_or_auto_menu;
$result .= $content if (defined($content));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_command), tp/Texinfo/XS/convert/convert_html.c (convert_heading_command), tp/init/book.pm (book_convert_heading_command): use only one variable for toc and mini toc or menu.,
Patrice Dumas <=