[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (t
From: |
Patrice Dumas |
Subject: |
branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (texinfo_main_command_sectioning_style, run): new sectioning style, 'heading', use @*heading commands in that case, except for the main command appearing at the beginning of the output if texinfo_sectioning_base_level != 0. New accessor texinfo_main_command_sectioning_style to select the sectioning style for the main command appearing at the beginning of the output if texinfo_sectioning_base_level != 0. |
Date: |
Tue, 08 Feb 2022 09:30:04 -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 4536f86413 * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
(texinfo_main_command_sectioning_style, run): new sectioning style, 'heading',
use @*heading commands in that case, except for the main command appearing at
the beginning of the output if texinfo_sectioning_base_level != 0. New accessor
texinfo_main_command_sectioning_style to select the sectioning style for the
main command appearing at the beginning of the output if
texinfo_sectioning_base_level != 0.
4536f86413 is described below
commit 4536f8641384eb3b978621b29120a00aefc6ad82
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Feb 8 15:26:46 2022 +0100
* Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
(texinfo_main_command_sectioning_style, run):
new sectioning style, 'heading', use @*heading commands in that case,
except for the main command appearing at the beginning
of the output if texinfo_sectioning_base_level != 0.
New accessor texinfo_main_command_sectioning_style to select the
sectioning style for the main command appearing at the beginning
of the output if texinfo_sectioning_base_level != 0.
* Pod-Simple-Texinfo/pod2texi.pl: add --headings-as-sections
option.
---
ChangeLog | 14 +++++++++
Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm | 45 +++++++++++++++++++++++-----
Pod-Simple-Texinfo/pod2texi.pl | 31 +++++++++++++------
3 files changed, 73 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 55ffec23f6..7dda28d2e0 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
+ (texinfo_main_command_sectioning_style, run):
+ new sectioning style, 'heading', use @*heading commands in that case,
+ except for the main command appearing at the beginning
+ of the output if texinfo_sectioning_base_level != 0.
+ New accessor texinfo_main_command_sectioning_style to select the
+ sectioning style for the main command appearing at the beginning
+ of the output if texinfo_sectioning_base_level != 0.
+
+ * Pod-Simple-Texinfo/pod2texi.pl: add --headings-as-sections
+ option.
+
2022-02-08 Patrice Dumas <pertusus@free.fr>
* Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (_convert_pod):
diff --git a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
index f2bd0dff0d..8591b2c8d7 100644
--- a/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
+++ b/Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm
@@ -60,6 +60,8 @@ my @appendix_sectioning_commands = ('part', 'appendix',
'appendixsec',
'appendixsubsec', 'appendixsubsubsec');
my @unnumbered_sectioning_commands = ('part', 'unnumbered', 'unnumberedsec',
'unnumberedsubsec', 'unnumberedsubsubsec');
+my @heading_commands = ('part', 'chapheading', 'heading', 'subheading',
+ 'subsubheading');
my @raw_formats = ('html', 'HTML', 'docbook', 'DocBook', 'texinfo',
'Texinfo');
@@ -69,6 +71,7 @@ __PACKAGE__->_accessorize(
'texinfo_add_upper_sectioning_command',
'texinfo_internal_pod_manuals',
'texinfo_man_url_prefix',
+ 'texinfo_main_command_sectioning_style',
'texinfo_section_nodes',
'texinfo_sectioning_base_level',
'texinfo_sectioning_style',
@@ -111,13 +114,30 @@ sub run
}
my $base_level = $self->texinfo_sectioning_base_level();
$base_level = 1 if ($base_level <= 1);
+ my $main_command_sectioning_style
+ = $self->texinfo_main_command_sectioning_style();
if ($self->texinfo_sectioning_style() eq 'numbered') {
$self->{'texinfo_sectioning_commands'} = \@numbered_sectioning_commands;
} elsif ($self->texinfo_sectioning_style() eq 'unnumbered') {
$self->{'texinfo_sectioning_commands'} = \@unnumbered_sectioning_commands;
+ } elsif ($self->texinfo_sectioning_style() eq 'heading') {
+ $self->{'texinfo_sectioning_commands'} = \@heading_commands;
+ if (! defined($main_command_sectioning_style)) {
+ $main_command_sectioning_style = 'numbered';
+ }
} else {
$self->{'texinfo_sectioning_commands'} = \@appendix_sectioning_commands;
}
+ $main_command_sectioning_style = $self->texinfo_sectioning_style()
+ if (not defined($main_command_sectioning_style));
+ if ($main_command_sectioning_style eq 'numbered') {
+ $self->{'texinfo_sectioning_main_command'} =
\@numbered_sectioning_commands;
+ } elsif ($main_command_sectioning_style eq 'unnumbered') {
+ $self->{'texinfo_sectioning_main_command'} =
\@unnumbered_sectioning_commands;
+ } else {
+ $self->{'texinfo_sectioning_main_command'} =
\@appendix_sectioning_commands;
+ }
+
foreach my $heading_command (keys(%pod_head_commands_level)) {
my $level = $pod_head_commands_level{$heading_command} + $base_level -1;
if (defined($self->{'texinfo_sectioning_commands'}->[$level])) {
@@ -202,13 +222,13 @@ sub _preamble($)
my $node = '';
if ($node_name =~ /\S/) {
if (!$self->texinfo_section_nodes()
- or $self->{'texinfo_sectioning_commands'}->[$level] eq 'part') {
+ or $self->{'texinfo_sectioning_main_command'}->[$level] eq 'part') {
$anchor = "\@anchor{$node_name}\n";
} else {
$node = "\@node $node_name\n";
}
}
- print $fh "$node\@$self->{'texinfo_sectioning_commands'}->[$level] "
+ print $fh "$node\@$self->{'texinfo_sectioning_main_command'}->[$level] "
._protect_text($self->texinfo_short_title(), 1)."\n$anchor\n";
}
}
@@ -667,7 +687,7 @@ sub _convert_pod($)
# 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,
+ # Indeed, all the Pod files 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(
@@ -830,13 +850,20 @@ output instead.
=item texinfo_internal_pod_manuals
The argument should be a reference on an array containing the short
-titles (usually the module names) of all the pod documents that are
+titles (usually the module names) of all the Pod documents that are
converted together and should be internal in the Texinfo document obtained
-by including all those pod manuals. References to those documents use
+by including all those Pod documents. References to those documents use
the internal reference commands formatting in Texinfo.
Corresponds to L<texinfo_sectioning_base_level> set to anything else than 0.
+=item texinfo_main_command_sectioning_style
+
+Sectioning style for the main command appearing at the beginning of the output
+file if L<texinfo_sectioning_base_level> is anything else than 0. Unset in the
+default case. If unset, use L<texinfo_sectioning_style>, except for style
+C<heading>, for which the C<number> style is used in the default case.
+
=item texinfo_man_url_prefix
String used as a prefix for man page urls. Default
@@ -850,15 +877,17 @@ If set, add C<@node> and not C<@anchor> for each
sectioning command.
Sets the level of the head1 commands. 1 is for the @chapter/@unnumbered
level. If set to 0, the head1 commands level is still 1, but the output
-manual is considered to be a standalone manual. If not 0, the pod file is
+manual is considered to be a standalone manual. If not 0, the Pod file is
rendered as a fragment of a Texinfo manual.
=item texinfo_sectioning_style
Default is C<numbered>, using the numbered sectioning Texinfo @-commands
(@chapter, @section...). Giving C<unnumbered> leads to using unnumbered
-sectioning command variants (@unnumbered...), and any other value would
-lead to using appendix sectioning command variants (@appendix...).
+sectioning command variants (C<@unnumbered>...), giving C<heading> leads to
+using headings that are not associated with document structuring
+(C<@heading>...) and any other value would lead to using appendix sectioning
+command variants (C<@appendix>...).
=item texinfo_short_title
diff --git a/Pod-Simple-Texinfo/pod2texi.pl b/Pod-Simple-Texinfo/pod2texi.pl
index 0c0229bd3e..ca17645e27 100755
--- a/Pod-Simple-Texinfo/pod2texi.pl
+++ b/Pod-Simple-Texinfo/pod2texi.pl
@@ -103,11 +103,11 @@ sub pod2texi_help()
{
my $pod2texi_help = __("Usage: pod2texi [OPTION]... POD...");
$pod2texi_help .= "\n\n";
- $pod2texi_help .= __("Translate Perl pod documentation file(s) to Texinfo.
There are two
-basic modes of operation. First, by default, each pod is translated to
+ $pod2texi_help .= __("Translate Perl Pod documentation file(s) to Texinfo.
There are two
+basic modes of operation. First, by default, each Pod is translated to
a standalone Texinfo manual.
-Second, if --base-level is set higher than 0, each pod is translated
+Second, if --base-level is set higher than 0, each Pod is translated
to a file suitable for \@include, and one more file with a main menu
and all the \@include is generated.");
$pod2texi_help .= "\n\n";
@@ -115,6 +115,7 @@ and all the \@include is generated.");
--appendix-sections use appendix-like sections")."\n";
$pod2texi_help .= __(" --base-level=NUM|NAME level of the head1
commands; default 0")."\n";
$pod2texi_help .= __(" --debug=NUM set debugging level")."\n";
+ $pod2texi_help .= __(" --headings-as-sections no structuring command for
sections")."\n";
$pod2texi_help .= __(" --help display this help and
exit")."\n";
$pod2texi_help .= __(" --no-fill-section-gaps do not fill sectioning
gaps")."\n";
$pod2texi_help .= __(" --no-section-nodes use anchors for sections
instead of nodes")."\n";
@@ -137,6 +138,7 @@ Texinfo home page:
http://www.gnu.org/software/texinfo/")."\n";
my $base_level = 0;
my $unnumbered_sections = 0;
my $appendix_sections = 0;
+my $headings_as_sections = 0;
my $output = '-';
my $top = 'top';
my $preamble = undef;
@@ -165,6 +167,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
"2021";
},
'unnumbered-sections!' => \$unnumbered_sections,
'appendix-sections!' => \$appendix_sections,
+ 'headings-as-sections!' => \$headings_as_sections,
'output|o=s' => \$output,
'preamble=s' => \$preamble,
'subdir=s' => \$subdir,
@@ -380,6 +383,8 @@ foreach my $file (@processed_files) {
$new->texinfo_sectioning_style('unnumbered');
} elsif ($appendix_sections) {
$new->texinfo_sectioning_style('appendix');
+ } elsif ($headings_as_sections) {
+ $new->texinfo_sectioning_style('heading');
}
if ($base_level > 0 and @manuals) {
$new->texinfo_internal_pod_manuals(\@manuals);
@@ -515,10 +520,10 @@ pod2texi - convert Pod to Texinfo
=head1 DESCRIPTION
Translate Pod file(s) to Texinfo. There are two basic modes of
-operation. First, by default, each pod is translated to a standalone
+operation. First, by default, each Pod is translated to a standalone
Texinfo manual.
-Second, if C<--base-level> is set higher than 0, each pod is translated
+Second, if C<--base-level> is set higher than 0, each Pod is translated
to a file suitable for C<@include>, and one more file with a main menu
and all the C<@include> is generated.
@@ -540,10 +545,10 @@ C<@chapter>/C<@unnumbered> level, 2 to the C<@section>
level, and so on.
The default is 0, meaning that C<head1> commands are still output as
chapters, but the output is arranged as a standalone manual.
-If the level is not 0, the pod file is rendered as a fragment of a
-Texinfo manual suitable for C<@include>. In this case, each pod file
+If the level is not 0, the Pod file is rendered as a fragment of a
+Texinfo manual suitable for C<@include>. In this case, each Pod file
has an additional sectioning command covering the entire file, one level
-above the C<--base-level> value. Therefore, to make each pod file a
+above the C<--base-level> value. Therefore, to make each Pod file a
chapter in a large manual, you should use C<section> as the base level.
For an example of making Texinfo out of the Perl documentation itself,
@@ -554,6 +559,14 @@ output available at
L<http://www.gnu.org/software/perl/manual>.
Set debugging level to I<NUM>.
+=item B<--headings-as-sections>
+
+Use headings commands (C<@heading>, ...) instead of the
+default numbered sectioning Texinfo @-commands (C<@chapter>,
+C<@section>, ...). The sectioning command covering the entire
+file output for each Pod file if B<--base-level> is not 0 is a
+numbered command.
+
=item B<--help>
Display help and exit.
@@ -581,7 +594,7 @@ boilerplate is a minimal beginning for a Texinfo document.
=item B<--subdir>=I<NAME>
If there is a main manual with include files (each corresponding to
-an input pod file), then those include files are put in directory I<NAME>.
+an input Pod file), then those include files are put in directory I<NAME>.
=item B<--unnumbered-sections>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * Pod-Simple-Texinfo/lib/Pod/Simple/Texinfo.pm (texinfo_main_command_sectioning_style, run): new sectioning style, 'heading', use @*heading commands in that case, except for the main command appearing at the beginning of the output if texinfo_sectioning_base_level != 0. New accessor texinfo_main_command_sectioning_style to select the sectioning style for the main command appearing at the beginning of the output if texinfo_sectioning_base_level != 0.,
Patrice Dumas <=
- Prev by Date:
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.
- Next by Date:
branch master updated: Update pod2texi.1 man page
- Previous by thread:
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.
- Next by thread:
branch master updated: Update pod2texi.1 man page
- Index(es):