[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%blockitem_commands), tp
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%blockitem_commands), tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename %block_item_commands as %blockitem_commands to be more consistent with XS parser. |
Date: |
Mon, 26 Sep 2022 11:43:33 -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 420df09097 * tp/Texinfo/Common.pm (%blockitem_commands),
tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename
%block_item_commands as %blockitem_commands to be more consistent with XS
parser.
420df09097 is described below
commit 420df0909796babf12317a0929a11cfaff458580
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 26 17:43:20 2022 +0200
* tp/Texinfo/Common.pm (%blockitem_commands),
tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename
%block_item_commands as %blockitem_commands to be more consistent with
XS parser.
* tp/Texinfo/XS/parsetexi/command_data.txt,
tp/Texinfo/XS/parsetexi/commands.c (close_paragraph_command),
tp/Texinfo/XS/parsetexi/commands.h,
tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command),
tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): rename
CF_sectioning as CF_sectioning_heading to be more consistent with Perl
parser.
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm,
tp/Texinfo/Convert/LaTeX.pm (_convert),
tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/ParserNonXS.pm
(_close_command_cleanup, _item_container_parent, _item_line_parent)
(_end_line, _parent_of_command_as_argument,
_process_remaining_on_line), tp/Texinfo/XS/parsetexi/command_data.txt,
tp/Texinfo/XS/parsetexi/commands.h, util/txixml2texi.pl: use item_line
and item_container as types for block commands, instead of
%item_container_command and %item_line_commands. Remove
%item_container_command and %item_line_commands.
* tp/Texinfo/Convert/HTML.pm: remove useless code.
---
ChangeLog | 28 ++++++++++++++
tp/Texinfo/Common.pm | 44 ++++++++-------------
tp/Texinfo/Convert/DocBook.pm | 2 +-
tp/Texinfo/Convert/HTML.pm | 5 +--
tp/Texinfo/Convert/LaTeX.pm | 31 ++++++++-------
tp/Texinfo/Convert/Plaintext.pm | 4 +-
tp/Texinfo/Convert/TextContent.pm | 2 +-
tp/Texinfo/ParserNonXS.pm | 36 +++++++++--------
tp/Texinfo/XS/parsetexi/command_data.txt | 64 +++++++++++++++----------------
tp/Texinfo/XS/parsetexi/commands.c | 2 +-
tp/Texinfo/XS/parsetexi/commands.h | 5 ++-
tp/Texinfo/XS/parsetexi/handle_commands.c | 2 +-
tp/Texinfo/XS/parsetexi/parser.c | 6 +--
util/txixml2texi.pl | 3 +-
14 files changed, 128 insertions(+), 106 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5dae5b2c01..4419495c07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2022-09-26 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (%blockitem_commands),
+ tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename
+ %block_item_commands as %blockitem_commands to be more consistent with
+ XS parser.
+
+ * tp/Texinfo/XS/parsetexi/command_data.txt,
+ tp/Texinfo/XS/parsetexi/commands.c (close_paragraph_command),
+ tp/Texinfo/XS/parsetexi/commands.h,
+ tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command),
+ tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): rename
+ CF_sectioning as CF_sectioning_heading to be more consistent with Perl
+ parser.
+
+ * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm,
+ tp/Texinfo/Convert/LaTeX.pm (_convert),
+ tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/ParserNonXS.pm
+ (_close_command_cleanup, _item_container_parent, _item_line_parent)
+ (_end_line, _parent_of_command_as_argument,
+ _process_remaining_on_line), tp/Texinfo/XS/parsetexi/command_data.txt,
+ tp/Texinfo/XS/parsetexi/commands.h, util/txixml2texi.pl: use item_line
+ and item_container as types for block commands, instead of
+ %item_container_command and %item_line_commands. Remove
+ %item_container_command and %item_line_commands.
+
+ * tp/Texinfo/Convert/HTML.pm: remove useless code.
+
2022-09-26 Patrice Dumas <pertusus@free.fr>
Document Microtypography in LaTeX output
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 76e706fe72..fdbbe144cc 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -850,7 +850,7 @@ our %block_commands;
our %block_commands_args_number;
# commands that have a possible content before an item
-our %block_item_commands;
+our %blockitem_commands;
# Do nothing, used to mark translations for gettext. The strings
# are marked to be translated in the parsers with type 'untranslated'.
@@ -919,7 +919,7 @@ foreach my $def_command(keys %def_map) {
}
$block_commands{'multitable'} = 'multitable';
-$block_item_commands{'multitable'} = 1;
+$blockitem_commands{'multitable'} = 1;
# block commands in which menu entry and menu comments appear
foreach my $menu_command ('menu', 'detailmenu', 'direntry') {
@@ -995,11 +995,16 @@ $block_commands{'ifclear'} = 'conditional';
$block_commands{'ifcommanddefined'} = 'conditional';
$block_commands{'ifcommandnotdefined'} = 'conditional';
-foreach my $block_command_one_arg('table', 'ftable', 'vtable',
- 'itemize', 'enumerate') {
- $block_commands{$block_command_one_arg} = 'blockitem';
- $block_commands_args_number{$block_command_one_arg} = 1;
- $block_item_commands{$block_command_one_arg} = 1;
+foreach my $item_container_command ('itemize', 'enumerate') {
+ $block_commands{$item_container_command} = 'item_container';
+ $block_commands_args_number{$item_container_command} = 1;
+ $blockitem_commands{$item_container_command} = 1;
+}
+
+foreach my $item_line_command ('table', 'ftable', 'vtable') {
+ $block_commands{$item_line_command} = 'item_line';
+ $block_commands_args_number{$item_line_command} = 1;
+ $blockitem_commands{$item_line_command} = 1;
}
foreach my $block_command_one_arg('quotation', 'smallquotation') {
@@ -1034,14 +1039,6 @@ foreach my $close_paragraph_command
(keys(%def_commands)) {
$close_paragraph_commands{$close_paragraph_command} = 1;
}
-our %item_container_commands;
-foreach my $item_container_command ('itemize', 'enumerate') {
- $item_container_commands{$item_container_command} = 1;
-}
-our %item_line_commands;
-foreach my $item_line_command ('table', 'ftable', 'vtable') {
- $item_line_commands{$item_line_command} = 1;
-}
our %deprecated_commands = (
'definfoenclose' => '',
@@ -2960,7 +2957,10 @@ is I<conditional> for C<@if> commands, I<def> for
definition
commands like C<@deffn>, I<raw> for @-commands that have no expansion
of @-commands in their bodies (C<@macro>, C<@verbatim> and C<@ignore>),
I<multitable> for C<@multitable>, I<menu> for C<@menu>, C<@detailmenu>
-and C<@direntry> and other values for other block line commands.
+and C<@direntry>, I<item_container> for commands with C<@item> containing
+any content, C<@itemize> and C<@enumerate>, I<item_line> for commands
+like C<@table> in which the C<@item> argument is on its line
+ and other values for other block line commands.
=item %block_commands_args_number
X<C<%block_commands_args_number>>
@@ -3046,18 +3046,6 @@ X<C<%inline_format_commands>>
Inline conditional commands, like C<@inlineifclear>, and inline format
commands like C<inlineraw> and C<inlinefmt>.
-=item %item_container_commands
-X<C<%item_container_commands>>
-
-Commands holding C<@item> with C<@item> that contains blocks of text,
-like C<@itemize>.
-
-=item %item_line_commands
-X<C<%item_line_commands>>
-
-Commands with C<@item> that have their arguments on their lines, like
-C<@ftable>.
-
=item %letter_no_arg_commands
X<C<%letter_no_arg_commands>>
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 5914c79717..78db9c767c 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1466,7 +1466,7 @@ sub _convert($$;$)
$numeration = 'arabic';
}
push @attributes, " numeration=\"$numeration\"";
- } elsif ($Texinfo::Common::item_line_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Common::block_commands{$element->{'cmdname'}} eq
'item_line') {
push @format_elements, 'variablelist';
} elsif ($element->{'cmdname'} eq 'itemize') {
push @format_elements, 'itemizedlist';
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index ef50c9f854..497c114184 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -108,7 +108,6 @@ my %root_commands = %Texinfo::Common::root_commands;
my %preformatted_commands = %Texinfo::Common::preformatted_commands;
my %math_commands = %Texinfo::Common::math_commands;
my %explained_commands = %Texinfo::Common::explained_commands;
-my %item_container_commands = %Texinfo::Common::item_container_commands;
my %raw_commands = %Texinfo::Common::raw_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
@@ -3671,7 +3670,7 @@ sub _convert_heading_command($$$$$)
my $mini_toc = '';
if ($tables_of_contents eq ''
and $self->get_conf('FORMAT_MENU') eq 'sectiontoc'
- and $Texinfo::Common::sectioning_heading_commands{$cmdname}) {
+ and $sectioning_heading_commands{$cmdname}) {
$mini_toc = _mini_toc($self, $element);
}
@@ -3804,7 +3803,7 @@ sub _convert_heading_command($$$$$)
if ($do_heading) {
if ($self->get_conf('TOC_LINKS')
and $Texinfo::Common::root_commands{$cmdname}
- and $Texinfo::Common::sectioning_heading_commands{$cmdname}) {
+ and $sectioning_heading_commands{$cmdname}) {
my $content_href = $self->command_contents_href($element, 'contents');
if ($content_href ne '') {
$heading = "<a href=\"$content_href\">$heading</a>";
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 97943cee49..f261947b5c 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -229,14 +229,12 @@ my %math_commands = %Texinfo::Common::math_commands;
my %explained_commands = %Texinfo::Common::explained_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
-my %item_container_commands = %Texinfo::Common::item_container_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
my %code_style_commands = %Texinfo::Common::code_style_commands;
my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_commands;
my %preformatted_code_commands = %Texinfo::Common::preformatted_code_commands;
my %default_index_commands = %Texinfo::Common::default_index_commands;
my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
-my %item_line_commands = %Texinfo::Common::item_line_commands;
my %headings_specification_commands =
%Texinfo::Common::headings_specification_commands;
my %in_heading_commands = %Texinfo::Common::in_heading_commands;
my %unformatted_brace_command = %Texinfo::Common::unformatted_brace_command;
@@ -478,9 +476,16 @@ foreach my $ignored_block_commands ('ignore', 'macro',
'rmacro', 'copying',
$ignored_commands{$ignored_block_commands} = 1;
}
+my %LaTeX_list_environments = (
+ 'itemize' => 'itemize',
+ 'enumerate' => 'enumerate',
+);
+
foreach my $block_command (keys(%block_commands)) {
$ignored_commands{$block_command} = 1
- if ($block_commands{$block_command} eq 'menu')
+ if ($block_commands{$block_command} eq 'menu');
+ $LaTeX_list_environments{$block_command} = 'description'
+ if ($block_commands{$block_command} eq 'item_line');
}
my @LaTeX_same_block_commands = (
@@ -515,20 +520,11 @@ my %LaTeX_environment_packages = (
'cartouche' => ['mdframed'],
);
-my %LaTeX_list_environments = (
- 'itemize' => 'itemize',
- 'enumerate' => 'enumerate',
-);
-
my %LaTeX_fixed_width_environments = (
'verbatim' => 1,
'GNUTexinfopreformatted' => 1,
);
-foreach my $command (keys(%item_line_commands)) {
- $LaTeX_list_environments{$command} = 'description';
-}
-
foreach my $environment_command (@LaTeX_same_block_commands) {
$LaTeX_environment_commands{$environment_command} = [$environment_command];
}
@@ -3121,7 +3117,8 @@ sub _convert($$)
} elsif ($block_raw_commands{$cmdname}) {
push @{$self->{'formatting_context'}->[-1]->{'text_context'}},
'ctx_raw';
}
- if ($item_line_commands{$cmdname}) {
+ if ($block_commands{$cmdname}
+ and $block_commands{$cmdname} eq 'item_line') {
# may be undef, in particular if the command is not a style command,
# for example @email
my $description_command_format
@@ -3283,7 +3280,8 @@ sub _convert($$)
}
$result .= $index_entry;
} elsif ($cmdname eq 'item' and $element->{'parent'}->{'cmdname'}
- and $item_container_commands{$element->{'parent'}->{'cmdname'}}) {
+ and $block_commands{$element->{'parent'}->{'cmdname'}}
+ and $block_commands{$element->{'parent'}->{'cmdname'}} eq
'item_container') {
# item in @enumerate and @itemize
$result .= '\item ';
} elsif ($cmdname eq 'headitem' or $cmdname eq 'item'
@@ -3807,7 +3805,8 @@ sub _convert($$)
# move_index_entries_after_items for enumerate and itemize, but not
# for @*table. For @*table there is
relate_index_entries_to_table_entries
# but it has no obvious use here
- if ($item_line_commands{$element->{'parent'}->{'cmdname'}}) {
+ if ($block_commands{$element->{'parent'}->{'cmdname'}}
+ and $block_commands{$element->{'parent'}->{'cmdname'}} eq
'item_line') {
# it is important to have an empty optional argument otherwise
# a quoted command will output the quotes, even with a detection
# of empty argument (tested with diverse possibilities)
@@ -3831,7 +3830,7 @@ sub _convert($$)
# close commands
if ($cmdname) {
- if ($item_line_commands{$cmdname}) {
+ if ($block_commands{$cmdname} and $block_commands{$cmdname} eq
'item_line') {
pop @{$self->{'formatting_context'}->[-1]->{'table_command_format'}};
}
if ($LaTeX_environment_commands{$cmdname}) {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 681d7ae990..306620f993 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -100,7 +100,6 @@ my %math_commands = %Texinfo::Common::math_commands;
my %explained_commands = %Texinfo::Common::explained_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
-my %item_container_commands = %Texinfo::Common::item_container_commands;
my %raw_commands = %Texinfo::Common::raw_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
my %code_style_commands = %Texinfo::Common::code_style_commands;
@@ -2567,7 +2566,8 @@ sub _convert($$)
}
}
} elsif ($command eq 'item' and $element->{'parent'}->{'cmdname'}
- and $item_container_commands{$element->{'parent'}->{'cmdname'}}) {
+ and $block_commands{$element->{'parent'}->{'cmdname'}}
+ and $block_commands{$element->{'parent'}->{'cmdname'}} eq
'item_container') {
$self->{'format_context'}->[-1]->{'paragraph_count'} = 0;
my $line = $self->new_formatter('line',
{'indent_length' =>
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index f0b85cab77..29e178941a 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -140,7 +140,7 @@ sub _convert($$)
my $result = '';
if ($element->{'args'}
and (!$element->{'cmdname'}
- or !$Texinfo::Common::block_item_commands{$element->{'cmdname'}})) {
+ or !$Texinfo::Common::blockitem_commands{$element->{'cmdname'}})) {
my $args;
if ($element->{'cmdname'}
and $Texinfo::Common::inline_format_commands{$element->{'cmdname'}}) {
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 9a07ab65b3..b17fbc6db8 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -266,7 +266,7 @@ my %accent_commands =
%Texinfo::Common::accent_commands;
my %context_brace_commands = %Texinfo::Common::context_brace_commands;
my %block_commands = %Texinfo::Common::block_commands;
my %block_commands_args_number = %Texinfo::Common::block_commands_args_number;
-my %block_item_commands = %Texinfo::Common::block_item_commands;
+my %blockitem_commands = %Texinfo::Common::blockitem_commands;
my %close_paragraph_commands = %Texinfo::Common::close_paragraph_commands;
my %def_map = %Texinfo::Common::def_map;
my %def_commands = %Texinfo::Common::def_commands;
@@ -274,8 +274,6 @@ my %def_aliases =
%Texinfo::Common::def_aliases;
my %preformatted_commands = %Texinfo::Common::preformatted_commands;
my %math_commands = %Texinfo::Common::math_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
-my %item_container_commands = %Texinfo::Common::item_container_commands;
-my %item_line_commands = %Texinfo::Common::item_line_commands;
my %deprecated_commands = %Texinfo::Common::deprecated_commands;
my %root_commands = %Texinfo::Common::root_commands;
my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
@@ -1647,7 +1645,8 @@ sub _close_command_cleanup($$) {
}
}
delete $current->{'rows_count'};
- } elsif ($item_container_commands{$current->{'cmdname'}}) {
+ } elsif ($block_commands{$current->{'cmdname'}}
+ and $block_commands{$current->{'cmdname'}} eq 'item_container') {
delete $current->{'items_count'};
}
@@ -1658,7 +1657,8 @@ sub _close_command_cleanup($$) {
_gather_def_item($current);
}
- if ($item_line_commands{$current->{'cmdname'}}) {
+ if ($block_commands{$current->{'cmdname'}}
+ and $block_commands{$current->{'cmdname'}} eq 'item_line') {
# At this point the end command hasn't been added to the command contents.
# so checks cannot be done at this point.
if (@{$current->{'contents'}}) {
@@ -1669,7 +1669,7 @@ sub _close_command_cleanup($$) {
# put end out of before_item, and replace it at the end of the parent.
# remove empty before_item.
# warn if not empty before_item, but format is empty
- if ($block_item_commands{$current->{'cmdname'}}) {
+ if ($blockitem_commands{$current->{'cmdname'}}) {
if (@{$current->{'contents'}}) {
my $leading_spaces = 0;
my $before_item;
@@ -1960,7 +1960,8 @@ sub _item_container_parent($)
if ((($current->{'cmdname'} and $current->{'cmdname'} eq 'item')
or ($current->{'type'} and $current->{'type'} eq 'before_item'))
and ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
- and $item_container_commands{$current->{'parent'}->{'cmdname'}})) {
+ and $block_commands{$current->{'parent'}->{'cmdname'}}
+ and $block_commands{$current->{'parent'}->{'cmdname'}} eq
'item_container')) {
return ($current->{'parent'});
}
return undef;
@@ -1975,7 +1976,8 @@ sub _item_line_parent($)
$current = $current->{'parent'};
}
return $current if ($current->{'cmdname'}
- and $item_line_commands{$current->{'cmdname'}});
+ and $block_commands{$current->{'cmdname'}}
+ and $block_commands{$current->{'cmdname'}} eq
'item_line');
return undef;
}
@@ -3084,7 +3086,7 @@ sub _end_line($$$)
# all the commands with @item
if ($current->{'cmdname'}
- and $block_item_commands{$current->{'cmdname'}}) {
+ and $blockitem_commands{$current->{'cmdname'}}) {
if ($current->{'cmdname'} eq 'enumerate') {
my $spec = '1';
if ($current->{'args'} and $current->{'args'}->[0]
@@ -3106,7 +3108,7 @@ sub _end_line($$$)
}
}
$current->{'extra'}->{'enumerate_specification'} = $spec;
- } elsif ($item_line_commands{$current->{'cmdname'}}) {
+ } elsif ($block_commands{$current->{'cmdname'}} eq 'item_line') {
if (!$current->{'extra'}
or !$current->{'extra'}->{'command_as_argument'}) {
$self->_command_error($current, $source_info,
@@ -3146,7 +3148,8 @@ sub _end_line($$$)
and $current->{'extra'}->{'command_as_argument'}
and
$accent_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
and ($current->{'cmdname'} eq 'itemize'
- or $item_line_commands{$current->{'cmdname'}})) {
+ or ($block_commands{$current->{'cmdname'}}
+ and $block_commands{$current->{'cmdname'}} eq
'item_line'))) {
# this can only happen to an accent command with brace, if without
# brace it is not set as command_as_argument to begin with.
$self->_command_warn($current, $source_info,
@@ -3177,8 +3180,9 @@ sub _end_line($$$)
unshift @{$block_line_arg->{'contents'}}, $inserted;
$current->{'extra'}->{'command_as_argument'} = $inserted;
}
- } elsif ($item_line_commands{$current->{'cmdname'}} and
- !$current->{'extra'}->{'command_as_argument'}) {
+ } elsif ($block_commands{$current->{'cmdname'}}
+ and $block_commands{$current->{'cmdname'}} eq 'item_line'
+ and !$current->{'extra'}->{'command_as_argument'}) {
my $inserted = { 'cmdname' => 'asis',
'type' => 'command_as_argument_inserted',
'parent' => $current };
@@ -3713,7 +3717,8 @@ sub _parent_of_command_as_argument($)
and $current->{'parent'}
and $current->{'parent'}->{'cmdname'}
and ($current->{'parent'}->{'cmdname'} eq 'itemize'
- or $item_line_commands{$current->{'parent'}->{'cmdname'}})
+ or ($block_commands{$current->{'parent'}->{'cmdname'}}
+ and $block_commands{$current->{'parent'}->{'cmdname'}} eq
'item_line'))
and scalar(@{$current->{'contents'}}) == 1);
}
@@ -5074,7 +5079,8 @@ sub _process_remaining_on_line($$$$)
# cleaner, and more similar to XS parser, but not required, would have
# been initialized automatically.
$current->{'items_count'} = 0
- if ($item_container_commands{$command});
+ if ($block_commands{$command}
+ and $block_commands{$command} eq 'item_container');
$current->{'args'} = [ {
'type' => 'block_line_arg',
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt
b/tp/Texinfo/XS/parsetexi/command_data.txt
index 4719eb15ff..c04cd84617 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -439,15 +439,15 @@ ignore block
BLOCK_raw
macro block BLOCK_raw
rmacro block BLOCK_raw
-table block,blockitem BLOCK_blockitem 1
-ftable block,blockitem BLOCK_blockitem 1
-vtable block,blockitem BLOCK_blockitem 1
-itemize block,blockitem BLOCK_blockitem 1
-enumerate block,blockitem BLOCK_blockitem 1
-quotation block BLOCK_quotation 1
-smallquotation block BLOCK_quotation 1
-
-float block BLOCK_float 2
+table block,blockitem BLOCK_item_line 1
+ftable block,blockitem BLOCK_item_line 1
+vtable block,blockitem BLOCK_item_line 1
+itemize block,blockitem BLOCK_item_container 1
+enumerate block,blockitem BLOCK_item_container 1
+quotation block BLOCK_quotation 1
+smallquotation block BLOCK_quotation 1
+
+float block BLOCK_float 2
displaymath block
##################################################################
@@ -473,27 +473,27 @@ ifcommandnotdefined block
BLOCK_conditional
##########################################################
# Root commands
-node root,line LINE_line
-top root,line,sectioning,global_unique LINE_line
-chapter root,line,sectioning LINE_line
-unnumbered root,line,sectioning LINE_line
-chapheading line,sectioning LINE_line
-appendix root,line,sectioning LINE_line
-section root,line,sectioning LINE_line
-unnumberedsec root,line,sectioning LINE_line
-heading line,sectioning LINE_line
-appendixsec root,line,sectioning LINE_line
-subsection root,line,sectioning LINE_line
-unnumberedsubsec root,line,sectioning LINE_line
-subheading line,sectioning LINE_line
-appendixsubsec root,line,sectioning LINE_line
-subsubsection root,line,sectioning LINE_line
-unnumberedsubsubsec root,line,sectioning LINE_line
-subsubheading line,sectioning LINE_line
-appendixsubsubsec root,line,sectioning LINE_line
-
-part root,line,sectioning,global LINE_line
-appendixsection root,line,sectioning LINE_line
-majorheading line,sectioning LINE_line
-centerchap root,line,sectioning,deprecated LINE_line
+node root,line LINE_line 4
+top root,line,sectioning_heading,global_unique LINE_line
+chapter root,line,sectioning_heading LINE_line
+unnumbered root,line,sectioning_heading LINE_line
+chapheading line,sectioning_heading LINE_line
+appendix root,line,sectioning_heading LINE_line
+section root,line,sectioning_heading LINE_line
+unnumberedsec root,line,sectioning_heading LINE_line
+heading line,sectioning_heading LINE_line
+appendixsec root,line,sectioning_heading LINE_line
+subsection root,line,sectioning_heading LINE_line
+unnumberedsubsec root,line,sectioning_heading LINE_line
+subheading line,sectioning_heading LINE_line
+appendixsubsec root,line,sectioning_heading LINE_line
+subsubsection root,line,sectioning_heading LINE_line
+unnumberedsubsubsec root,line,sectioning_heading LINE_line
+subsubheading line,sectioning_heading LINE_line
+appendixsubsubsec root,line,sectioning_heading LINE_line
+
+part root,line,sectioning_heading,global LINE_line
+appendixsection root,line,sectioning_heading LINE_line
+majorheading line,sectioning_heading LINE_line
+centerchap root,line,sectioning_heading,deprecated LINE_line
diff --git a/tp/Texinfo/XS/parsetexi/commands.c
b/tp/Texinfo/XS/parsetexi/commands.c
index ef1c2dfbe2..8e70ecbe1d 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -175,7 +175,7 @@ close_paragraph_command (enum command_id cmd)
|| cmd == CM_exdent)
return 1;
- if ((command_data(cmd).flags & CF_sectioning)
+ if ((command_data(cmd).flags & CF_sectioning_heading)
&& !(command_data(cmd).flags & CF_root))
return 1;
diff --git a/tp/Texinfo/XS/parsetexi/commands.h
b/tp/Texinfo/XS/parsetexi/commands.h
index 7a74ae8bc8..863410ee8c 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -51,7 +51,7 @@ void wipe_user_commands (void);
#define CF_line 0x0001
#define CF_deprecated 0x0002
#define CF_root 0x0004
-#define CF_sectioning 0x0008
+#define CF_sectioning_heading 0x0008
#define CF_brace 0x0010
#define CF_letter_no_arg 0x0020
#define CF_accent 0x0040
@@ -114,7 +114,8 @@ void wipe_user_commands (void);
#define BLOCK_raw -2
#define BLOCK_multitable -3
#define BLOCK_region -4
-#define BLOCK_blockitem -6
+#define BLOCK_item_line -5
+#define BLOCK_item_container -6
#define BLOCK_quotation -7
#define BLOCK_float -8
#define BLOCK_menu -9
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 65e9440b6f..19bd2344a9 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -522,7 +522,7 @@ handle_line_command (ELEMENT *current, char **line_inout,
add_to_element_contents (current, misc);
- if (command_data(cmd).flags & CF_sectioning)
+ if (command_data(cmd).flags & CF_sectioning_heading)
{
if (global_info.sections_level)
{
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 7505c75c69..c145381ca4 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -922,7 +922,7 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
if ((outer_flags & CF_line
&& (command_data(outer).data == LINE_specific
|| (command_data(outer).data == LINE_line
- && !(outer_flags & (CF_def | CF_sectioning)))
+ && !(outer_flags & (CF_def | CF_sectioning_heading)))
|| command_data(outer).data == LINE_text
|| command_data(outer).data == LINE_heading_spec)
&& outer != CM_center
@@ -975,7 +975,7 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
|| (!current->parent->cmd && current_context () == ct_def)
/* "full line no refs commands" */
- || (outer_flags & (CF_sectioning | CF_def))
+ || (outer_flags & (CF_sectioning_heading | CF_def))
|| (!current->parent->cmd && current_context () == ct_def))
{
/* Start by checking if the command is allowed inside a "full text
@@ -1015,7 +1015,7 @@ check_valid_nesting (ELEMENT *current, enum command_id
cmd)
/* Now add more restrictions for "full line no refs" commands and
"simple
text" commands. */
- if (outer_flags & (CF_sectioning | CF_def)
+ if (outer_flags & (CF_sectioning_heading | CF_def)
|| (!current->parent->cmd && current_context () == ct_def)
|| simple_text_command)
{
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index c1520fb1fb..e4fe049dc4 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -382,7 +382,8 @@ while ($reader->read) {
print $reader->getAttribute('leadingtext');
}
}
- if ($Texinfo::Common::item_line_commands{$name}
+ if ($Texinfo::Common::block_commands{$name}
+ and $Texinfo::Common::block_commands{$name} eq 'item_line'
and $reader->hasAttributes()
and defined($reader->getAttribute('commandarg'))) {
print '@'.$reader->getAttribute('commandarg');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%blockitem_commands), tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename %block_item_commands as %blockitem_commands to be more consistent with XS parser.,
Patrice Dumas <=