[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%formattable_misc_command
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%formattable_misc_commands), (%formatted_misc_commands, is_content_empty): split formattable commands which require having some replacement text formatted and formatted_misc_commands whch can be formatted and may have text argument. |
Date: |
Sat, 01 Jan 2022 15:23: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 7ddbf7e69c * tp/Texinfo/Common.pm (%formattable_misc_commands),
(%formatted_misc_commands, is_content_empty): split formattable commands which
require having some replacement text formatted and formatted_misc_commands whch
can be formatted and may have text argument.
7ddbf7e69c is described below
commit 7ddbf7e69c809bf68d0a0c7426342a3e940817c1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 1 21:21:26 2022 +0100
* tp/Texinfo/Common.pm (%formattable_misc_commands),
(%formatted_misc_commands, is_content_empty): split
formattable commands which require having some replacement
text formatted and formatted_misc_commands whch can be
formatted and may have text argument.
* tp/Texinfo/Convert/TextContent.pm (converter_initialize):
use Texinfo::Common::formatted_misc_commands for a better
selection of @-commands which should be replaced by their
content.
---
ChangeLog | 13 ++++++++
tp/Texinfo/Common.pm | 31 +++++++++++-------
tp/Texinfo/Convert/TextContent.pm | 11 +++----
.../res_parser/formatting_textcontent/formatting | 37 ++++++++++++----------
4 files changed, 59 insertions(+), 33 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1c86befa51..b3a18995b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (%formattable_misc_commands),
+ (%formatted_misc_commands, is_content_empty): split
+ formattable commands which require having some replacement
+ text formatted and formatted_misc_commands whch can be
+ formatted and may have text argument.
+
+ * tp/Texinfo/Convert/TextContent.pm (converter_initialize):
+ use Texinfo::Common::formatted_misc_commands for a better
+ selection of @-commands which should be replaced by their
+ content.
+
2022-01-01 Gavin Smith <gavinsmith0123@gmail.com>
Make LaTeX output processable
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 8307a8432f..b7252ddb40 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -556,15 +556,14 @@ our %line_commands = (
'oddheadingmarks' => 1,
'evenfootingmarks' => 1,
'oddfootingmarks' => 1,
+ 'shorttitlepage' => 'line',
+ 'settitle' => 'line',
# formatting
'center' => 'line',
'printindex' => 1,
'listoffloats' => 'line',
# especially in titlepage
-# 'shorttitle' => 'line',
- 'shorttitlepage' => 'line',
- 'settitle' => 'line',
'author' => 'line',
'subtitle' => 'line',
'title' => 'line',
@@ -1074,18 +1073,26 @@ foreach my $sectioning_command (keys
(%command_structuring_level)) {
}
-# misc commands that may be formatted as text.
+# misc commands which arguments may be formatted as text.
# index commands may be too, but index command may be added with
# @def*index so they are not added here.
-my %formatted_misc_commands;
-foreach my $formatted_misc_command ('insertcopying', 'contents',
- 'shortcontents', 'summarycontents', 'center', 'printindex',
- 'listoffloats', 'shorttitlepage', 'settitle',
- 'author', 'subtitle', 'title', 'sp', 'exdent', 'headitem', 'item',
+our %formatted_misc_commands;
+foreach my $formatted_misc_command ('center',
+ 'page',
+ 'author', 'subtitle', 'title', 'exdent', 'headitem', 'item',
'itemx', 'tab', 'node', keys(%sectioning_commands)) {
$formatted_misc_commands{$formatted_misc_command} = 1;
}
+# misc commands which may be formatted as text, but that
+# require constructing some replacement text
+our %formattable_misc_commands;
+foreach my $formattable_misc_command ('insertcopying', 'contents',
+ 'shortcontents', 'summarycontents', 'printindex',
+ 'listoffloats', 'need', 'sp', 'verbatiminclude') {
+ $formattable_misc_commands{$formattable_misc_command} = 1;
+}
+
our %misc_commands = (%line_commands, %other_commands);
@@ -1251,6 +1258,8 @@ sub rearrange_tree_beginning($$)
unshift (@{$before_node_section->{'contents'}}, $before_setfilename)
if (@{$before_setfilename->{'contents'}});
}
+ # document_settable_at_commands
+ # 'paragraph', 'preformatted'
}
sub warn_unknown_language($) {
@@ -1577,8 +1586,8 @@ sub is_content_empty($;$)
}
}
if (exists($misc_commands{$content->{'cmdname'}})) {
- my @truc = keys(%formatted_misc_commands);
- if ($formatted_misc_commands{$content->{'cmdname'}}) {
+ if ($formatted_misc_commands{$content->{'cmdname'}}
+ or $formattable_misc_commands{$content->{'cmdname'}}) {
return 0;
} else {
next;
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index c5735a739b..1ba7eed6a4 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -66,12 +66,11 @@ sub converter_initialize($)
{
my $self = shift;
- %{$self->{'formatting_misc_commands'}}
- = %Texinfo::Convert::Text::formatting_misc_commands;
- #%Texinfo::Common::formatted_misc_commands;
+ %{$self->{'formatted_misc_commands'}}
+ = %Texinfo::Common::formatted_misc_commands;
if ($self->get_conf('TEXTCONTENT_COMMENT')) {
- $self->{'formatting_misc_commands'}->{'c'} = 1;
- $self->{'formatting_misc_commands'}->{'comment'} = 1;
+ $self->{'formatted_misc_commands'}->{'c'} = 1;
+ $self->{'formatted_misc_commands'}->{'comment'} = 1;
}
}
@@ -114,7 +113,7 @@ sub _convert($$)
and $element->{'args'}->[0]->{'type'}
and ($element->{'args'}->[0]->{'type'} eq 'line_arg'
or $element->{'args'}->[0]->{'type'} eq 'misc_arg')
- and
!$self->{'formatting_misc_commands'}->{$element->{'cmdname'}})))));
+ and
!$self->{'formatted_misc_commands'}->{$element->{'cmdname'}})))));
if (defined($element->{'text'})) {
return $element->{'text'};
}
diff --git a/tp/tests/layout/res_parser/formatting_textcontent/formatting
b/tp/tests/layout/res_parser/formatting_textcontent/formatting
index 08c9985578..df31c083f7 100644
--- a/tp/tests/layout/res_parser/formatting_textcontent/formatting
+++ b/tp/tests/layout/res_parser/formatting_textcontent/formatting
@@ -211,10 +211,11 @@ a@sup{h}@sub{l} ahl
@sp 2
-2
@page
+author
+
need 1002
@clicksequence{click @click{} A} click -> A
@@ -294,7 +295,8 @@ Empty
-aaa quotation
+aaa quotation author
+quotation
indent in quotation
@@ -624,7 +626,6 @@ ce--ntered line
r--raggedright
more text
-simplest.texi
in verbatim ''
@@ -691,7 +692,6 @@ Invalid use of @':
@image{,,,3--xt} 3--xt
-
e--mph item
e--mph item
@@ -755,6 +755,11 @@ truc after a deff item
+title --a
+formatting subtitle --a
+subtitle 2 --a
+author1 --a with accents in name Te'c,a
+author2 --a
In titlepage
<
@@ -961,10 +966,11 @@ a@sup{h}@sub{l} ahl
@sp 2
-2
@page
+author
+
need 1002
@clicksequence{click @click{} A} click -> A
@@ -1044,7 +1050,8 @@ Empty
-aaa quotation
+aaa quotation author
+quotation
indent in quotation
@@ -1374,7 +1381,6 @@ ce--ntered line
r--raggedright
more text
-simplest.texi
in verbatim ''
@@ -1441,7 +1447,6 @@ Invalid use of @':
@image{,,,3--xt} 3--xt
-
e--mph item
e--mph item
@@ -1737,10 +1742,11 @@ a@sup{h}@sub{l} ahl
@sp 2
-2
@page
+author
+
need 1002
@clicksequence{click @click{} A} click -> A
@@ -1820,7 +1826,8 @@ Empty
-aaa quotation
+aaa quotation author
+quotation
indent in quotation
@@ -2150,7 +2157,6 @@ ce--ntered line
r--raggedright
more text
-simplest.texi
in verbatim ''
@@ -2217,7 +2223,6 @@ Invalid use of @':
@image{,,,3--xt} 3--xt
-
e--mph item
e--mph item
@@ -2487,10 +2492,11 @@ a@sup{h}@sub{l} ahl
@sp 2
-2
@page
+author
+
need 1002
@clicksequence{click @click{} A} click -> A
@@ -2570,7 +2576,8 @@ Empty
-aaa quotation
+aaa quotation author
+quotation
indent in quotation
@@ -2900,7 +2907,6 @@ ce--ntered line
r--raggedright
more text
-simplest.texi
in verbatim ''
@@ -2967,7 +2973,6 @@ Invalid use of @':
@image{,,,3--xt} 3--xt
-
e--mph item
e--mph item
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%formattable_misc_commands), (%formatted_misc_commands, is_content_empty): split formattable commands which require having some replacement text formatted and formatted_misc_commands whch can be formatted and may have text argument.,
Patrice Dumas <=