[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%command_structuring_leve
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%command_structuring_level) (%level_to_structuring_command): set more robustly. |
Date: |
Sat, 11 Sep 2021 08:49:32 -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 aaac3d2 * tp/Texinfo/Common.pm (%command_structuring_level)
(%level_to_structuring_command): set more robustly.
aaac3d2 is described below
commit aaac3d27c029f7d0d8742e2d94f64290395c7142
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Sep 11 14:48:47 2021 +0200
* tp/Texinfo/Common.pm (%command_structuring_level)
(%level_to_structuring_command): set more robustly.
---
tp/Texinfo/Common.pm | 65 +++++++++++++++++++++++++++++-----------------------
1 file changed, 36 insertions(+), 29 deletions(-)
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index d803c99..aca116b 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -998,23 +998,27 @@ foreach my $unformatted_block_command ('ignore', 'macro',
'rmacro') {
our %root_commands;
our %command_structuring_level = (
- 'top', 0,
- 'chapter', 1,
- 'unnumbered', 1,
- 'chapheading', 1,
- 'appendix', 1,
- 'section', 2,
- 'unnumberedsec', 2,
- 'heading', 2,
- 'appendixsec', 2,
- 'subsection', 3,
- 'unnumberedsubsec', 3,
- 'subheading', 3,
- 'appendixsubsec', 3,
- 'subsubsection', 4,
- 'unnumberedsubsubsec', 4,
- 'subsubheading', 4,
- 'appendixsubsubsec', 4,
+ 'top' => 0,
+ 'part' => 0, # out of the main hierarchy
+ 'chapter' => 1,
+ 'majorheading' => 1, # same as chapheading
+ 'unnumbered' => 1,
+ 'centerchap' => 1, # like unnumbered
+ 'chapheading' => 1,
+ 'appendix' => 1,
+ 'section' => 2,
+ 'unnumberedsec' => 2,
+ 'heading' => 2,
+ 'appendixsec' => 2,
+ 'appendixsection' => 2, # same as appendixsec
+ 'subsection' => 3,
+ 'unnumberedsubsec' => 3,
+ 'subheading', => 3,
+ 'appendixsubsec' => 3,
+ 'subsubsection' => 4,
+ 'unnumberedsubsubsec' => 4,
+ 'subsubheading' => 4,
+ 'appendixsubsubsec' => 4,
);
our %level_to_structuring_command;
@@ -1024,7 +1028,14 @@ our %level_to_structuring_command;
my $appendices = [ ];
my $unnumbered = [ ];
my $headings = [ ];
+
+ # set levels for synonyms
+ $level_to_structuring_command{'appendixsection'} = $appendices;
+ $level_to_structuring_command{'majorheading'} = $headings;
+ $level_to_structuring_command{'centerchap'} = $unnumbered;
+
foreach my $command (keys (%command_structuring_level)) {
+ next if defined($level_to_structuring_command{$command});
if ($command =~ /^appendix/) {
$level_to_structuring_command{$command} = $appendices;
} elsif ($command =~ /^unnumbered/ or $command eq 'top') {
@@ -1032,25 +1043,21 @@ our %level_to_structuring_command;
} elsif ($command =~ /section$/ or $command eq 'chapter') {
$level_to_structuring_command{$command} = $sections;
} else {
+ # no mapping for part, it is outside of the main hierarchy
+ next if ($command eq 'part');
$level_to_structuring_command{$command} = $headings;
}
-
$level_to_structuring_command{$command}->[$command_structuring_level{$command}]
+ my $command_level = $command_structuring_level{$command};
+ if (defined($level_to_structuring_command{$command}->[$command_level])) {
+ die "$command: level_to_structuring_command already set to "
+ .$level_to_structuring_command{$command}->[$command_level]."\n";
+ }
+ $level_to_structuring_command{$command}->[$command_level]
= $command;
}
- $level_to_structuring_command{'appendixsection'} = $appendices;
- $level_to_structuring_command{'majorheading'} = $headings;
- $level_to_structuring_command{'centerchap'} = $unnumbered;
}
-# out of the main hierarchy
-$command_structuring_level{'part'} = 0;
-# this are synonyms
-$command_structuring_level{'appendixsection'} = 2;
-# command_structuring_level{'majorheading'} is also 1 and not 0
-$command_structuring_level{'majorheading'} = 1;
-$command_structuring_level{'centerchap'} = 1;
-
our %sectioning_commands;
foreach my $sectioning_command (keys (%command_structuring_level)) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%command_structuring_level) (%level_to_structuring_command): set more robustly.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_command), tp/init/book.pm (book_convert_heading_command): rename $command as $element. Use _level_corrected_section().
- Next by Date:
branch master updated: * tp/Texinfo/Structuring.pm (section_level_adjusted_command_name), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/TexinfoXML.pm, tp/init/book.pm: move _level_corrected_section() to Texinfo::Structuring and rename as section_level_adjusted_command_name()
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_convert_heading_command), tp/init/book.pm (book_convert_heading_command): rename $command as $element. Use _level_corrected_section().
- Next by thread:
branch master updated: * tp/Texinfo/Structuring.pm (section_level_adjusted_command_name), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/TexinfoXML.pm, tp/init/book.pm: move _level_corrected_section() to Texinfo::Structuring and rename as section_level_adjusted_command_name()
- Index(es):