texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Common.pm: more consistent export ok


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm: more consistent export ok. Do not export print_tree. Rename print_tree() as debug_print_tree(). Rename add_preamble_before_content as _add_preamble_before_content. Remove _collect_references, unused and doing something strange.
Date: Wed, 14 Sep 2022 16:25:17 -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 3bfa9bad15 * tp/Texinfo/Common.pm: more consistent export ok.  Do not 
export print_tree.  Rename print_tree() as debug_print_tree(). Rename 
add_preamble_before_content as _add_preamble_before_content. Remove 
_collect_references, unused and doing something strange.
3bfa9bad15 is described below

commit 3bfa9bad15aac9d17f2677b8fc2edaf7ec693395
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 14 22:25:07 2022 +0200

    * tp/Texinfo/Common.pm: more consistent export ok.  Do not
    export print_tree.  Rename print_tree() as debug_print_tree().
    Rename add_preamble_before_content as _add_preamble_before_content.
    Remove _collect_references, unused and doing something strange.
    
    * tp/Texinfo/Common.pm (texinfo_special_joint_transformation),
    tp/texi2any.pl: rename html_joint_transformation as
    texinfo_special_joint_transformation.
    
    * tp/Texinfo/Convert/Text.pm (text_heading),
    tp/Texinfo/Convert/Plaintext.pm: rename Texinfo::Convert::Text heading
    as text_heading.
    
    * tp/Texinfo/Convert/Text.pm: rename ascii_accents as _ascii_accents.
    
    * tp/Texinfo/Convert/Utils.pm (add_heading_number), tp/ext/epub3.pm,
    tp/init/chm.pm, tp/Texinfo/Convert/Text.pm: rename
    Texinfo::Convert::Utils numbered_heading as add_heading_number.  Do
    not chomp text in add_heading_number().
    
    * tp/Texinfo/ParserNonXS.pm: remove _print_tree(), unused.
---
 ChangeLog                                       |  24 +++++
 tp/TODO                                         |  10 +-
 tp/Texinfo/Common.pm                            | 134 ++++++++++++------------
 tp/Texinfo/Convert/Converter.pm                 |   2 +-
 tp/Texinfo/Convert/DocBook.pm                   |   2 +-
 tp/Texinfo/Convert/Plaintext.pm                 |  11 +-
 tp/Texinfo/Convert/Text.pm                      |  31 +++---
 tp/Texinfo/Convert/Utils.pm                     |   9 +-
 tp/Texinfo/ParserNonXS.pm                       |   8 --
 tp/Texinfo/Structuring.pm                       |  19 ++--
 tp/ext/epub3.pm                                 |   5 +-
 tp/init/chm.pm                                  |   8 +-
 tp/t/automatic_menus.t                          |   2 +-
 tp/t/init/translate_txiinternalvalue_macro.init |   2 +-
 tp/texi2any.pl                                  |   2 +-
 15 files changed, 144 insertions(+), 125 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 405e6b39c7..588f7e1c84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2022-09-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm: more consistent export ok.  Do not
+       export print_tree.  Rename print_tree() as debug_print_tree().
+       Rename add_preamble_before_content as _add_preamble_before_content.
+       Remove _collect_references, unused and doing something strange.
+
+       * tp/Texinfo/Common.pm (texinfo_special_joint_transformation),
+       tp/texi2any.pl: rename html_joint_transformation as
+       texinfo_special_joint_transformation.
+
+       * tp/Texinfo/Convert/Text.pm (text_heading),
+       tp/Texinfo/Convert/Plaintext.pm: rename Texinfo::Convert::Text heading
+       as text_heading.
+
+       * tp/Texinfo/Convert/Text.pm: rename ascii_accents as _ascii_accents.
+
+       * tp/Texinfo/Convert/Utils.pm (add_heading_number), tp/ext/epub3.pm,
+       tp/init/chm.pm, tp/Texinfo/Convert/Text.pm: rename
+       Texinfo::Convert::Utils numbered_heading as add_heading_number.  Do
+       not chomp text in add_heading_number().
+
+       * tp/Texinfo/ParserNonXS.pm: remove _print_tree(), unused.
+
 2022-09-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (output_files_open_out): do not set
diff --git a/tp/TODO b/tp/TODO
index 40cb65b15f..61bdd0d981 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -81,9 +81,13 @@ In Plaintext, @quotation text should have the right margin 
narrowed.
 
 Text after @bye should be kept as is when redoing Texinfo.
 
-Sorting of index entries should be locale dependent and sort properly
-unicode sorting.
-my $collator = Unicode::Collate::Locale->new('locale' => $locale_name, 
'normalization' => 'NFKD')
+Sorting of index entries should be language dependent and sort properly
+unicode sorting.  Unicode::Collate has been in perl core long enough, but
+Unicode::Collate::Locale is present since perl major version 5.14 only,
+released in 2011.  So probably better to use Unicode::Collate until 2031
+(and if documentlanguage is not set) and switch to Unicode::Collate::Locale
+at this date.
+my $collator = Unicode::Collate::Locale->new('locale' => $documentlanguage, 
'normalization' => 'NFKD')
 @sorted = $collator->sort(@not_sorted);
 
 
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index e9196ce9bc..695c00ed8a 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -44,16 +44,15 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 @ISA = qw(Exporter);
 
 %EXPORT_TAGS = ( 'all' => [ qw(
-debug_hash
-debug_list
-is_content_empty
+collect_commands_in_tree
+collect_commands_list_in_tree
 move_index_entries_after_items_in_tree
-normalize_top_node_name
+protect_colon_in_tree
 protect_comma_in_tree
 protect_first_parenthesis
-protect_colon_in_tree
 protect_node_after_label_in_tree
-trim_spaces_comment_from_content
+relate_index_entries_to_table_entries_in_tree
+valid_customization_option
 valid_tree_transformation
 ) ] );
 
@@ -62,7 +61,7 @@ valid_tree_transformation
 # This is where the Texinfo modules get access to __( without explicit
 # import.
 @EXPORT = qw(
-__ __p print_tree
+__ __p
 );
 
 $VERSION = '6.8dev';
@@ -472,7 +471,7 @@ sub valid_tree_transformation ($)
 }
 
 
-# @-commands classifications
+# @-commands classifications and other information on @-commands
 
 our %no_brace_commands;             # commands never taking braces
 %no_brace_commands = (
@@ -1184,13 +1183,13 @@ foreach my $formattable_or_formatted_misc_command (
 
 
 # functions for main program.  Should not be called in user-defined code.
-# locate_init_file() is also called in HTML Converter for htmlxref files.
+# FIXME locate_init_file() is also called in HTML Converter for htmlxref files.
 
-# file:        file name to locate. It can be a file path. Binary string.
-# directories: a reference on a array containing a list of directories to
-#              search the file in. Binary strings.
-# all_files:   if true collect all the files with that name, otherwise stop
-#              at first match.
+# $FILE:        file name to locate. It can be a file path. Binary string.
+# $DIRECTORIES: a reference on a array containing a list of directories to
+#               search the file in. Binary strings.
+# $ALL_FILES:   if true collect all the files with that name, otherwise stop
+#               at first match.
 sub locate_init_file($$$)
 {
   my $file = shift;
@@ -1217,7 +1216,7 @@ sub locate_init_file($$$)
 }
 
 
-# internal API to open, set encoding and register files.
+# API to open, set encoding and register files.
 # In general $SELF is stored as $converter->{'output_files'}
 # and should be accessed through $converter->output_files_information();
 #
@@ -1232,6 +1231,9 @@ sub locate_init_file($$$)
 # $OUTPUT_ENCODING argument overrides the output encoding.
 # returns the opened filehandle, or undef if opening failed,
 # and the $! error message or undef if opening succeeded.
+#
+# TODO next two functions not documented anywhere, probably relevant to 
document
+# both in POD and in HTML Customization API.
 sub output_files_open_out($$$;$$)
 {
   my $self = shift;
@@ -1288,6 +1290,11 @@ sub output_files_register_closed($$)
   }
 }
 
+# The next two functions should not be called from user-defined
+# code, only from the main program.  They are defined here for
+# consistency of the API and clarity of the code.
+#
+# see the description of $SELF in comment above output_files_open_out.
 sub output_files_opened_files($)
 {
   my $self = shift;
@@ -1298,6 +1305,7 @@ sub output_files_opened_files($)
   }
 }
 
+# see the description of $SELF in comment above output_files_open_out.
 sub output_files_unclosed_files($)
 {
   my $self = shift;
@@ -1306,7 +1314,7 @@ sub output_files_unclosed_files($)
 # end of output_files API
 
 
-# functions used in main program, parser and structuring.
+# functions used in main program, Parser and/or Texinfo::Structuring.
 # Not supposed to be called in user-defined code.
 
 # Called both in NonXS and XS parsers
@@ -1334,11 +1342,10 @@ sub rearrange_tree_beginning($$)
       if (@{$before_setfilename->{'contents'}});
   }
   
-  add_preamble_before_content($before_node_section);
+  _add_preamble_before_content($before_node_section);
 }
 
-# TODO document
-sub add_preamble_before_content($)
+sub _add_preamble_before_content($)
 {
   my $before_node_section = shift;
   
@@ -1392,6 +1399,8 @@ sub warn_unknown_language($) {
   return @messages;
 }
 
+# next functions are for code used in Structuring in addition to Parser.
+# also possibly used in Texinfo::Transformations.
 
 sub _find_end_brace($$)
 {
@@ -1434,13 +1443,11 @@ sub _count_opened_tree_braces($$)
   return $braces_count;
 }
 
-# used in Structuring in addition to Parser
-
 # retrieve a leading manual name in parentheses, if there is one.
 # $LABEL_CONTENTS_CONTAINER->{'contents'} is the Texinfo for the specification
 # of a node.  It is relevant in any situation when a label is expected,
 # @node, menu entry, float, anchor...  For the @node command, for instance,
-# it is typically $node->{'args'}->[0].
+# $LABEL_CONTENTS_CONTAINER is typically $node->{'args'}->[0].
 #
 # Returned object is a hash with two fields:
 #
@@ -1452,6 +1459,9 @@ sub _count_opened_tree_braces($$)
 # elements substituted the initial contents is also returned,
 # typically to replace $LABEL_CONTENTS_CONTAINER->{'contents'}
 # for consistency.
+#
+# Could be documented, but only is there is evidence that this function
+# is useful in user-defined code.
 sub parse_node_manual($)
 {
   my $label_contents_container = shift;
@@ -1536,7 +1546,7 @@ sub parse_node_manual($)
 }
 
 
-# misc functions also interesting for converters
+# misc functions used in diverse contexts and useful in converters
 
 # Reverse the decoding of the file name from the input encoding.  When
 # dealing with file names, we want Perl strings representing sequences of
@@ -1725,7 +1735,6 @@ sub set_global_document_command($$$$)
   return $element;
 }
 
-
 sub set_output_encodings($$)
 {
   my $customization_information = shift;
@@ -2016,6 +2025,8 @@ sub split_custom_heading_command_contents($)
   return $result;
 }
 
+# not currently used
+sub find_parent_root_command($$);
 sub find_parent_root_command($$)
 {
   my $self = shift;
@@ -2032,7 +2043,7 @@ sub find_parent_root_command($$)
             and $self->{'global_commands'}->{'insertcopying'}) {
           foreach my 
$insertcopying(@{$self->{'global_commands'}->{'insertcopying'}}) {
             my $root_command
-              = $self->find_parent_root_command($insertcopying);
+              = find_parent_root_command($self, $insertcopying);
             return $root_command if (defined($root_command));
           }
         } else {
@@ -2050,11 +2061,11 @@ sub find_parent_root_command($$)
   return undef;
 }
 
-
-# functions collecting @-commands in tree, useful
-# for user-defined customization init files code.
-# Only some @-commands (global informative commands) are collected
-# in the default case.
+# In the default case, global informative commands are collected
+# by the parsers.  The following functions allow to collect
+# any @-command.
+# Used in customization init files code and should be useful in
+# particular in user-defined init files.
 
 sub collect_commands_in_tree($$)
 {
@@ -2123,27 +2134,11 @@ sub _collect_commands_list_in_tree($$$)
   }
 }
 
-# Not used.
-sub _collect_references($$);
-sub _collect_references($$)
-{
-  my $current = shift;
-  my $references = shift;
-  foreach my $key ('args', 'contents') {
-    if ($current->{$key}) {
-      $references->{$current->{$key}} = $current->{$key};
-      foreach my $child (@{$current->{$key}}) {
-        $references->{$child} = $child;
-        _collect_references($child, $references);
-      }
-    }
-  }
-}
-
 
 # functions useful for Texinfo tree transformations
 # and some tree transformations functions, mostly those
-# used in conversion to main output formats.
+# used in conversion to main output formats.  In general,
+# tree transformations functions are documented in the POD section.
 
 # Some helper functions defined here are used in other
 # modules but are not generally useful in converters
@@ -2354,7 +2349,6 @@ sub copy_contents($)
   return $copy->{'contents'};
 }
 
-
 sub modify_tree($$;$);
 sub modify_tree($$;$)
 {
@@ -2499,8 +2493,10 @@ sub protect_first_parenthesis($)
       $brace = shift @contents;
       my $brace_text = $brace->{'text'};
       $brace_text =~ s/^\(//;
-      unshift @contents, { 'text' => $brace_text, 'type' => $brace->{'type'},
-                           'parent' => $brace->{'parent'} } if $brace_text ne 
'';
+      unshift @contents, { 'text' => $brace_text,
+                           'type' => $brace->{'type'},
+                           'parent' => $brace->{'parent'} }
+                                                   if $brace_text ne '';
     } else {
       $brace = shift @contents;
     }
@@ -2659,7 +2655,9 @@ sub relate_index_entries_to_table_entries_in_tree($)
                      \&_relate_index_entries_to_table_entries_in_tree);
 }
 
-sub _html_joint_transformation($)
+
+# Used in the main program, not meant to be used in user-defined code.
+sub _special_joint_transformation($)
 {
   my $type = shift;
   my $current = shift;
@@ -2672,18 +2670,19 @@ sub _html_joint_transformation($)
 # Peform both the 'move_index_entries_after_items' and the
 # 'relate_index_entries_to_table_entries_in_tree' transformations
 # together.  This is faster because the tree is only traversed once.
-sub html_joint_transformation($)
+sub texinfo_special_joint_transformation($)
 {
   my $tree = shift;
-  return modify_tree($tree, \&_html_joint_transformation);
+  return modify_tree($tree, \&_special_joint_transformation);
 }
 
 
+# Common to different module, but not meant to be used in user-defined
+# codes.
+#
 # register a label, that is something that may be the target of a reference
 # and must be unique in the document.  Corresponds to @node, @anchor and
 # @float second arg.
-# This is common to different module, that's why it is here, but it is
-# no meant to be used in other codes.
 sub register_label($$$)
 {
   my ($targets_list, $current, $label) = @_;
@@ -2695,9 +2694,10 @@ sub register_label($$$)
 }
 
 
-# functions used for debugging
+# functions used for debugging.  May be used in other modules.
+# Not documented.
 
-# for debugging.  May be used in other modules.
+# informations on a tree element, short version
 sub debug_print_element_short($)
 {
   my $current = shift;
@@ -2727,7 +2727,7 @@ sub debug_print_element_short($)
   return "$cmd$type$text$args$contents";
 }
 
-# for debugging
+# informations on a tree element, long version
 sub debug_print_element($)
 {
   my $current = shift;
@@ -2784,9 +2784,10 @@ sub debug_print_element_details($)
   return $string;
 }
 
+# format list for debugging messages
 sub debug_list
 {
-  my ($label) = shift;
+  my $label = shift;
   my (@list) = (ref $_[0] && $_[0] =~ /.*ARRAY.*/) ? @{$_[0]} : @_;
 
   my $str = "$label: [";
@@ -2802,6 +2803,7 @@ sub debug_list
   warn "$str\n";
 }
 
+# format hash for debugging messages
 sub debug_hash
 {
   my ($label) = shift;
@@ -2832,7 +2834,7 @@ foreach my $key (@kept_keys) {
   $kept_keys{$key} = 1;
 }
 sub _filter_print_keys { [grep {$kept_keys{$_}} ( sort keys %{$_[0]} )] };
-sub print_tree($)
+sub debug_print_tree($)
 {
   my $tree = shift;
   local $Data::Dumper::Sortkeys = \&_filter_print_keys;
@@ -3049,7 +3051,7 @@ others.
 X<C<%no_brace_commands>>
 
 Commands without brace with a single character as name, like C<*>
-or C<:>.  The value is an ascii representation of the command.  It
+or C<:>.  The value is an ASCII representation of the command.  It
 may be an empty string.
 
 =item %preformatted_commands
@@ -3230,12 +3232,6 @@ In @*table @-commands, reassociate the index entry 
information from an index
 @-command appearing right after an @item line to the @item first element.
 Remove the index @-command from the tree.
 
-=item html_joint_transformation($tree)
-X<C<html_joint_transformation>>
-
-Do both C<relate_index_entries_to_table_entries_in_tree>
-and C<move_index_entries_after_items> together.
-
 =item $level = section_level($section)
 X<C<section_level>>
 
@@ -3248,7 +3244,7 @@ X<C<set_global_document_command>>
 Set the Texinfo configuration option corresponding to I<$cmdname> in
 I<$customization_information>.  The I<$global_commands_information> should
 contain information about global commands in a Texinfo document, typically 
obtained
-from a parser, like L<< 
$parser->global_commands_information()|Texinfo::Parser/$commands = 
global_commands_information($parser) >>.
+from a parser L<< 
$parser->global_commands_information()|Texinfo::Parser/$commands = 
global_commands_information($parser) >>.
 I<$command_location> specifies where in the document the value should be taken 
from,
 for commands that may appear more than once. The possibilities are:
 
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index d3659f01ed..f43ae36e83 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1858,7 +1858,7 @@ see L<Texinfo::Convert::Utils>.
 
 =over
 
-=item $contents_array $converter->comma_index_subentries_tree($entry)
+=item $contents_array = $converter->comma_index_subentries_tree($entry)
 X<C<comma_index_subentries_tree>>
 
 I<$entry> is a Texinfo tree index entry element. The function sets up
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 711cd9c05e..92f5bfb8e3 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -978,7 +978,7 @@ sub _convert($$;$)
 
     } elsif ($element->{'args'}
              and 
exists($Texinfo::Common::brace_commands{$element->{'cmdname'}})) {
-      #debug_list (" brace command with args", $element->{'args'});
+      #Texinfo::Common::debug_list(" brace command with args", 
$element->{'args'});
       if ($style_commands_formatting{$element->{'cmdname'}}) {
         if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
           push (@{$self->{'document_context'}},
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 9947212088..e50028dc59 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2329,10 +2329,11 @@ sub _convert($$)
       $result = $self->convert_line ({'type' => 'frenchspacing',
                'contents' => [$element->{'args'}->[0]]});
       pop @{$self->{'count_context'}};
-      $result = Texinfo::Convert::Text::heading({'structure' => 
{'section_level' => 0},
-        'cmdname' => 'titlefont'}, $result, $self, 
-        $self->get_conf('NUMBER_SECTIONS'),
-        ($self->{'format_context'}->[-1]->{'indent_level'}) * $indent_length);
+      $result = Texinfo::Convert::Text::text_heading(
+                          {'structure' => {'section_level' => 0},
+                           'cmdname' => 'titlefont'},
+                            $result, $self, $self->get_conf('NUMBER_SECTIONS'),
+          ($self->{'format_context'}->[-1]->{'indent_level'}) * 
$indent_length);
       $result =~ s/\n$//; # final newline has its own tree element
       $self->{'empty_lines_count'} = 0 unless ($result eq '');
       add_text_count($self, $result);
@@ -2517,7 +2518,7 @@ sub _convert($$)
         # @* leads to an end of line, underlying appears on the line below
         # over one line
         my $heading_underlined = 
-             Texinfo::Convert::Text::heading($element, $heading, $self,
+             Texinfo::Convert::Text::text_heading($element, $heading, $self,
                                              
$self->get_conf('NUMBER_SECTIONS'),
                            ($self->{'format_context'}->[-1]->{'indent_level'})
                                            * $indent_length);
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index ac6d25f692..096defab11 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -179,7 +179,7 @@ sub ascii_accent($$)
 }
 
 # format a stack of accents as ascii
-sub ascii_accents($$;$)
+sub _ascii_accents($$;$)
 {
   my $result = shift;
   my $stack = shift;
@@ -230,7 +230,7 @@ sub text_accents($;$$)
   if (defined($result)) {
     return $result;
   } else {
-    return ascii_accents($text, $stack, $set_case);
+    return _ascii_accents($text, $stack, $set_case);
   }
 }
 
@@ -286,8 +286,9 @@ my %underline_symbol = (
   4 => '.'
 );
 
+# TODO not documented, used in other converters
 # Return the text of an underlined heading, possibly indented.
-sub heading($$$;$$)
+sub text_heading($$$;$$)
 {
   my $current = shift;
   my $text = shift;
@@ -295,11 +296,11 @@ sub heading($$$;$$)
   my $numbered = shift;
   my $indent_length = shift;
 
-  # REMARK to get the numbering right in case of an indented text, the
-  # indentation should be given here.  But this should never happen as
-  # the only @-commands allowed in indented context are not numbered.
-  $text = Texinfo::Convert::Utils::numbered_heading($converter, $current, 
$text,
-                                                     $numbered);
+  # end of lines spaces are ignored in conversion.  However in
+  # rare cases, invalid nestings leave an end of line, so we chomp.
+  chomp($text);
+  $text = Texinfo::Convert::Utils::add_heading_number($converter, $current,
+                                                      $text, $numbered);
   return '' if ($text !~ /\S/);
   my $result = $text ."\n";
   if (defined($indent_length)) {
@@ -321,15 +322,15 @@ sub heading($$$;$$)
   return $result;
 }
 
-# TODO not documented
+# TODO not documented, used in many converters
 # $SELF is typically a converter object.
 # Setup options as used by Texinfo::Convert::Text::convert_to_text
 # based on the converter information.
 # if $ENABLE_ENCODING_IF_NOT_ASCII is set, enabled_encoding is set
 # unless the encoding is ascii, even if ENABLE_ENCODING is not set.
-# This is relevant for HTML, where ENABLE_ENCODING unset does not
-# mean that encoding is not supported, but that entities are preferred
-# to encoded characters
+# This is relevant for HTML and XML formats, where ENABLE_ENCODING unset
+# does not mean that encoding is not supported, but that entities are
+# preferred to encoded characters, and also when expanding file names.
 sub copy_options_for_convert_text($;$)
 {
   my $self = shift;
@@ -548,8 +549,8 @@ sub _convert($;$)
           $result = _convert($element->{'args'}->[0], $options);
         }
         if 
($Texinfo::Common::sectioning_heading_commands{$element->{'cmdname'}}) {
-          $result = heading($element, $result, $options->{'converter'},
-                            $options->{'NUMBER_SECTIONS'});
+          $result = text_heading($element, $result, $options->{'converter'},
+                                 $options->{'NUMBER_SECTIONS'});
         } else {
         # we always want an end of line even if is was eaten by a command
           chomp($result);
@@ -983,7 +984,7 @@ I<$accents> is an accent command that may contain other 
nested accent
 commands.  The function will format the whole stack of nested accent
 commands and the innermost text.  If I<$encoding> is set, the formatted
 text is converted to this encoding as much as possible instead of being
-converted as simple ascii.  If I<$set_case> is positive, the result
+converted as simple ASCII.  If I<$set_case> is positive, the result
 is meant to be upper-cased, if it is negative, the result is to be
 lower-cased.
 
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index 9506547ecb..bce77f9d8f 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -46,7 +46,7 @@ use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
 definition_category
 expand_today
 expand_verbatiminclude
-numbered_heading
+add_heading_number
 ) ] );
 
 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@@ -274,7 +274,7 @@ sub expand_verbatiminclude($$$)
   return $verbatiminclude;
 }
 
-sub numbered_heading($$$;$)
+sub add_heading_number($$$;$)
 {
   my $self = shift;
   my $current = shift;
@@ -311,7 +311,6 @@ sub numbered_heading($$$;$)
       $result = 'Appendix '.$result;
     }
   }
-  chomp ($result);
   return $result;
 }
 
@@ -443,8 +442,8 @@ normally a text element with one or two letter, and an 
array reference
 containing the accent commands nested in I<$element> (including
 I<$element>).
 
-=item $result = numbered_heading($converter, $heading_element, $heading_text, 
$do_number)
-X<C<numbered_heading>>
+=item $result = add_heading_number($converter, $heading_element, 
$heading_text, $do_number)
+X<C<add_heading_number>>
 
 The I<$converter> argument may be undef.  I<$heading_element> is
 a heading command tree element.  I<$heading_text> is the already
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index d3a58cdf2b..15c6e09aca 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1173,14 +1173,6 @@ sub _print_command_args_texi($)
   return '@'.$current->{'cmdname'} .$args."\n";
 }
 
-# For debugging
-sub _print_tree($)
-{
-  my $tree = shift;
-
-  return Texinfo::Common::print_tree($tree);
-}
-
 sub _register_global_command {
   my ($self, $current, $source_info) = @_;
 
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 272e2cb633..849fed53ff 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -1588,9 +1588,10 @@ sub setup_index_entry_keys_formatting($)
 {
   my $customization_information = shift;
 
-  # FIXME should the encoding be used by setting the
-  # copy_options_for_convert_text optional argument?  The result does
-  # not seem so good.
+  # TODO it would probably be relevant to set the encoding by setting the
+  # copy_options_for_convert_text optional argument when we use
+  # Unicode::Collate to sort.  Otherwise it is better not to as the result
+  # is worse when setting it.
   my $options = {'sort_string' => 1, 'ascii_punctuation' => 1,
    Texinfo::Convert::Text::copy_options_for_convert_text(
                                   $customization_information)};
@@ -1887,10 +1888,6 @@ The up, next and previous node elements.
 
 The up, next and previous section elements.
 
-=item FastForward
-
-The next top level section element.
-
 =item FastBack
 
 For top level elements, the previous top level element.  For other elements
@@ -1900,7 +1897,7 @@ that contains the subsection.
 
 =item FastForward
 
-The next top level element.
+The next top level section element.
 
 =back
 
@@ -1960,14 +1957,14 @@ X<C<new_complete_node_menu>>
 
 Returns a texinfo tree menu for node I<$node>, pointing to the children
 of the node obtained with the sectioning structure.  If I<$use_sections>
-is set, use section names instead of node names in menu.
+is set, use section names for the menu entry names.
 
 =item $entry = new_node_menu_entry($node, $use_sections)
 X<C<new_node_menu_entry>>
 
 Returns the texinfo tree corresponding to a single menu entry pointing to
-I<$node>.  If I<$use_sections> is set, use the section name instead of node 
name.
-Returns C<undef> if the node argument is missing.
+I<$node>.  If I<$use_sections> is set, use the section name for the menu
+entry name.  Returns C<undef> if the node argument is missing.
 
 =item $top_node = nodes_tree($registrar, $customization_information, 
$parser_information, $nodes_list, $labels)
 X<C<nodes_tree>>
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index e0007eef31..6c8acb1f57 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -678,8 +678,9 @@ EOT
         print $nav_fh "</li>\n";
       }
       my $text = _epub_convert_tree_to_text($self, $section->{'args'}->[0]);
-      $text = Texinfo::Convert::Utils::numbered_heading($self, $section, $text,
-                          $self->get_conf('NUMBER_SECTIONS'));
+      $text
+        = Texinfo::Convert::Utils::add_heading_number($self, $section, $text,
+                                          $self->get_conf('NUMBER_SECTIONS'));
       # the empty string as second argument makes sure that the
       # source file is different from the target file.
       my $origin_href = $self->command_href($section, '');
diff --git a/tp/init/chm.pm b/tp/init/chm.pm
index c675b4463e..b69d825ac9 100644
--- a/tp/init/chm.pm
+++ b/tp/init/chm.pm
@@ -320,8 +320,12 @@ sub chm_init($)
         }
       }
       my $text = _chm_convert_tree_to_text($self, $section->{'args'}->[0]);
-      $text = Texinfo::Convert::Utils::numbered_heading($self, $section, $text,
-                          $self->get_conf('NUMBER_SECTIONS'));
+      # should not be needed as end of lines are not converted, end of line
+      # can be added with invalid nestings.
+      chomp($text);
+      $text
+        = Texinfo::Convert::Utils::add_heading_number($self,$section, $text,
+                                         $self->get_conf('NUMBER_SECTIONS'));
       # the empty string as second argument makes sure that the
       # source file is different from the target file.
       my $origin_href = $self->command_href($section, '');
diff --git a/tp/t/automatic_menus.t b/tp/t/automatic_menus.t
index 212fb008cd..7ebf020919 100644
--- a/tp/t/automatic_menus.t
+++ b/tp/t/automatic_menus.t
@@ -37,7 +37,7 @@ sub test($$$;$$)
   if ($complete_missing_menus) {
     Texinfo::Transformations::complete_tree_nodes_missing_menu($tree,
                                                                $use_sections);
-    #print STDERR "".Texinfo::Common::print_tree($tree)."\n";
+    #print STDERR "".Texinfo::Common::debug_print_tree($tree)."\n";
   } else {
     Texinfo::Transformations::complete_tree_nodes_menus($tree, $use_sections);
   }
diff --git a/tp/t/init/translate_txiinternalvalue_macro.init 
b/tp/t/init/translate_txiinternalvalue_macro.init
index aa80932978..57179331fc 100644
--- a/tp/t/init/translate_txiinternalvalue_macro.init
+++ b/tp/t/init/translate_txiinternalvalue_macro.init
@@ -15,7 +15,7 @@ sub my_sp_formatting($$$$$)
 user internalvalue
 @end macro
 {myarg} @TeX{}', {'myarg' => {'contents' => [{'text' => $sp_nr}]}});
-    #print STDERR "T ".Texinfo::Common::print_tree($translated_tree)."\n";
+    #print STDERR "T 
".Texinfo::Common::debug_print_tree($translated_tree)."\n";
     $result = $self->convert_tree($translated_tree);
     return $result;
   }
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index 463e23919a..117b11cbde 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1466,7 +1466,7 @@ while(@input_files) {
 
   # move_index_entries_after_items + relate_index_entries_to_table_entries
   if ($formats_table{$converted_format}->{'joint_transformation'}) {
-    Texinfo::Common::html_joint_transformation($tree);
+    Texinfo::Common::texinfo_special_joint_transformation($tree);
   }
 
   if ($tree_transformations{'insert_nodes_for_sectioning_commands'}) {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]