[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Do not output text before node or sections in Doc
From: |
Patrice Dumas |
Subject: |
branch master updated: Do not output text before node or sections in DocBook |
Date: |
Fri, 11 Mar 2022 18:17:23 -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 2675d21cb1 Do not output text before node or sections in DocBook
2675d21cb1 is described below
commit 2675d21cb1eb940e797c9c460919e790eccd2d31
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Mar 12 00:17:01 2022 +0100
Do not output text before node or sections in DocBook
* NEWS, doc/texinfo.texi (First Node), tp/Texinfo/Convert/DocBook.pm
(_convert): do not output text before the first @node or sectioning
command, in 'before_node_section' element type.
---
ChangeLog | 8 ++++++++
NEWS | 2 ++
doc/texinfo.texi | 3 ++-
tp/TODO | 7 +------
tp/Texinfo/Convert/DocBook.pm | 5 +++++
tp/t/results/converters_tests/ref_in_sectioning.pl | 3 +--
.../res_docbook/simplest_no_node_section.xml | 3 ---
.../some_at_commands_in_ref_nodes.pl | 3 +--
.../converters_tests/test_deftypefnnewline.pl | 4 +---
.../converters_tests/things_before_setfilename.pl | 3 +--
.../results/coverage/punctuation_in_line_commands.pl | 3 +--
.../docbook_tests/between_node_and_section.pl | 3 +--
.../docbook_tests/multiple_documentlanguage.pl | 3 +--
tp/t/results/formats_encodings/accentenc.pl | 3 +--
.../res_docbook/char_latin1_latin1_in_refs.xml | 2 --
tp/t/results/formats_encodings/weird_accents.pl | 3 +--
.../weird_accents_disable_encoding.pl | 3 +--
tp/t/results/indices/double_seeentry_seealso.pl | 3 +--
tp/t/results/indices/seeentry.pl | 3 +--
tp/t/results/indices/subentries.pl | 3 +--
tp/t/results/indices/subentry_and_sortas.pl | 3 +--
tp/t/results/languages/multiple.pl | 2 --
tp/t/results/languages/multiple_in_preamble.pl | 3 ---
.../languages/multiple_in_preamble_before_node.pl | 6 ------
.../codequoteundirected_codequotebacktick.pl | 4 ----
.../misc_commands/comment_space_command_on_line.pl | 1 -
tp/t/test_utils.pl | 20 ++++++++++++++++++--
.../res_parser/formatting_docbook/formatting.xml | 6 ------
28 files changed, 50 insertions(+), 65 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c8956d5e37..241447870c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-03-11 Patrice Dumas <pertusus@free.fr>
+
+ Do not output text before node or sections in DocBook
+
+ * NEWS, doc/texinfo.texi (First Node), tp/Texinfo/Convert/DocBook.pm
+ (_convert): do not output text before the first @node or sectioning
+ command, in 'before_node_section' element type.
+
2022-03-11 Patrice Dumas <pertusus@free.fr>
* doc/texinfo.texi @code{@@settitle}): no title in the
diff --git a/NEWS b/NEWS
index da6fa93a51..cd38f9fd3e 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,8 @@ See the manual for detailed information.
document rather than the formatting style.
. do not add a title in the default case, SHOW_TITLE has to be set
(or NO_TOP_NODE_OUTPUT). Set USE_TITLEPAGE_FOR_TITLE to true.
+ . DocBook output:
+ . do not output text before the first @node or sectioning @-command.
6.8 (3 July 2021)
* Language
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index eee1e22d65..35b5dc13bb 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -3039,7 +3039,8 @@ The first node of a Texinfo file is the @dfn{Top} node,
except in an
included file (@pxref{Include Files}). The Top node should contain
a short summary and a master menu. @xref{The Top Node} for more
information on the Top node contents and examples. Straight text
-before the Top node outside of any node should be avoided.
+before the Top node outside of any node should be avoided. Such
+text, if present, is not output for DocBook.
Here is a description of the node pointers to be used in the Top node:
diff --git a/tp/TODO b/tp/TODO
index 0d7261502d..50bbb22cc6 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -58,12 +58,7 @@ For plaintext, I propose to have two options
text before the first @node or sectioning command is not output.
Default is non book.
-DocBook is book-like, but does not allow any text outside of semantic
-elements. Text can be in abstract, dedication, preface, chapter but not
-directly in <book>. Title information and @copying are already used to
-format the beginning of DocBook output. I propose to ignore text before
-the first @node or sectioning (unless there is a semantic markup), and
-also not to output the Top node, both being changes.
+DocBook is book-like. I propose not to output the Top node.
Ignoring Top node: only danger here is if people were using the output
of DocBook to create HTML and relying on the Top node there as being
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 7fe3f1231d..5ddaec0571 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1613,6 +1613,11 @@ sub _convert($$;$)
pop @{$self->{'lang_stack'}};
}
}
+ } elsif ($element->{'type'} and $element->{'type'} eq 'before_node_section')
{
+ # ignore text before the first @node or sectioning command
+ # as DocBook does not allow content not within some semantic
+ # markup
+ return '';
}
#warn " returning $result\n";
diff --git a/tp/t/results/converters_tests/ref_in_sectioning.pl
b/tp/t/results/converters_tests/ref_in_sectioning.pl
index 2adebff143..d665a3d1ad 100644
--- a/tp/t/results/converters_tests/ref_in_sectioning.pl
+++ b/tp/t/results/converters_tests/ref_in_sectioning.pl
@@ -2685,8 +2685,7 @@ $result_converted{'xml'}->{'ref_in_sectioning'} =
'<contents></contents>
';
-$result_converted{'docbook'}->{'ref_in_sectioning'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'ref_in_sectioning'} = '<chapter label=""
id="Top">
<title>for example <link linkend="node">node</link> (see <link
linkend="node">node</link>) (see <citetitle>Manual</citetitle>)</title>
diff --git
a/tp/t/results/converters_tests/simplest_no_node_section/res_docbook/simplest_no_node_section.xml
b/tp/t/results/converters_tests/simplest_no_node_section/res_docbook/simplest_no_node_section.xml
index 976cc7b8e4..e1ff1c3d27 100644
---
a/tp/t/results/converters_tests/simplest_no_node_section/res_docbook/simplest_no_node_section.xml
+++
b/tp/t/results/converters_tests/simplest_no_node_section/res_docbook/simplest_no_node_section.xml
@@ -4,7 +4,4 @@
<!ENTITY latex "LaTeX">
]>
<book id="simplest_no_node_section.xml" lang="en">
-
-<para>This is a very simple texi manual   <>.
-</para>
</book>
diff --git a/tp/t/results/converters_tests/some_at_commands_in_ref_nodes.pl
b/tp/t/results/converters_tests/some_at_commands_in_ref_nodes.pl
index 8aa2fad03d..ea4fbd9061 100644
--- a/tp/t/results/converters_tests/some_at_commands_in_ref_nodes.pl
+++ b/tp/t/results/converters_tests/some_at_commands_in_ref_nodes.pl
@@ -1862,8 +1862,7 @@
$result_converted{'xml'}->{'some_at_commands_in_ref_nodes'} = '
';
-$result_converted{'docbook'}->{'some_at_commands_in_ref_nodes'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'some_at_commands_in_ref_nodes'} = '<chapter
label="" id="Top">
<title>Top</title>
diff --git a/tp/t/results/converters_tests/test_deftypefnnewline.pl
b/tp/t/results/converters_tests/test_deftypefnnewline.pl
index 7d19222001..636aa1e2c1 100644
--- a/tp/t/results/converters_tests/test_deftypefnnewline.pl
+++ b/tp/t/results/converters_tests/test_deftypefnnewline.pl
@@ -3572,9 +3572,7 @@ $result_converted{'xml'}->{'test_deftypefnnewline'} =
'<setfilename file="test_d
';
-$result_converted{'docbook'}->{'test_deftypefnnewline'} = '
-
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'test_deftypefnnewline'} = '<chapter label=""
id="Top">
<title>top</title>
</chapter>
diff --git a/tp/t/results/converters_tests/things_before_setfilename.pl
b/tp/t/results/converters_tests/things_before_setfilename.pl
index 1b29afcf7b..b99f5f0674 100644
--- a/tp/t/results/converters_tests/things_before_setfilename.pl
+++ b/tp/t/results/converters_tests/things_before_setfilename.pl
@@ -1580,8 +1580,7 @@ $result_converted{'xml'}->{'things_before_setfilename'} =
'<preamblebeforebeginn
';
-$result_converted{'docbook'}->{'things_before_setfilename'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'things_before_setfilename'} = '<chapter
label="" id="Top">
<title>top section</title>
<para>Ref to anchor
diff --git a/tp/t/results/coverage/punctuation_in_line_commands.pl
b/tp/t/results/coverage/punctuation_in_line_commands.pl
index 0b13fb3058..8b799df32b 100644
--- a/tp/t/results/coverage/punctuation_in_line_commands.pl
+++ b/tp/t/results/coverage/punctuation_in_line_commands.pl
@@ -1285,8 +1285,7 @@
$result_converted{'xml'}->{'punctuation_in_line_commands'} = '
';
-$result_converted{'docbook'}->{'punctuation_in_line_commands'} = '
-<chapter label="" id="node_0021-After-punc">
+$result_converted{'docbook'}->{'punctuation_in_line_commands'} = '<chapter
label="" id="node_0021-After-punc">
<title>top! After punc</title>
<variablelist><varlistentry><term>item! After punc
diff --git a/tp/t/results/docbook_tests/between_node_and_section.pl
b/tp/t/results/docbook_tests/between_node_and_section.pl
index 00762eb9fd..da6aad1643 100644
--- a/tp/t/results/docbook_tests/between_node_and_section.pl
+++ b/tp/t/results/docbook_tests/between_node_and_section.pl
@@ -432,8 +432,7 @@ $result_floats{'between_node_and_section'} = {};
-$result_converted{'docbook'}->{'between_node_and_section'} = '
-<chapter label="1" id="chap">
+$result_converted{'docbook'}->{'between_node_and_section'} = '<chapter
label="1" id="chap">
<title>Chap</title>
<sect1 label="1.1" id="sec1">
diff --git a/tp/t/results/docbook_tests/multiple_documentlanguage.pl
b/tp/t/results/docbook_tests/multiple_documentlanguage.pl
index b46b23c4ee..7d0b17875b 100644
--- a/tp/t/results/docbook_tests/multiple_documentlanguage.pl
+++ b/tp/t/results/docbook_tests/multiple_documentlanguage.pl
@@ -804,8 +804,7 @@ $result_floats{'multiple_documentlanguage'} = {};
-$result_converted{'docbook'}->{'multiple_documentlanguage'} = '
-<chapter label="" id="Top" lang="ja">
+$result_converted{'docbook'}->{'multiple_documentlanguage'} = '<chapter
label="" id="Top" lang="ja">
<title>top</title>
</chapter>
diff --git a/tp/t/results/formats_encodings/accentenc.pl
b/tp/t/results/formats_encodings/accentenc.pl
index 6ffdeee622..5d459f9086 100644
--- a/tp/t/results/formats_encodings/accentenc.pl
+++ b/tp/t/results/formats_encodings/accentenc.pl
@@ -3464,8 +3464,7 @@ $result_converted{'xml'}->{'accentenc'} =
'<documentencoding encoding="ISO-8859-
';
-$result_converted{'docbook'}->{'accentenc'} = '
-<chapter label="" id="Top-node">
+$result_converted{'docbook'}->{'accentenc'} = '<chapter label="" id="Top-node">
<title>top</title>
<para>should be e‘: è è
diff --git
a/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_docbook/char_latin1_latin1_in_refs.xml
b/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_docbook/char_latin1_latin1_in_refs.xml
index 71e9c83275..49e77970ac 100644
---
a/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_docbook/char_latin1_latin1_in_refs.xml
+++
b/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_docbook/char_latin1_latin1_in_refs.xml
@@ -4,8 +4,6 @@
<!ENTITY latex "LaTeX">
]>
<book id="char_latin1_latin1_in_refs.xml" lang="en">
-
-
<chapter label="" id="Top">
<title>top</title>
diff --git a/tp/t/results/formats_encodings/weird_accents.pl
b/tp/t/results/formats_encodings/weird_accents.pl
index 8fb027132b..42b1bd6b4a 100644
--- a/tp/t/results/formats_encodings/weird_accents.pl
+++ b/tp/t/results/formats_encodings/weird_accents.pl
@@ -682,8 +682,7 @@ $result_converted{'xml'}->{'weird_accents'} =
'<documentencoding encoding="ISO-8
';
-$result_converted{'docbook'}->{'weird_accents'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'weird_accents'} = '<chapter label="" id="Top">
<title>top</title>
<para>ĩ̄
diff --git a/tp/t/results/formats_encodings/weird_accents_disable_encoding.pl
b/tp/t/results/formats_encodings/weird_accents_disable_encoding.pl
index 6e5407a7b4..bf24d67d24 100644
--- a/tp/t/results/formats_encodings/weird_accents_disable_encoding.pl
+++ b/tp/t/results/formats_encodings/weird_accents_disable_encoding.pl
@@ -682,8 +682,7 @@
$result_converted{'xml'}->{'weird_accents_disable_encoding'} = '<documentencodin
';
-$result_converted{'docbook'}->{'weird_accents_disable_encoding'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'weird_accents_disable_encoding'} = '<chapter
label="" id="Top">
<title>top</title>
<para>ĩ̄
diff --git a/tp/t/results/indices/double_seeentry_seealso.pl
b/tp/t/results/indices/double_seeentry_seealso.pl
index 1a32a4dd4f..268017baef 100644
--- a/tp/t/results/indices/double_seeentry_seealso.pl
+++ b/tp/t/results/indices/double_seeentry_seealso.pl
@@ -874,8 +874,7 @@ $result_floats{'double_seeentry_seealso'} = {};
-$result_converted{'docbook'}->{'double_seeentry_seealso'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'double_seeentry_seealso'} = '<chapter label=""
id="Top">
<title>top</title>
</chapter>
diff --git a/tp/t/results/indices/seeentry.pl b/tp/t/results/indices/seeentry.pl
index 1c29e4bac1..bc62582344 100644
--- a/tp/t/results/indices/seeentry.pl
+++ b/tp/t/results/indices/seeentry.pl
@@ -758,8 +758,7 @@ $result_floats{'seeentry'} = {};
-$result_converted{'docbook'}->{'seeentry'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'seeentry'} = '<chapter label="" id="Top">
<title></title>
</chapter>
diff --git a/tp/t/results/indices/subentries.pl
b/tp/t/results/indices/subentries.pl
index 807747541b..2325a7d29f 100644
--- a/tp/t/results/indices/subentries.pl
+++ b/tp/t/results/indices/subentries.pl
@@ -1257,8 +1257,7 @@ $result_indices_sort_strings{'subentries'} = {
-$result_converted{'docbook'}->{'subentries'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'subentries'} = '<chapter label="" id="Top">
<title></title>
</chapter>
diff --git a/tp/t/results/indices/subentry_and_sortas.pl
b/tp/t/results/indices/subentry_and_sortas.pl
index 39be556372..2e6a1703db 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -752,8 +752,7 @@ $result_converted{'plaintext'}->{'subentry_and_sortas'} =
'1 Index
';
-$result_converted{'docbook'}->{'subentry_and_sortas'} = '
-<chapter label="" id="Top">
+$result_converted{'docbook'}->{'subentry_and_sortas'} = '<chapter label=""
id="Top">
<title></title>
</chapter>
diff --git a/tp/t/results/languages/multiple.pl
b/tp/t/results/languages/multiple.pl
index b0742f2967..586cd2a3f0 100644
--- a/tp/t/results/languages/multiple.pl
+++ b/tp/t/results/languages/multiple.pl
@@ -1319,8 +1319,6 @@ $result_converted{'docbook_doc'}->{'multiple'} = '<?xml
version="1.0"?>
<bookinfo><legalnotice><synopsis><indexterm role="vr"><primary>a de
copying</primary></indexterm><phrase role="category"><emphasis
role="bold">Instance Variable</emphasis>:</phrase>
<ooclass><classname>copying</classname></ooclass> <property>a</property>
<emphasis role="arg">b</emphasis></synopsis>
<blockquote><para>erreur→
</para></blockquote></legalnotice></bookinfo>
-
-
<anchor id="Top"/>
<synopsis><indexterm role="vr"><primary>BBB de fr</primary></indexterm><phrase
role="category"><emphasis role="bold">Instance Variable</emphasis>:</phrase>
<ooclass><classname>fr</classname></ooclass> <property>BBB</property> <emphasis
role="arg">CCC</emphasis></synopsis>
diff --git a/tp/t/results/languages/multiple_in_preamble.pl
b/tp/t/results/languages/multiple_in_preamble.pl
index 0743a91395..4bffc164e9 100644
--- a/tp/t/results/languages/multiple_in_preamble.pl
+++ b/tp/t/results/languages/multiple_in_preamble.pl
@@ -1339,9 +1339,6 @@
$result_converted{'docbook_doc'}->{'multiple_in_preamble'} = '<?xml version="1.0
<legalnotice><synopsis><indexterm role="vr"><primary>a de
copying</primary></indexterm><phrase role="category"><emphasis
role="bold">Instance Variable</emphasis>:</phrase>
<ooclass><classname>copying</classname></ooclass> <property>a</property>
<emphasis role="arg">b</emphasis></synopsis>
<blockquote><para>greška→
</para></blockquote></legalnotice></bookinfo>
-
-
-
<chapter label="" id="Top">
<title>top section</title>
diff --git a/tp/t/results/languages/multiple_in_preamble_before_node.pl
b/tp/t/results/languages/multiple_in_preamble_before_node.pl
index 0c66a758ae..e097b4f1be 100644
--- a/tp/t/results/languages/multiple_in_preamble_before_node.pl
+++ b/tp/t/results/languages/multiple_in_preamble_before_node.pl
@@ -1159,12 +1159,6 @@
$result_converted{'docbook_doc'}->{'multiple_in_preamble_before_node'} = '<?xml
<legalnotice><synopsis><indexterm role="vr"><primary>a de
copying</primary></indexterm><phrase role="category"><emphasis
role="bold">Instance Variable</emphasis>:</phrase>
<ooclass><classname>copying</classname></ooclass> <property>a</property>
<emphasis role="arg">b</emphasis></synopsis>
<blockquote><para>greška→
</para></blockquote></legalnotice></bookinfo>
-
-
-
-<para>Text ending the preamble
-</para>
-
<chapter label="" id="Top" lang="de">
<title>top section</title>
diff --git
a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
index 3a60431718..4e1dc8a08a 100644
--- a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
+++ b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
@@ -5435,10 +5435,6 @@ kbd: <userinput>``simple-double--three---four----\'\'
`simple\' quotedblleft: &#
samp: ‘<literal>``simple-double--three---four----\'\' `simple\'
quotedblleft: “</literal>’
</para></legalnotice></bookinfo>
-
-
-
-
<chapter label="" id="Top">
<title>test quotes</title>
diff --git a/tp/t/results/misc_commands/comment_space_command_on_line.pl
b/tp/t/results/misc_commands/comment_space_command_on_line.pl
index dbbcda936a..4970da3e19 100644
--- a/tp/t/results/misc_commands/comment_space_command_on_line.pl
+++ b/tp/t/results/misc_commands/comment_space_command_on_line.pl
@@ -872,7 +872,6 @@
$result_converted{'docbook_doc'}->{'comment_space_command_on_line'} = '<?xml ver
<title>Settitle  </title><!-- settittle -->
<bookinfo><title>Settitle  </title><!-- settittle -->
</bookinfo>
-
<chapter label="" id="Top">
<title>top element </title><!-- @top -->
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 97cdb91f2c..f3b218dd9f 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -724,12 +724,28 @@ sub convert_to_docbook($$$$$$;$)
'output_format' => 'docbook',
%$converter_options });
my $result;
+ my $tree_for_conversion;
+ # 'before_node_section' is ignored in conversion to DocBook and it is
+ # the type, in 'document_root' that holds content that appear out of any
+ # @node and sectioning command. To be able to have tests of simple
+ # Texinfo code out of any sectioning or @node command with DocBook,
+ # a tree consisting in a sole 'before_node_section' is duplicated
+ # as a tree with an element without type replacing the 'before_node_section'
+ # type element, with the same contents.
+ if ($tree->{'contents'} and scalar(@{$tree->{'contents'}}) == 1) {
+ $tree_for_conversion = {
+ 'type' => $tree->{'type'},
+ 'contents' => [{'contents' => $tree->{'contents'}->[0]->{'contents'}}]
+ }
+ } else {
+ $tree_for_conversion = $tree;
+ }
if (defined($converter_options->{'OUTFILE'})
and $converter_options->{'OUTFILE'} eq ''
and $format ne 'docbook_doc') {
- $result = $converter->convert($tree);
+ $result = $converter->convert($tree_for_conversion);
} else {
- $result = $converter->output($tree);
+ $result = $converter->output($tree_for_conversion);
close_files($converter);
$result = undef if (defined($result) and ($result eq ''));
}
diff --git a/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
b/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
index 0d3586f303..e36bd87d76 100644
--- a/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
+++ b/tp/tests/layout/res_parser/formatting_docbook/formatting.xml
@@ -856,12 +856,6 @@ aaa</literallayout></textobject></inlinemediaobject>
</para>
</legalnotice></bookinfo>
-
-
-
-
-
-
<chapter label="" id="Top">
<title>Top section</title>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Do not output text before node or sections in DocBook,
Patrice Dumas <=