[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm, tp
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm, tp/init/epub3.pm, tp/init/html32.pm: remove protect_text(), call directly $self->formatting_function('format_protect_text')}. |
Date: |
Mon, 31 Jan 2022 17:18:54 -0500 |
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 535abe9546 * tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm,
tp/init/epub3.pm, tp/init/html32.pm: remove protect_text(), call directly
$self->formatting_function('format_protect_text')}.
535abe9546 is described below
commit 535abe9546ad6f07096d048681197958cb51ffe6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jan 31 23:18:42 2022 +0100
* tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm, tp/init/epub3.pm,
tp/init/html32.pm: remove protect_text(), call directly
$self->formatting_function('format_protect_text')}.
* tp/Texinfo/Convert/HTML.pm (output): do not set
$self->{'structure'}->{'unit_filename'}, it does not seems to be used
and it should not be needed.
---
ChangeLog | 10 ++++++
tp/TODO | 86 +++++++++++++++++++---------------------------
tp/Texinfo/Convert/HTML.pm | 60 +++++++++++++++++---------------
tp/init/chm.pm | 2 +-
tp/init/epub3.pm | 2 +-
tp/init/html32.pm | 4 +--
6 files changed, 82 insertions(+), 82 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17ca1ace0a..8b2bbc6221 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-01-31 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm, tp/init/epub3.pm,
+ tp/init/html32.pm: remove protect_text(), call directly
+ $self->formatting_function('format_protect_text')}.
+
+ * tp/Texinfo/Convert/HTML.pm (output): do not set
+ $self->{'structure'}->{'unit_filename'}, it does not seems to be used
+ and it should not be needed.
+
2022-01-31 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_default_format_end_file): use
diff --git a/tp/TODO b/tp/TODO
index 66444d5e5c..a2ec30c60d 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -33,55 +33,58 @@ Some private function used in conversion
To document:
-----------
-Texinfo::Config texinfo_ functions
-get_conf(), set_conf() (force_conf()?)
+Paragraphs and Preformatted Containers
-Convert depth first.
+Nav
-convert* call
+used in _direction_href_attributes, _get_links
+'BUTTONS_ACCESSKEY' 'BUTTONS_REL'
+'LINKS_BUTTONS'
-args in *convert*, in %default_commands_args
+from_element_direction
+command_target command_filename command_string command_id command_href
+command_contents_href command_contents_target
+special_direction_element
+command_name_special_element_information
+command_root_element_command label_command
+footnote_location_target footnote_location_href
-shared_conversion_state
+ 'format_button' => \&_default_format_button,
+ 'format_element_header' => \&_default_format_element_header,
+ 'format_element_footer' => \&_default_format_element_footer,
+ 'format_navigation_header' => \&_default_format_navigation_header,
+ 'format_navigation_panel' => \&_default_format_navigation_panel,
-register_file_information
+Normal Unit Elements
+Special Elements
-register_footnote
-get_pending_footnotes
+used in _contents_inline_element
+'SPECIAL_ELEMENTS_DIRECTIONS' 'SPECIAL_ELEMENTS_CLASS'
'SPECIAL_ELEMENTS_HEADING'
-register_pending_formatted_inline_content
-get_associated_formatted_inline_content
-get_pending_formatted_inline_content
-associate_pending_formatted_inline_content
-cancel_pending_formatted_inline_content
+ 'format_contents' => \&_default_format_contents,
+ 'format_footnotes_segment' => \&_default_format_footnotes_segment,
+ 'format_footnotes_sequence' => \&_default_format_footnotes_sequence,
-default_types_conversion
-default_types_open
-formatting_function
-special_element_body_formatting
-defaults_special_element_body_formatting
-special_element_body_formatting
+ 'format_begin_file' => \&_default_format_begin_file,
+ 'format_end_file' => \&_default_format_end_file,
-Type '_converted' and '_string' and '_code' for 'text'.
+Other
-used in _direction_href_attributes, _get_links
-'BUTTONS_ACCESSKEY' 'BUTTONS_REL'
-'LINKS_BUTTONS'
+ 'format_css_lines' => \&_default_format_css_lines,
+ 'format_titlepage' => \&_default_format_titlepage,
-used in _contents_inline_element
-'SPECIAL_ELEMENTS_DIRECTIONS' 'SPECIAL_ELEMENTS_CLASS'
'SPECIAL_ELEMENTS_HEADING'
+ 'format_node_redirection_page' => \&_default_format_node_redirection_page,
+
+ 'format_frame_files' => \&_default_format_frame_files,
+
+
+register_footnote
+get_pending_footnotes
-from_element_direction
-command_target command_filename command_string command_id command_href
-command_contents_href command_contents_target
-special_direction_element
-command_name_special_element_information
-command_root_element_command label_command
-footnote_location_target footnote_location_href
required use of
in_string()
@@ -92,12 +95,6 @@ $self->in_math()
$self->in_upper_case()
$self->in_code()
$self->in_space_protected()
-html_attribute_class()
-close_html_lone_element()
-register_opened_section_level()
-close_registered_sections_level()
-
-protect_text? or use of format_protect_text?
use of
Texinfo::Convert::Utils::expand_today()
@@ -105,25 +102,17 @@ Texinfo::Convert::Utils::expand_verbatiminclude
Texinfo::Convert::Converter::float_name_caption()
Texinfo::Convert::Utils::definition_arguments_content
Texinfo::Convert::Utils::definition_category
-convert_tree()
-$self->convert_tree($self->gdt())
Texinfo::Convert::NodeNameNormalization::normalize_node(
Texinfo::Convert::NodeNameNormalization::convert
Texinfo::Convert::Text::convert_to_text(
$self->html_image_file_location_name()
-$self->xml_comment()
-$self->xml_protect_text()
$self->xml_accents()
$self->xml_format_text_with_numeric_entities()
$self->element_is_tree_unit_top()
-$tree_unit->{'structure'} unit_next, unit_filename, unit_prev section_level
associated_unit section_childs
- {'extra'}->{'unit_command'}
Texinfo::Structuring::section_level_adjusted_command_name
Texinfo::Common::section_level()
Texinfo::Common::set_informative_command_value()
$self->preformatted_classes_stack
-$self->{'floats'}
-$self->convert_tree_new_formatting_context()
$self->html_convert_css_string_for_list_mark()
$self->table_item_content_tree() (Converter)
$self->comma_index_subentries_tree() (Converter)
@@ -134,9 +123,6 @@ $self->in_multi_expanded()
$self->html_get_css_elements_classes($filename);
$self->substitute_html_non_breaking_space(
$self->count_elements_in_filename($spec, filename)
-$self->css_get_info
-$self->css_add_info
-$self->get_info
Profiling
=========
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 5eb532df1e..32d9e8c876 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1411,6 +1411,7 @@ sub register_pending_formatted_inline_content($$$)
push @{$self->{'pending_inline_content'}}, [$category, $inline_content];
}
+# cancel only the first pending content for the category
sub cancel_pending_formatted_inline_content($$$)
{
my $self = shift;
@@ -2845,11 +2846,14 @@ sub _convert_image_command($$$$)
$alt_string = $args->[3]->{'string'};
}
if (!defined($alt_string) or ($alt_string eq '')) {
- $alt_string = $self->protect_text($basefile);
+ $alt_string
+ = &{$self->formatting_function('format_protect_text')}($self,
$basefile);
}
+ my $image_src
+ = &{$self->formatting_function('format_protect_text')}($self,
$image_file);
return $self->close_html_lone_element(
- $self->html_attribute_class('img', [$cmdname]).
- " src=\"".$self->protect_text($image_file)."\" alt=\"$alt_string\"");
+ $self->html_attribute_class('img', [$cmdname])
+ . " src=\"$image_src\" alt=\"$alt_string\"");
}
return '';
}
@@ -3011,12 +3015,6 @@ sub _default_format_comment($$) {
return $self->xml_comment(' '.$text);
}
-sub protect_text($$) {
- my $self = shift;
- my $text = shift;
- return &{$self->formatting_function('format_protect_text')}($self, $text);
-}
-
sub _default_format_protect_text($$) {
my $self = shift;
my $text = shift;
@@ -3732,7 +3730,7 @@ sub _convert_raw_command($$$$$)
}
$self->_noticed_line_warn(sprintf(__("raw format %s is not converted"),
$cmdname), $command->{'line_nr'});
- return $self->protect_text($content);
+ return &{$self->formatting_function('format_protect_text')}($self, $content);
}
foreach my $command (keys(%format_raw_commands)) {
@@ -4391,8 +4389,9 @@ sub _convert_itemize_command($$$$$)
'itemize arg');
if ($css_string ne '') {
return $self->html_attribute_class('ul', [$cmdname])
- ." style=\"list-style-type:
'".$self->protect_text($css_string)."'\">\n"
- . $content. "</ul>\n";
+ ." style=\"list-style-type: '".
+ &{$self->formatting_function('format_protect_text')}($self,
$css_string)
+ . "'\">\n" . $content. "</ul>\n";
} else {
return $self->html_attribute_class('ul', [$cmdname])
.">\n" . $content. "</ul>\n";
@@ -4746,7 +4745,8 @@ sub _convert_xref_commands($$$$)
my $manual_name_attribute = '';
if ($file) {
if (not $self->get_conf('NO_CUSTOM_HTML_ATTRIBUTE')) {
- $manual_name_attribute =
"data-manual=\"".$self->protect_text($file)."\" ";
+ $manual_name_attribute = "data-manual=\"".
+ &{$self->formatting_function('format_protect_text')}($self,
$file)."\" ";
}
}
if ($name ne '') {
@@ -4917,7 +4917,9 @@ sub _convert_printindex_command($$$$)
my $summary_letter_link
= $self->html_attribute_class('a',["summary-letter-$cmdname"])
- ." href=\"#$identifier\"><b>".$self->protect_text($letter).'</b></a>';
+ ." href=\"#$identifier\"><b>".
+ &{$self->formatting_function('format_protect_text')}($self, $letter)
+ .'</b></a>';
if ($is_symbol) {
push @non_alpha, $summary_letter_link;
} else {
@@ -5027,9 +5029,10 @@ sub _convert_printindex_command($$$$)
}
# a letter and associated indice entries
$result .= '<tr>' .
- "<th id=\"$letter_id{$letter}\">".$self->protect_text($letter)
- . "</th><td></td><td></td></tr>\n" . $entries_text .
- "<tr><td colspan=\"4\">
".$self->get_conf('DEFAULT_RULE')."</td></tr>\n";
+ "<th id=\"$letter_id{$letter}\">".
+ &{$self->formatting_function('format_protect_text')}($self, $letter)
+ . "</th><td></td><td></td></tr>\n" . $entries_text
+ . "<tr><td colspan=\"4\">
".$self->get_conf('DEFAULT_RULE')."</td></tr>\n";
}
$result .= "</table>\n";
@@ -5355,8 +5358,11 @@ sub _convert_definfoenclose_type($$$$) {
my $content = shift;
# FIXME add a span to mark the original command as a class?
- return $self->protect_text($element->{'extra'}->{'begin'}) . $content
- .$self->protect_text($element->{'extra'}->{'end'});
+ return &{$self->formatting_function('format_protect_text')}($self,
+ $element->{'extra'}->{'begin'})
+ . $content .
+ &{$self->formatting_function('format_protect_text')}($self,
+ $element->{'extra'}->{'end'});
}
$default_types_conversion{'definfoenclose_command'}
@@ -5370,11 +5376,11 @@ sub _convert_text($$$)
my $text = shift;
if ($self->in_verbatim()) {
- return $self->protect_text($text);
+ return &{$self->formatting_function('format_protect_text')}($self, $text);
}
return $text if ($self->in_raw());
$text = uc($text) if ($self->in_upper_case());
- $text = $self->protect_text($text);
+ $text = &{$self->formatting_function('format_protect_text')}($self, $text);
if ($self->get_conf('ENABLE_ENCODING')
and $self->get_conf('OUTPUT_ENCODING_NAME')
and $self->get_conf('OUTPUT_ENCODING_NAME') eq 'utf-8') {
@@ -5443,7 +5449,8 @@ sub _css_string_convert_text($$$)
$text =~ s/`/\x{1F}2018 /g;
}
- $text = $self->protect_text($text);
+ $text
+ = &{$self->formatting_function('format_protect_text')}($self, $text);
$text =~ s/\x{1F}/\\/g;
return $text;
@@ -5692,7 +5699,8 @@ sub _convert_def_line_type($$$$)
my $content = shift;
if ($self->in_string()) {
- return $self->protect_text(Texinfo::Convert::Text::convert_to_text(
+ return &{$self->formatting_function('format_protect_text')}($self,
+ Texinfo::Convert::Text::convert_to_text(
$element,
Texinfo::Convert::Text::copy_options_for_convert_text($self)));
}
@@ -6408,7 +6416,6 @@ foreach my $customized_reference ('label_target_name',
'node_file_name',
'format_program_string' => \&_default_format_program_string,
'format_protect_text' => \&_default_format_protect_text,
'format_separate_anchor' => \&_default_format_separate_anchor,
- 'format_special_element_body' => \&_default_format_special_element_body,
'format_titlepage' => \&_default_format_titlepage,
);
@@ -9477,9 +9484,6 @@ sub output($$)
$no_page_out_filepath, $!));
return undef;
}
- # this can be used in init file when there are no tree units.
- # FIXME use an API? Set in $self->{'no_page'}?
- $self->{'structure'}->{'unit_filename'} = $no_page_output_filename;
$self->{'out_filepaths'}->{$no_page_output_filename} =
$no_page_out_filepath;
$self->{'current_filename'} = $no_page_output_filename;
@@ -9743,7 +9747,7 @@ sub _protect_class_name($$)
my $self = shift;
my $class_name = shift;
$class_name =~ s/[$characters_replaced_from_class_names]/-/g;
- return $self->protect_text($class_name);
+ return &{$self->formatting_function('format_protect_text')}($self,
$class_name);
}
# Convert tree element $ELEMENT, and return HTML text for the output files.
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index 951ee03ecf..344ffe31eb 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -198,7 +198,7 @@ sub _chm_convert_tree_to_text($$;$)
$options = {} if (!defined($options));
- return $converter->protect_text(
+ return &{$converter->formatting_function('format_protect_text')}($converter,
Texinfo::Convert::Text::convert_to_text($tree,
{Texinfo::Convert::Text::copy_options_for_convert_text($converter),
%$options}));
diff --git a/tp/init/epub3.pm b/tp/init/epub3.pm
index 58a7a06a9d..cf9214b70a 100644
--- a/tp/init/epub3.pm
+++ b/tp/init/epub3.pm
@@ -120,7 +120,7 @@ sub _epub_convert_tree_to_text($$;$)
$options = {} if (!defined($options));
- return $converter->protect_text(
+ return &{$converter->formatting_function('format_protect_text')}($converter,
Texinfo::Convert::Text::convert_to_text($tree,
{Texinfo::Convert::Text::copy_options_for_convert_text($converter),
%$options}));
diff --git a/tp/init/html32.pm b/tp/init/html32.pm
index 0b09175418..05bb966d1f 100644
--- a/tp/init/html32.pm
+++ b/tp/init/html32.pm
@@ -143,12 +143,12 @@ sub html32_convert_text($$$$)
# do that first because in verb and verbatim, type is 'raw'
if ($self->in_verbatim()) {
- return $self->protect_text($text);
+ return &{$self->formatting_function('format_protect_text')}($self, $text);
}
return $text if ($self->in_raw());
$text = uc($text) if ($self->in_upper_case());
- $text = $self->protect_text($text);
+ $text = &{$self->formatting_function('format_protect_text')}($self, $text);
if (!$self->in_code() and !$self->in_math()) {
$text =~ s/``/"/g;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm, tp/init/chm.pm, tp/init/epub3.pm, tp/init/html32.pm: remove protect_text(), call directly $self->formatting_function('format_protect_text')}.,
Patrice Dumas <=