[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert): open
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert): open the @path associated to a sectioning command right before opening the sectioning command. |
Date: |
Sat, 12 Mar 2022 19:25:10 -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 f5ae033368 * tp/Texinfo/Convert/DocBook.pm (_convert): open the @path
associated to a sectioning command right before opening the sectioning command.
f5ae033368 is described below
commit f5ae0333683fb6a80609f8d48273b2c3789f0641
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 13 01:24:56 2022 +0100
* tp/Texinfo/Convert/DocBook.pm (_convert): open the @path associated
to a sectioning command right before opening the sectioning command.
---
ChangeLog | 5 ++++
tp/TODO | 16 ++---------
tp/Texinfo/Convert/DocBook.pm | 31 +++++++++++++++-------
tp/t/30sectioning.t | 3 +++
.../sectioning/node_part_chapter_after_chapter.pl | 4 +--
5 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fc2560c1f1..aa2dc17581 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/DocBook.pm (_convert): open the @path associated
+ to a sectioning command right before opening the sectioning command.
+
2022-03-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/DocBook.pm (convert, output, _convert): close
diff --git a/tp/TODO b/tp/TODO
index 7c9331ab2d..ce1507de2e 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -58,21 +58,9 @@ For plaintext, I propose to have two options
text before the first @node or sectioning command is not output.
Default is non book.
-sectioning DocBook tests incorrect:
-part inside chapter bad nesting
-node_part_chapter_after_chapter
-node Top not ignored
-node_sectop_before_lone_node_Top
-
-section_before_after_top_node_last_node, chapter_between_nodes
-chapter not opened but closed
-
-section_chapter_before_top_nodes, section_chapter_before_top_nodes
-node Top not ignored
-
-unnumbered_before_top_node
-@unnumbered ignored
+Add DocBook test like node_part_chapter_after_chapter with non
+empty part.
Bugs
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index c0d8f073b8..7cc5835bff 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -811,31 +811,42 @@ sub _convert($$;$)
if ($element->{'cmdname'} eq 'node') {
$section_element = $element->{'extra'}->{'associated_section'};
} elsif (not $element->{'extra'}
- or not $element->{'extra'}->{'associated_node'}) {
+ or (not $element->{'extra'}->{'associated_node'}
+ and not
$element->{'extra'}->{'part_associated_section'})) {
$section_element = $element;
}
+ # open the section, and, if associated to a part, the associated
part
+ my @opened_elements;
if ($section_element) {
- my $section_attribute = $attribute_text;
+ if ($section_element->{'extra'}
+ and $section_element->{'extra'}->{'associated_part'}) {
+ push @opened_elements,
+ $section_element->{'extra'}->{'associated_part'};
+ }
+ push @opened_elements, $section_element;
+ }
+ foreach my $opened_element (@opened_elements) {
+ my $section_attribute = '';
# FIXME it is not clear that a label should be set for
# @appendix* or @chapter/@*section as the formatter should be
# able to figure it out. For @unnumbered or if ! NUMBER_SECTIONS
# having a label (empty) is important.
my $label = '';
- if (defined($section_element->{'structure'}->{'section_number'})
+ if (defined($opened_element->{'structure'}->{'section_number'})
and ($self->get_conf('NUMBER_SECTIONS')
or !defined($self->get_conf('NUMBER_SECTIONS')))) {
# Looking at docbook2html output, Appendix is appended in the
# section title, so only the letter is used.
- $label = $section_element->{'structure'}->{'section_number'};
+ $label = $opened_element->{'structure'}->{'section_number'};
}
my $docbook_sectioning_element
- = $self->_docbook_section_element($section_element);
+ = $self->_docbook_section_element($opened_element);
if (! $docbook_special_unnumbered{$docbook_sectioning_element}) {
$section_attribute .= " label=\"$label\"";
}
- if ($section_element->{'extra'} and
$section_element->{'extra'}->{'associated_node'}) {
+ if ($opened_element->{'extra'} and
$opened_element->{'extra'}->{'associated_node'}) {
$section_attribute
- .= "
id=\"$section_element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}\"";
+ .= "
id=\"$opened_element->{'extra'}->{'associated_node'}->{'extra'}->{'normalized'}\"";
}
my $language = '';
if (defined($self->get_conf('documentlanguage'))) {
@@ -846,12 +857,14 @@ sub _convert($$;$)
}
push @{$self->{'lang_stack'}}, $language;
$result .= "<$docbook_sectioning_element${section_attribute}>\n";
- if ($section_element->{'args'} and
$section_element->{'args'}->[0]) {
- my ($arg, $end_line) =
$self->_convert_argument_and_end_line($section_element);
+ if ($opened_element->{'args'} and
$opened_element->{'args'}->[0]) {
+ my ($arg, $end_line) =
$self->_convert_argument_and_end_line($opened_element);
$result .= "<title>$arg</title>$end_line";
chomp ($result);
$result .= "\n";
}
+ # FIXME likely to be incorrect unless the part is before another
part
+ # check not $element->{'extra'}->{'part_associated_section'}?
if ($docbook_sectioning_element eq 'part'
and !Texinfo::Common::is_content_empty($section_element)) {
$result .= "<partintro>\n";
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index 519d91ab00..b94f3e0fb0 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -843,6 +843,9 @@ anchor ref @anchor{ref}.
ref to ref @ref{ref}.
'],
+# NOTE that the DocBook output is incorrect because the chapter opened
+# in the Top node is not output, while the closing element is output
+# at the end of the document
['chapter_between_nodes',
'@setfilename chapter_between_nodes.info
diff --git a/tp/t/results/sectioning/node_part_chapter_after_chapter.pl
b/tp/t/results/sectioning/node_part_chapter_after_chapter.pl
index e949c7321b..b26e626b41 100644
--- a/tp/t/results/sectioning/node_part_chapter_after_chapter.pl
+++ b/tp/t/results/sectioning/node_part_chapter_after_chapter.pl
@@ -1461,10 +1461,10 @@
$result_converted{'docbook'}->{'node_part_chapter_after_chapter'} = '<chapter la
</chapter>
-<chapter label="2" id="part-chapter-node">
-<title>chapter with part node</title>
<part label="">
<title>part</title>
+<chapter label="2" id="part-chapter-node">
+<title>chapter with part node</title>
</chapter>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert): open the @path associated to a sectioning command right before opening the sectioning command.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (convert, output, _convert): close sectioning command where the tree element is closed, not based on the unit element, in order to have the top level elements processed in the right order. Fix and simplify the code related to in_skipped_node_top, to not output Top node.
- Next by Date:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert): start a sectioning command associated with both a part and a node with the first appearing. Do not add partinfo if the part is associated with a sectioning command, the content of the part will be at the beginning of the sectioning command. This is erroneous to have non empty part anyway.
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (convert, output, _convert): close sectioning command where the tree element is closed, not based on the unit element, in order to have the top level elements processed in the right order. Fix and simplify the code related to in_skipped_node_top, to not output Top node.
- Next by thread:
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert): start a sectioning command associated with both a part and a node with the first appearing. Do not add partinfo if the part is associated with a sectioning command, the content of the part will be at the beginning of the sectioning command. This is erroneous to have non empty part anyway.
- Index(es):