[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (%defaults), tp/Texi
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (%defaults), tp/Texinfo/Common.pm (@variable_other_settables): rename SPECIAL_ELEMENTS_NAME as SPECIAL_ELEMENTS_HEADING. |
Date: |
Wed, 08 Sep 2021 16:58:09 -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 8427aa4 * tp/Texinfo/Convert/HTML.pm (%defaults),
tp/Texinfo/Common.pm (@variable_other_settables): rename SPECIAL_ELEMENTS_NAME
as SPECIAL_ELEMENTS_HEADING.
8427aa4 is described below
commit 8427aa4411c8c9d2e24b052f6df7120ac404cc34
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 8 22:58:00 2021 +0200
* tp/Texinfo/Convert/HTML.pm (%defaults), tp/Texinfo/Common.pm
(@variable_other_settables): rename SPECIAL_ELEMENTS_NAME as
SPECIAL_ELEMENTS_HEADING.
* tp/Texinfo/Convert/HTML.pm (_prepare_special_elements):
set 'name' in 'extra' for special element name instead of
'special_element'. Use 'type' 'special_element' to detect
that an element is a special element.
---
ChangeLog | 11 ++++++++
tp/Texinfo/Common.pm | 2 +-
tp/Texinfo/Convert/HTML.pm | 61 ++++++++++++++++++++++++---------------------
tp/t/init/only_toc_out.init | 2 +-
4 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7726170..b52ad30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2021-09-08 Patrice Dumas <pertusus@free.fr>
+ * tp/Texinfo/Convert/HTML.pm (%defaults), tp/Texinfo/Common.pm
+ (@variable_other_settables): rename SPECIAL_ELEMENTS_NAME as
+ SPECIAL_ELEMENTS_HEADING.
+
+ * tp/Texinfo/Convert/HTML.pm (_prepare_special_elements):
+ set 'name' in 'extra' for special element name instead of
+ 'special_element'. Use 'type' 'special_element' to detect
+ that an element is a special element.
+
+2021-09-08 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Config.pm (texinfo_set_format_from_init_file)
(GNUT_get_format_from_init_file), tp/texi2any.pl,
tp/init/chm.pm: use a propoer API in Texinfo::Config
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index fd57d42..2b909f8 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -362,7 +362,7 @@ my @variable_other_settables = (
'CHAPTER_FOOTER_BUTTONS', 'SECTION_FOOTER_BUTTONS',
'NODE_FOOTER_BUTTONS',
'MISC_BUTTONS', 'CHAPTER_BUTTONS', 'BUTTONS_NAME',
- 'BUTTONS_EXAMPLE', 'SPECIAL_ELEMENTS_NAME', 'SPECIAL_ELEMENTS_CLASS',
+ 'BUTTONS_EXAMPLE', 'SPECIAL_ELEMENTS_HEADING', 'SPECIAL_ELEMENTS_CLASS',
'ACTIVE_ICONS', 'PASSIVE_ICONS',
# set from command line
'CSS_FILES', # --css-include
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 8c4a61a..709679a 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -38,8 +38,8 @@
# done in that case, without any HTML element such that the result
# can be in an attribute or in a comment.
#
-# FIXME: there is already a case with a side effect, with the
-# variable $html_menu_entry_index.
+# FIXME: there are already cases with side effects, with the
+# variables $html_menu_entry_index, $foot_lines.
#
# Original author: Patrice Dumas <pertusus@free.fr>
@@ -362,7 +362,8 @@ sub element_command($$)
if ($element and $element->{'extra'}) {
if ($element->{'extra'}->{'unit_command'}) {
return $element->{'extra'}->{'unit_command'};
- } elsif ($element->{'extra'}->{'special_element'}) {
+ } elsif (defined($element->{'type'})
+ and $element->{'type'} eq 'special_element') {
return $element;
}
}
@@ -535,11 +536,11 @@ sub command_text($$;$)
}
my $tree;
if (!$target->{'tree'}) {
- if ($command->{'extra'}
- and $command->{'extra'}->{'special_element'}) {
- my $special_element = $command->{'extra'}->{'special_element'};
- $tree = $self->get_conf('SPECIAL_ELEMENTS_NAME')->{$special_element};
- $explanation = "command_text $special_element";
+ if (defined($command->{'type'})
+ and $command->{'type'} eq 'special_element') {
+ my $special_element_name = $command->{'extra'}->{'name'};
+ $tree =
$self->get_conf('SPECIAL_ELEMENTS_HEADING')->{$special_element_name};
+ $explanation = "command_text $special_element_name";
} elsif ($command->{'cmdname'} and ($command->{'cmdname'} eq 'node'
or $command->{'cmdname'} eq
'anchor')) {
$tree = {'type' => '_code',
@@ -837,7 +838,7 @@ my %PASSIVE_ICONS = (
'PrevFile', '',
);
-my (%BUTTONS_TEXT, %BUTTONS_GOTO, %BUTTONS_NAME, %SPECIAL_ELEMENTS_NAME);
+my (%BUTTONS_TEXT, %BUTTONS_GOTO, %BUTTONS_NAME, %SPECIAL_ELEMENTS_HEADING);
my %defaults = (
'ENABLE_ENCODING' => 0,
@@ -938,7 +939,7 @@ my %defaults = (
'BUTTONS_TEXT' => \%BUTTONS_TEXT,
'ACTIVE_ICONS' => \%ACTIVE_ICONS,
'PASSIVE_ICONS' => \%PASSIVE_ICONS,
- 'SPECIAL_ELEMENTS_NAME' => \%SPECIAL_ELEMENTS_NAME,
+ 'SPECIAL_ELEMENTS_HEADING' => \%SPECIAL_ELEMENTS_HEADING,
'SPECIAL_ELEMENTS_CLASS' => {
'About' => 'about',
'Contents' => 'contents',
@@ -1080,7 +1081,7 @@ sub _translate_names($)
$BUTTONS_NAME{'FirstInFile'.$button} = $BUTTONS_NAME{$button};
}
- %SPECIAL_ELEMENTS_NAME = (
+ %SPECIAL_ELEMENTS_HEADING = (
'About' => $self->gdt('About This Document'),
'Contents' => $self->gdt('Table of Contents'),
'Overview' => $self->gdt('Short Table of Contents'),
@@ -1089,7 +1090,7 @@ sub _translate_names($)
# delete the tree and formatted results for special elements
# such that they are redone with the new tree when needed.
- foreach my $special_element (keys (%SPECIAL_ELEMENTS_NAME)) {
+ foreach my $special_element (keys (%SPECIAL_ELEMENTS_HEADING)) {
if ($self->{'special_elements_types'}->{$special_element} and
$self->{'targets'}->{$self->{'special_elements_types'}->{$special_element}}) {
my $target
@@ -3849,7 +3850,7 @@ sub _contents_inline_element($$$)
# happens when called as convert() and not output()
#cluck "$cmdname special element not defined";
$heading
- =
$self->convert_tree($self->get_conf('SPECIAL_ELEMENTS_NAME')->{$special_element_name});
+ =
$self->convert_tree($self->get_conf('SPECIAL_ELEMENTS_HEADING')->{$special_element_name});
}
$result .= ">\n";
my $class =
$self->get_conf('SPECIAL_ELEMENTS_CLASS')->{$special_element_name};
@@ -4762,10 +4763,10 @@ sub _convert_special_element_type($$$$)
my $result = '';
- my $special_element = $element->{'extra'}->{'special_element'};
+ my $special_element_name = $element->{'extra'}->{'name'};
$result .= join('', $self->close_registered_sections_level(0));
my $id = $self->command_id($element);
- $result .= "<div class=\"${special_element}_element\"";
+ $result .= "<div class=\"${special_element_name}_element\"";
if ($id ne '') {
$result .= " id=\"$id\"";
}
@@ -4777,17 +4778,16 @@ sub _convert_special_element_type($$$$)
$self->get_conf('MISC_BUTTONS'), undef, $element);
}
my $heading = $self->command_text($element);
- my $element_name = $element->{'extra'}->{'special_element'};
- my $class = $self->get_conf('SPECIAL_ELEMENTS_CLASS')->{$element_name};
+ my $class =
$self->get_conf('SPECIAL_ELEMENTS_CLASS')->{$special_element_name};
my $level = $self->get_conf('CHAPTER_HEADER_LEVEL');
- if ($element_name eq 'Footnotes') {
+ if ($special_element_name eq 'Footnotes') {
$level = $self->get_conf('FOOTNOTE_SEPARATE_HEADER_LEVEL');
}
$result .= &{$self->{'format_heading_text'}}($self, $class.'-heading',
$heading, $level)."\n";
my $special_element_body .= &{$self->{'format_special_element_body'}}
- ($self, $special_element, $element);
+ ($self, $special_element_name, $element);
# This may happen with footnotes in regions that are not expanded,
# like @copying or @titlepage
@@ -4854,14 +4854,16 @@ sub _default_format_element_footer($$$$)
my $next_is_top = ($element->{'unit_next'}
and
$self->element_is_tree_unit_top($element->{'unit_next'}));
my $next_is_special = (defined($element->{'unit_next'})
- and $element->{'unit_next'}->{'extra'}->{'special_element'});
+ and defined($element->{'unit_next'}->{'type'})
+ and $element->{'unit_next'}->{'type'} eq 'special_element');
my $end_page = (!$element->{'unit_next'}
or (defined($element->{'filename'})
and $element->{'filename'} ne $element->{'unit_next'}->{'filename'}
and $self->{'file_counters'}->{$element->{'filename'}} == 1));
- my $is_special = $element->{'extra'}->{'special_element'};
+ my $is_special = (defined($element->{'type'})
+ and $element->{'type'} eq 'special_element');
if (($end_page or $next_is_top or $next_is_special or $is_top)
and $self->get_conf('VERTICAL_HEAD_NAVIGATION')
@@ -5964,7 +5966,7 @@ sub _prepare_special_elements($$$$)
next unless ($do_special{$type});
my $element = {'type' => 'special_element',
- 'extra' => {'special_element' => $type,
+ 'extra' => {'name' => $type,
}};
$element->{'extra'}->{'directions'}->{'This'} = $element;
$self->{'special_elements_types'}->{$type} = $element;
@@ -6016,7 +6018,7 @@ sub _prepare_special_elements($$$$)
$default_filename .= '.'.$extension if (defined($extension));
my $element = {'type' => 'special_element',
- 'extra' => {'special_element' => $type,
+ 'extra' => {'name' => $type,
}};
# only the filename is used
@@ -6076,7 +6078,7 @@ sub _prepare_contents_elements($)
}
my $contents_element = {'type' => 'special_element',
- 'extra' => {'special_element' => $type}};
+ 'extra' => {'name' => $type}};
$self->{'special_elements_types'}->{$type} = $contents_element;
my $target = $self->{'misc_elements_targets'}->{$type};
my $filename;
@@ -6454,7 +6456,8 @@ sub _element_direction($$$$;$)
$target = $self->{'targets'}->{$command} if ($command);
$type = 'text_nonumber';
} else {
- if ($element_target->{'extra'}->{'special_element'}) {
+ if (defined($element_target->{'type'})
+ and $element_target->{'type'} eq 'special_element') {
$command = $element_target;
} else {
$command = $element_target->{'extra'}->{'unit_command'};
@@ -6971,7 +6974,7 @@ sub _default_format_footnotes_text($)
if (defined($self->get_conf('DEFAULT_RULE'))
and $self->get_conf('DEFAULT_RULE') ne '');
my $footnote_heading
- =
$self->convert_tree($self->get_conf('SPECIAL_ELEMENTS_NAME')->{'Footnotes'});
+ =
$self->convert_tree($self->get_conf('SPECIAL_ELEMENTS_HEADING')->{'Footnotes'});
my $class = $self->get_conf('SPECIAL_ELEMENTS_CLASS')->{'Footnotes'};
my $level = $self->get_conf('FOOTNOTE_END_HEADER_LEVEL');
$result .= &{$self->{'format_heading_text'}}($self, $class.'-heading',
@@ -7691,7 +7694,8 @@ sub output($$)
# First do the special pages, to avoid outputting these if they are
# empty.
my $special_element_content;
- if ($element->{'extra'} and $element->{'extra'}->{'special_element'}) {
+ if (defined($element->{'type'})
+ and $element->{'type'} eq 'special_element') {
$special_element_content .= $self->_convert($element);
if ($special_element_content eq '') {
$self->{'file_counters'}->{$element->{'filename'}}--;
@@ -8200,7 +8204,8 @@ sub _convert($$;$)
} elsif ($element->{'type'} eq 'preformatted'
or $element->{'type'} eq 'rawpreformatted') {
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'preformatted_number'}++;
- } elsif ($element->{'type'} eq 'unit' or $element->{'type'} eq
'special_element') {
+ } elsif ($element->{'type'} eq 'unit'
+ or $element->{'type'} eq 'special_element') {
$self->{'current_root_element'} = $element;
$self->{'current_filename'} = $element->{'filename'};
} elsif ($pre_class_types{$element->{'type'}}) {
diff --git a/tp/t/init/only_toc_out.init b/tp/t/init/only_toc_out.init
index c95507e..731474d 100644
--- a/tp/t/init/only_toc_out.init
+++ b/tp/t/init/only_toc_out.init
@@ -12,7 +12,7 @@ sub toc_out_element_file_name($$$$$)
my $filename = shift;
my $prefix = $converter->{'document_name'};
- my $type = $element->{'extra'}->{'special_element'};
+ my $type = $element->{'extra'}->{'name'};
if ($type and $type ne 'Contents')
{
$filename = "$prefix.".$converter->get_conf('EXTENSION');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (%defaults), tp/Texinfo/Common.pm (@variable_other_settables): rename SPECIAL_ELEMENTS_NAME as SPECIAL_ELEMENTS_HEADING.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Config.pm (texinfo_set_format_from_init_file) (GNUT_get_format_from_init_file), tp/texi2any.pl, tp/init/chm.pm: use a propoer API in Texinfo::Config to set format from init file with texinfo_set_format_from_init_file() and retrieve from main program with GNUT_get_format_from_init_file().
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm (element_is_inline), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoXML.pm: move _is_inline() and _in_inline() from Texinfo::Convert::Converter to Texinfo::Common, rename and merge in element_is_inline() adding an optional argument to de able to also do the same as _in_inline().
- Previous by thread:
branch master updated: * tp/Texinfo/Config.pm (texinfo_set_format_from_init_file) (GNUT_get_format_from_init_file), tp/texi2any.pl, tp/init/chm.pm: use a propoer API in Texinfo::Config to set format from init file with texinfo_set_format_from_init_file() and retrieve from main program with GNUT_get_format_from_init_file().
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm (element_is_inline), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/TexinfoXML.pm: move _is_inline() and _in_inline() from Texinfo::Convert::Converter to Texinfo::Common, rename and merge in element_is_inline() adding an optional argument to de able to also do the same as _in_inline().
- Index(es):