texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_


From: Patrice Dumas
Subject: branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_convert_pod): prepend modules name to first level section names for internal manuals, otherwise the section name does not allow to understand which module the following text refers to, since all the POD use the same top level section names, like NAME, METHODS, as described in perlpodstyle and based on man pages conventions.
Date: Tue, 08 Feb 2022 07:44:22 -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 b2369c168b * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm 
(_convert_pod): prepend modules name to first level section names for internal 
manuals, otherwise the section name does not allow to understand which module 
the following text refers to, since all the POD use the  same top level section 
names, like NAME, METHODS, as described in perlpodstyle and based on man pages 
conventions.
b2369c168b is described below

commit b2369c168bcf7337217317d518729a7cc4ad1926
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Feb 8 13:44:12 2022 +0100

    * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_convert_pod):
    prepend modules name to first level section names for internal
    manuals, otherwise the section name does not allow to understand which
    module the following text refers to, since all the POD use the  same
    top level section names, like NAME, METHODS, as described in
    perlpodstyle and based on man pages conventions.
    
    * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
    (_prepend_internal_section_manual): rename
    _section_manual_to_node_name() as _prepend_internal_section_manual()
    and remove the unused $self argument.
---
 ChangeLog                                    | 14 ++++++++++++++
 Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm | 29 ++++++++++++++++++++--------
 Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t    |  9 +++++++--
 3 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9e69096934..55ffec23f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2022-02-08  Patrice Dumas  <pertusus@free.fr>
+
+       * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_convert_pod):
+       prepend modules name to first level section names for internal
+       manuals, otherwise the section name does not allow to understand which
+       module the following text refers to, since all the POD use the  same
+       top level section names, like NAME, METHODS, as described in
+       perlpodstyle and based on man pages conventions.
+
+       * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+       (_prepend_internal_section_manual): rename
+       _section_manual_to_node_name() as _prepend_internal_section_manual()
+       and remove the unused $self argument.
+
 2022-02-08  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Transformations.pm,
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm 
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index 00fbb71a96..f2bd0dff0d 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -296,9 +296,8 @@ sub _reference_to_text_in_texi($)
   return Texinfo::Convert::Texinfo::convert_to_texinfo($tree);
 }
 
-sub _section_manual_to_node_name($$$)
+sub _prepend_internal_section_manual($$$)
 {
-  my $self = shift;
   my $manual = shift;
   my $section = shift;
   my $base_level = shift;
@@ -382,9 +381,9 @@ sub _node_name($$)
 
   chomp $texinfo_node_name;
   $texinfo_node_name
-   = $self->_section_manual_to_node_name($self->texinfo_short_title(),
-                                         $texinfo_node_name,
-                                         
$self->texinfo_sectioning_base_level());
+   = _prepend_internal_section_manual($self->texinfo_short_title(),
+                                  $texinfo_node_name,
+                                  $self->texinfo_sectioning_base_level());
   # also change refs to text
   return _reference_to_text_in_texi($texinfo_node_name);
 }
@@ -564,7 +563,7 @@ sub _convert_pod($)
               }
               if ($self->{'texinfo_internal_pod_manuals_hash'}->{$manual}) {
                 $texinfo_node =
-                 $self->_section_manual_to_node_name($manual, $section,
+                 _prepend_internal_section_manual($manual, $section,
                                      $self->texinfo_sectioning_base_level());
               } else {
                 $texinfo_manual = 
_protect_text(_pod_title_to_file_name($manual));
@@ -576,7 +575,7 @@ sub _convert_pod($)
               }
             } elsif (defined($section) and $section =~ m/\S/) {
               $texinfo_node =
-               $self->_section_manual_to_node_name(
+               _prepend_internal_section_manual(
                                      $self->texinfo_short_title(), $section,
                                      $self->texinfo_sectioning_base_level());
               $texinfo_section = _normalize_texinfo_name(
@@ -656,12 +655,26 @@ sub _convert_pod($)
 
             $command_argument = _normalize_texinfo_name($result, $command);
             if ($result =~ /\S/ and $command_argument !~ /\S/) {
-              # use some raw text if the expansion lead to an empty section
+              # use some raw text if the expansion lead to empty Texinfo code
               my $tree = parse_texi_line(undef, $result);
               my $converter = Texinfo::Convert::TextContent->converter();
               $command_argument = 
_protect_text($converter->convert_tree($tree));
             }
 
+            if ($pod_head_commands_level{$tagname}
+                and $pod_head_commands_level{$tagname} == 1) {
+              # prepend the manual name for the top level texinfo section name 
for
+              # internal manuals, otherwise the section name does not
+              # allow to understand which module the following text refers to,
+              # in particular for Info or PDF output based on the generated 
Texinfo.
+              # Indeed, all the POD use the  same top level section names,
+              # like NAME, METHODS, as described in perlpodstyle and based on
+              # man pages conventions.
+              $command_argument = _prepend_internal_section_manual(
+                           $self->texinfo_short_title(), $command_argument,
+                                    $self->texinfo_sectioning_base_level());
+            }
+
             my $anchor = '';
             my $node_name = _prepare_anchor($self, _node_name($self, $result));
             if ($node_name =~ /\S/) {
diff --git a/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t 
b/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
index 3798e01a80..b7b64ec860 100644
--- a/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
+++ b/Pod-Simple-Texinfo/t/Pod-Simple-Texinfo.t
@@ -75,14 +75,19 @@ run_test ('=head1 NAME
 T@c
 
 =head1 @{}
+
+=head2 @,
 ',
 '@node T@@c NAME
-@section NAME
+@section T@@c NAME
 
 T@@c
 
 @node T@@c @@@{@}
-@section @@@{@}
+@section T@@c @@@{@}
+
+@node T@@c @@@comma{}
+@subsection @@,
 
 ', 'protected characters', 1, 2);
 



reply via email to

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