[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 19 Feb 2024 16:12:56 -0500 (EST) |
branch: master
commit 1d9fe547527421d825d25efb4e011225648b205a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Feb 19 22:12:43 2024 +0100
* tp/Texinfo/Structuring.pm (sectioning_structure),
tp/Texinfo/XS/structuring_transfo/structuring.c
(sectioning_structure): start appendix numbering only if at the top
level.
---
ChangeLog | 7 ++
tp/Texinfo/Structuring.pm | 3 +-
tp/Texinfo/XS/structuring_transfo/structuring.c | 2 +-
...pendix_and_associated_part_in_generated_menu.pl | 28 ++++----
.../menu/part_appendix_in_generated_menu.pl | 78 +++++++++++-----------
5 files changed, 62 insertions(+), 56 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c290b64a29..45f932d352 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-02-19 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Structuring.pm (sectioning_structure),
+ tp/Texinfo/XS/structuring_transfo/structuring.c
+ (sectioning_structure): start appendix numbering only if at the top
+ level.
+
2024-02-19 Patrice Dumas <pertusus@free.fr>
* tp/Makefile.tres, tp/t/10menu.t (part_appendix_in_generated_menu)
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 3ec1795edd..fb5ef1284f 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -328,7 +328,8 @@ sub sectioning_structure($$$)
$command_numbers[$level] = 1;
}
}
- if ($appendix_commands{$content->{'cmdname'}} and !$in_appendix) {
+ if ($appendix_commands{$content->{'cmdname'}} and !$in_appendix
+ and $level == $number_top_level) {
$in_appendix = 1;
# NOTE we rely on perl auto-increment operator 'magic' for variables
# in string context, the increment is done as a string, preserving each
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index 18edcec822..0679cd3ff2 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -304,7 +304,7 @@ sectioning_structure (DOCUMENT *document)
command_numbers[level] = 1;
}
if ((command_other_flags (content) & CF_appendix)
- && !in_appendix)
+ && !in_appendix && level == number_top_level)
{
in_appendix = 1;
command_numbers[level] = 1;
diff --git
a/tp/t/results/menu/appendix_and_associated_part_in_generated_menu.pl
b/tp/t/results/menu/appendix_and_associated_part_in_generated_menu.pl
index efb6d0526c..dbad7854bc 100644
--- a/tp/t/results/menu/appendix_and_associated_part_in_generated_menu.pl
+++ b/tp/t/results/menu/appendix_and_associated_part_in_generated_menu.pl
@@ -201,7 +201,7 @@
$result_trees{'appendix_and_associated_part_in_generated_menu'} = {
}
],
'extra' => {
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
},
'info' => {
'spaces_before_argument' => {
@@ -402,7 +402,7 @@
$result_trees{'appendix_and_associated_part_in_generated_menu'} = {
'cmdname' => 'appendix',
'extra' => {
'associated_part' => {},
- 'section_number' => '3'
+ 'section_number' => 'A'
},
'info' => {
'spaces_before_argument' => {
@@ -446,7 +446,7 @@
$result_texts{'appendix_and_associated_part_in_generated_menu'} = 'top
1 Chap
******
-1.A Sec
+1.1 Sec
=======
P1
@@ -458,7 +458,7 @@ P1
Final
*****
-Appendix 3 GGG
+Appendix A GGG
**************
';
@@ -498,7 +498,7 @@
$result_sectioning{'appendix_and_associated_part_in_generated_menu'} = {
'up' => {}
},
'section_level' => 2,
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
}
}
],
@@ -571,7 +571,7 @@
$result_sectioning{'appendix_and_associated_part_in_generated_menu'} = {
'up' => {}
},
'section_level' => 1,
- 'section_number' => '3',
+ 'section_number' => 'A',
'toplevel_directions' => {
'prev' => {},
'up' => {}
@@ -655,7 +655,7 @@
$result_nodes{'appendix_and_associated_part_in_generated_menu'} = [
'cmdname' => 'part',
'extra' => {}
},
- 'section_number' => '3'
+ 'section_number' => 'A'
}
},
'node_directions' => {
@@ -690,7 +690,7 @@
$result_nodes{'appendix_and_associated_part_in_generated_menu'} = [
'associated_section' => {
'cmdname' => 'appendixsec',
'extra' => {
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
}
},
'node_directions' => {
@@ -778,13 +778,13 @@ Chap
* Menu:
* sec::
-1.A Sec
+1.1 Sec
=======
2 Chap 2
********
-Appendix 3 GGG
+Appendix A GGG
**************
';
@@ -870,7 +870,7 @@ Next: <a href="#chap2" accesskey="n" rel="next">Chap 2</a>,
Previous: <a href="#
<p>
Up: <a href="#chapter" accesskey="u" rel="up">Chap</a> </p>
</div>
-<h3 class="appendixsec" id="Sec"><span>1.A Sec<a class="copiable-link"
href="#Sec"> ¶</a></span></h3>
+<h3 class="appendixsec" id="Sec"><span>1.1 Sec<a class="copiable-link"
href="#Sec"> ¶</a></span></h3>
<hr>
</div>
@@ -899,7 +899,7 @@ Previous: <a href="#chap2" accesskey="p" rel="prev">Chap
2</a>, Up: <a href="#To
<hr>
<div class="appendix-level-extent" id="app">
-<h2 class="appendix" id="GGG"><span>Appendix 3 GGG<a class="copiable-link"
href="#GGG"> ¶</a></span></h2>
+<h2 class="appendix" id="GGG"><span>Appendix A GGG<a class="copiable-link"
href="#GGG"> ¶</a></span></h2>
</div>
</div>
@@ -979,7 +979,7 @@ File: , Node: chapter, Next: chap2, Prev: Top, Up: Top
File: , Node: sec, Up: chapter
-1.A Sec
+1.1 Sec
=======
@@ -991,7 +991,7 @@ File: , Node: chap2, Next: app, Prev: chapter, Up: Top
File: , Node: app, Prev: chap2, Up: Top
-Appendix 3 GGG
+Appendix A GGG
**************
diff --git a/tp/t/results/menu/part_appendix_in_generated_menu.pl
b/tp/t/results/menu/part_appendix_in_generated_menu.pl
index f87af85d13..830644f350 100644
--- a/tp/t/results/menu/part_appendix_in_generated_menu.pl
+++ b/tp/t/results/menu/part_appendix_in_generated_menu.pl
@@ -206,7 +206,7 @@ $result_trees{'part_appendix_in_generated_menu'} = {
}
],
'extra' => {
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
},
'info' => {
'spaces_before_argument' => {
@@ -371,7 +371,7 @@ $result_trees{'part_appendix_in_generated_menu'} = {
],
'cmdname' => 'appendix',
'extra' => {
- 'section_number' => '3'
+ 'section_number' => 'A'
},
'info' => {
'spaces_before_argument' => {
@@ -414,7 +414,7 @@ $result_texts{'part_appendix_in_generated_menu'} = 'top
1 Chap
******
-1.A Sec
+1.1 Sec
=======
P1
@@ -423,7 +423,7 @@ P1
2 Chap 2
********
-Appendix 3 GGG
+Appendix A GGG
**************
';
@@ -463,7 +463,7 @@ $result_sectioning{'part_appendix_in_generated_menu'} = {
'up' => {}
},
'section_level' => 2,
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
}
}
],
@@ -511,34 +511,33 @@ $result_sectioning{'part_appendix_in_generated_menu'} = {
},
'part_following_node' => {},
'section_childs' => [
- {},
- {
- 'cmdname' => 'appendix',
- 'extra' => {
- 'associated_node' => {
- 'cmdname' => 'node',
- 'extra' => {
- 'normalized' => 'app'
- }
- },
- 'section_directions' => {
- 'prev' => {},
- 'up' => {}
- },
- 'section_level' => 1,
- 'section_number' => '3',
- 'toplevel_directions' => {
- 'prev' => {},
- 'up' => {}
- }
- }
- }
+ {}
],
'section_directions' => {
'prev' => {}
},
'section_level' => 0
}
+ },
+ {
+ 'cmdname' => 'appendix',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'app'
+ }
+ },
+ 'section_directions' => {
+ 'prev' => {}
+ },
+ 'section_level' => 1,
+ 'section_number' => 'A',
+ 'toplevel_directions' => {
+ 'prev' => {},
+ 'up' => {}
+ }
+ }
}
],
'section_level' => -1
@@ -555,11 +554,10 @@
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'}{'extra'}{'toplevel_directions'}{'up'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[0];
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_following_node'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'}{'extra'}{'associated_node'};
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_childs'}[0]
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'};
-$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_childs'}[1]{'extra'}{'section_directions'}{'prev'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'};
-$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_childs'}[1]{'extra'}{'section_directions'}{'up'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1];
-$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_childs'}[1]{'extra'}{'toplevel_directions'}{'prev'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'};
-$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_childs'}[1]{'extra'}{'toplevel_directions'}{'up'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[0];
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'section_directions'}{'prev'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[2]{'extra'}{'section_directions'}{'prev'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1];
+$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[2]{'extra'}{'toplevel_directions'}{'prev'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[1]{'extra'}{'part_associated_section'};
+$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[2]{'extra'}{'toplevel_directions'}{'up'}
=
$result_sectioning{'part_appendix_in_generated_menu'}{'extra'}{'section_childs'}[0];
$result_nodes{'part_appendix_in_generated_menu'} = [
{
@@ -600,7 +598,7 @@ $result_nodes{'part_appendix_in_generated_menu'} = [
'associated_section' => {
'cmdname' => 'appendix',
'extra' => {
- 'section_number' => '3'
+ 'section_number' => 'A'
}
},
'node_directions' => {
@@ -634,7 +632,7 @@ $result_nodes{'part_appendix_in_generated_menu'} = [
'associated_section' => {
'cmdname' => 'appendixsec',
'extra' => {
- 'section_number' => '1.A'
+ 'section_number' => '1.1'
}
},
'node_directions' => {
@@ -719,13 +717,13 @@ Chap
* Menu:
* sec::
-1.A Sec
+1.1 Sec
=======
2 Chap 2
********
-Appendix 3 GGG
+Appendix A GGG
**************
';
@@ -810,7 +808,7 @@ Next: <a href="#chap2" accesskey="n" rel="next">Chap 2</a>,
Previous: <a href="#
<p>
Up: <a href="#chapter" accesskey="u" rel="up">Chap</a> </p>
</div>
-<h3 class="appendixsec" id="Sec"><span>1.A Sec<a class="copiable-link"
href="#Sec"> ¶</a></span></h3>
+<h3 class="appendixsec" id="Sec"><span>1.1 Sec<a class="copiable-link"
href="#Sec"> ¶</a></span></h3>
<hr>
</div>
@@ -834,7 +832,7 @@ Next: <a href="#app" accesskey="n" rel="next">GGG</a>,
Previous: <a href="#chapt
<p>
Previous: <a href="#chap2" accesskey="p" rel="prev">Chap 2</a>, Up: <a
href="#Top" accesskey="u" rel="up">top</a> </p>
</div>
-<h2 class="appendix" id="GGG"><span>Appendix 3 GGG<a class="copiable-link"
href="#GGG"> ¶</a></span></h2>
+<h2 class="appendix" id="GGG"><span>Appendix A GGG<a class="copiable-link"
href="#GGG"> ¶</a></span></h2>
</div>
</div>
@@ -864,10 +862,10 @@
$result_converted{'xml'}->{'part_appendix_in_generated_menu'} = '<node name="Top
<chapter spaces=" "><sectiontitle>Chap 2</sectiontitle>
</chapter>
+</part>
<node name="app" spaces=" "><nodename>app</nodename><nodeprev
automatic="on">chap2</nodeprev><nodeup automatic="on">Top</nodeup></node>
<appendix spaces=" "><sectiontitle>GGG</sectiontitle>
</appendix>
-</part>
';
@@ -910,7 +908,7 @@ File: , Node: chapter, Next: chap2, Prev: Top, Up: Top
File: , Node: sec, Up: chapter
-1.A Sec
+1.1 Sec
=======
@@ -922,7 +920,7 @@ File: , Node: chap2, Next: app, Prev: chapter, Up: Top
File: , Node: app, Prev: chap2, Up: Top
-Appendix 3 GGG
+Appendix A GGG
**************