[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm,
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/Transformations.pm, tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h, tp/init/book.pm, tp/init/highlight_syntax.pm: use information from Texinfo::Commands, remove the corresponding hashes from Texinfo::Common. Move comments from Common.pm to command_data.txt and commands.h. |
Date: |
Sun, 02 Oct 2022 16:11:47 -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 2e3aea579d * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm,
tp/Texinfo/Structuring.pm, tp/Texinfo/Transformations.pm,
tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h,
tp/init/book.pm, tp/init/highlight_syntax.pm: use information from
Texinfo::Commands, remove the corresponding hashes from Texinfo::Common. Move
comments from Common.pm to command_data.txt and commands.h.
2e3aea579d is described below
commit 2e3aea579d54a61b3c081bb57fb911a193a17668
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 2 22:11:33 2022 +0200
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm,
tp/Texinfo/Structuring.pm, tp/Texinfo/Transformations.pm,
tp/Texinfo/XS/parsetexi/command_data.txt,
tp/Texinfo/XS/parsetexi/commands.h, tp/init/book.pm,
tp/init/highlight_syntax.pm: use information from Texinfo::Commands,
remove the corresponding hashes from Texinfo::Common. Move comments
from Common.pm to command_data.txt and commands.h.
---
ChangeLog | 10 +
tp/Texinfo/Common.pm | 409 +++-------------------------
tp/Texinfo/Convert/DocBook.pm | 45 +--
tp/Texinfo/Convert/HTML.pm | 44 +--
tp/Texinfo/Convert/IXIN.pm | 17 +-
tp/Texinfo/Convert/LaTeX.pm | 49 ++--
tp/Texinfo/Convert/NodeNameNormalization.pm | 5 +-
tp/Texinfo/Convert/Plaintext.pm | 32 ++-
tp/Texinfo/Convert/Texinfo.pm | 10 +-
tp/Texinfo/Convert/TexinfoMarkup.pm | 35 +--
tp/Texinfo/Convert/Text.pm | 27 +-
tp/Texinfo/Convert/TextContent.pm | 5 +-
tp/Texinfo/Convert/Utils.pm | 5 +-
tp/Texinfo/Structuring.pm | 4 +-
tp/Texinfo/Transformations.pm | 11 +-
tp/Texinfo/XS/parsetexi/command_data.txt | 77 +++++-
tp/Texinfo/XS/parsetexi/commands.h | 8 +-
tp/init/book.pm | 15 +-
tp/init/highlight_syntax.pm | 5 +-
tp/t/test_utils.pl | 3 +-
20 files changed, 286 insertions(+), 530 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d99209c051..3bd89d9c08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-10-02 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm,
+ tp/Texinfo/Structuring.pm, tp/Texinfo/Transformations.pm,
+ tp/Texinfo/XS/parsetexi/command_data.txt,
+ tp/Texinfo/XS/parsetexi/commands.h, tp/init/book.pm,
+ tp/init/highlight_syntax.pm: use information from Texinfo::Commands,
+ remove the corresponding hashes from Texinfo::Common. Move comments
+ from Common.pm to command_data.txt and commands.h.
+
2022-10-02 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/Utils.pm
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index fbc420628a..630bce6c25 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -37,6 +37,7 @@ use Encode;
use Locale::Messages;
use Texinfo::Documentlanguages;
+use Texinfo::Commands;
# debugging
use Carp qw(cluck confess);
@@ -474,7 +475,7 @@ sub valid_tree_transformation ($)
}
-# @-commands classifications and other information on @-commands
+# information on @-commands
our %nobrace_symbol_text;
%nobrace_symbol_text = (
@@ -503,295 +504,53 @@ our %nobrace_symbol_text;
# with 1 argument. Only used in Parser.
our %commands_args_number;
-# commands taking a line as argument or no argument.
-# sectioning commands and def* commands are added below.
-# index commands are added dynamically.
-#
-# The values signification is:
-# special: no value and macro expansion, all the line is used, and
-# analysed during parsing (_parse_special_misc_command)
-# lineraw: no value and macro expansion, the line is kept as-is, not
-# analysed
-# skipline: no argument, everything else on the line is skipped
-# text: the line is parsed as texinfo, and the argument is converted
-# to simple text (in _end_line)
-# line: the line is parsed as texinfo
-# a number: the line is parsed as texinfo and the result should be plain
-# text maybe followed by a comment; the result is analysed
-# during parsing (_parse_line_command_args).
-# The number is an indication of the number of arguments of
-# the command.
-#
-# Beware that @item may be a 'line' command or an 'other' command
-# depending on the context.
-our %line_commands = (
- 'node' => 'line', # special arg
- 'bye' => 'skipline', # no arg
- 'end' => 'text',
- # set, clear
- 'set' => 'special', # special arg
- 'clear' => 'special', # special arg
- 'unmacro' => 'special',
- # comments
- 'comment' => 'lineraw',
- 'c' => 'lineraw',
- # special
- 'definfoenclose' => 'specific', # 3
- 'alias' => 'specific', # 2
- # number of arguments is not known in advance.
- 'columnfractions' => 'specific',
- # file names
- 'setfilename' => 'text',
- 'verbatiminclude' => 'text',
- 'include' => 'text',
-
- 'raisesections' => 'skipline', # no arg
- 'lowersections' => 'skipline', # no arg
- 'contents' => 'skipline', # no arg
- 'shortcontents' => 'skipline', # no arg
- 'summarycontents' => 'skipline', # no arg
- 'insertcopying' => 'skipline', # no arg
- 'clickstyle' => 'special', # arg should be an @-command
- # more relevant in preamble
- 'documentencoding' => 'text', # or 'specific'?
- 'novalidate' => 'skipline', # no arg
- 'dircategory' => 'line', # line. Position with regard
- # with direntry is significant
- 'pagesizes' => 'line', # can have 2 args
- # or one? 200mm,150mm 11.5in
- 'finalout' => 'skipline', # no arg
- 'paragraphindent' => 'specific', # 1: arg none asis
- # or a number and forbids anything else on the line
- 'firstparagraphindent' => 'specific', # 1: none insert
- 'frenchspacing' => 'specific', # 1: on off
- 'codequoteundirected' => 'specific', # 1: on off
- 'codequotebacktick' => 'specific', # 1: on off
- 'xrefautomaticsectiontitle' => 'specific', # 1: on off
- 'deftypefnnewline' => 'specific', # 1: on off
- 'microtype' => 'specific', # 1: on off
- 'fonttextsize' => 'specific', # 1: 10 11
- 'allowcodebreaks' => 'specific', # 1: false or true
- 'exampleindent' => 'specific', # 1: asis or a number
- 'footnotestyle' => 'specific', # 1: end and separate, nothing else on
the line
- 'urefbreakstyle' => 'specific', # 1: after|before|none
- 'smallbook' => 'skipline', # no arg
- 'afourpaper' => 'skipline', # no arg
- 'afivepaper' => 'skipline', # no arg
- 'afourlatex' => 'skipline', # no arg
- 'afourwide' => 'skipline', # no arg
- 'bsixpaper' => 'skipline', # no arg
- 'headings' => 'specific', # 1: off on single double singleafter
doubleafter
- # interacts with setchapternewpage
- 'setchapternewpage' => 'specific', # 1: off on odd
-
- 'syncodeindex' => 'specific', # 2: args are index identifiers
- 'synindex' => 'specific', # 2
- 'defindex' => 'specific', # 1: one identifier arg
- 'defcodeindex' => 'specific', # 1: one identifier arg
- 'documentlanguage' => 'text', # language code arg
- 'kbdinputstyle' => 'specific', # 1: code example distinct
- 'everyheadingmarks' => 'specific', # 1: top bottom
- 'everyfootingmarks' => 'specific', # 1:
- 'evenheadingmarks' => 'specific', # 1:
- 'oddheadingmarks' => 'specific', # 1:
- 'evenfootingmarks' => 'specific', # 1:
- 'oddfootingmarks' => 'specific', # 1:
- 'shorttitlepage' => 'line',
- 'settitle' => 'line',
-
- # formatting
- 'center' => 'line',
- 'printindex' => 'specific', # 1:
- 'listoffloats' => 'line',
- # especially in titlepage
- 'author' => 'line',
- 'subtitle' => 'line',
- 'title' => 'line',
- 'sp' => 'specific', # 1: numerical arg
- 'page' => 'skipline', # no arg (pagebreak)
- 'need' => 'specific', # 1: one numerical/real arg
- # formatting
- 'exdent' => 'line',
- 'item' => 'line', # or nobrace skipspace, depending on the
context
- 'itemx' => 'line',
- # not valid for info (should be in @iftex)
- 'vskip' => 'lineraw', # arg line in TeX
- 'subentry' => 'line',
-);
-
$commands_args_number{'node'} = 4;
-# commands never taking braces nor arguments on the line
-#
-# symbol: non-alphabetical one letter commands without braces.
-# skipspace: following spaces are skipped.
-# other: other.
-our %nobrace_commands = (
- # formatting
- 'noindent' => 'skipspace',
- 'indent' => 'skipspace',
- 'headitem' => 'skipspace',
- 'item' => 'skipspace', # or line, depending on the context
- 'tab' => 'skipspace',
- 'refill' => 'other', # obsolete
-);
-
-foreach my $nobrace_command (keys(%nobrace_symbol_text)) {
- $nobrace_commands{$nobrace_command} = 'symbol';
-}
-
-# only valid in heading or footing specifications
-our %in_heading_spec_commands;
-foreach my $in_heading_command ('thischapter', 'thischaptername',
- 'thischapternum', 'thissection', 'thissectionname', 'thissectionnum',
- 'thisfile', 'thispage', 'thistitle') {
- $in_heading_spec_commands{$in_heading_command} = 1;
-
- $nobrace_commands{$in_heading_command} = 'other';
-}
-
-$in_heading_spec_commands{'|'} = 1;
-
-# %in_heading_spec_commands and @| are only valid in the following @-commands
-our %heading_spec_commands;
-foreach my $headings_specification_command ('everyheading', 'everyfooting',
- 'evenheading', 'evenfooting', 'oddheading', 'oddfooting') {
- $heading_spec_commands{$headings_specification_command} = 1;
-
- $line_commands{$headings_specification_command} = 'line';
-}
-
# only valid in index entries
our %in_index_commands;
foreach my $in_index_command ('sortas', 'seeentry', 'seealso', 'subentry') {
$in_index_commands{$in_index_command} = 1;
}
-our %index_names = (
- 'cp' => {'in_code' => 0},
- 'fn' => {'in_code' => 1},
- 'vr' => {'in_code' => 1},
- 'ky' => {'in_code' => 1},
- 'pg' => {'in_code' => 1},
- 'tp' => {'in_code' => 1},
-);
-
-foreach my $index (keys(%index_names)) {
- $index_names{$index}->{'name'} = $index;
- $index_names{$index}->{'contained_indices'} = {$index => 1};
-}
-
-our %default_index_commands;
-foreach my $index_name (keys (%index_names)) {
- my $one_letter_prefix = substr($index_name, 0, 1);
- foreach my $prefix ($index_name, $one_letter_prefix) {
- $line_commands{$prefix.'index'} = 'line';
- $default_index_commands{$prefix.'index'} = $index_name;
- }
-}
-
# commands with braces.
-our %brace_commands;
our %letter_no_arg_commands;
foreach my $letter_no_arg_command ('aa','AA','ae','oe','AE','OE','o','O',
'ss','l','L','DH','dh','TH','th') {
$letter_no_arg_commands{$letter_no_arg_command} = 1;
- $brace_commands{$letter_no_arg_command} = 'noarg';
-}
-
-foreach my $no_arg_command ('TeX','LaTeX','bullet','copyright',
- 'registeredsymbol','dots','enddots','equiv','error','expansion','arrow',
- 'minus','point','print','result','today',
- 'exclamdown','questiondown','pounds','ordf','ordm',
- 'atchar', 'lbracechar', 'rbracechar', 'backslashchar', 'hashchar', 'comma',
- 'ampchar',
- 'euro', 'geq','leq','tie','textdegree','click',
- 'quotedblleft','quotedblright','quoteleft','quoteright','quotedblbase',
- 'quotesinglbase','guillemetleft','guillemetright','guillemotleft',
- 'guillemotright','guilsinglleft','guilsinglright') {
- $brace_commands{$no_arg_command} = 'noarg';
-}
-
-# accent commands. They may be called with and without braces.
-our %accent_commands;
-foreach my $accent_command ('"','~','^','`',"'",',','=',
- 'ringaccent','H','dotaccent','u','ubaraccent',
- 'udotaccent','v','ogonek','tieaccent', 'dotless') {
- $accent_commands{$accent_command} = 1;
- $brace_commands{$accent_command} = 'accent';
}
-foreach my $style_command ('asis', 'cite', 'clicksequence',
- 'dfn', 'emph', 'sc', 'var', 'headitemfont', 'strong', 'sub', 'sup',
- 'i', 'b', 'sansserif', 'slanted') {
- $brace_commands{$style_command} = 'style_other';
-}
-
-foreach my $command ('r') {
- $brace_commands{$command} = 'style_no_code';
-}
-
-our %brace_code_commands; # contains also non style commands, see below
+# also style_code brace commands
+our %brace_code_commands;
foreach my $command ('code', 'command', 'env', 'file', 'indicateurl', 'kbd',
'key', 'option', 'samp', 't') {
$brace_code_commands{$command} = 1;
- $brace_commands{$command} = 'style_code';
}
-# in this category, the leading and trailing spaces are put in specific
-# text with type, but commas do not delimitate arguments.
-# As other arguments brace_commands, they can only contain simple text,
-# ie not ref, footnote, titlefont, anchor, verb.
-# Parsers have specific checks for U content.
+# brace style command that are not style code commands
+$brace_code_commands{'verb'} = 1;
+
foreach my $one_arg_command ('U', 'hyphenation',
'anchor', 'errormsg', 'sortas', 'seeentry', 'seealso') {
- $brace_commands{$one_arg_command} = 'arguments';
$commands_args_number{$one_arg_command} = 1;
}
-# Leading and trailing spaces kept in main text.
-# verb is treated especially, it should not matter much in which category it
is.
-# value also is treated especially.
-foreach my $special_arg_command ('w', 'verb', 'value') {
- $brace_commands{$special_arg_command} = 'special';
-}
-
-# Leading and trailing spaces kept in main text.
-foreach my $other_arg_command ('titlefont', 'dmn') {
- $brace_commands{$other_arg_command} = 'other';
-}
-
-# only accept plain text, ie only accent, symbol and glyph commands
-our %contain_plain_text_commands;
-foreach my $command ('dmn', 'hyphenation', 'key', 'sortas', 'w') {
- $contain_plain_text_commands{$command} = 1;
-}
-
-# brace style command that are not style commands
-$brace_code_commands{'verb'} = 1;
-
# Commands that enclose full texts not in the main document context.
# They can contain multiple paragraphs.
our %context_brace_commands;
foreach my $context_brace_command ('footnote', 'caption',
'shortcaption') {
$context_brace_commands{$context_brace_command} = $context_brace_command;
- $brace_commands{$context_brace_command} = 'context';
}
-our %math_commands;
# Commands that enclose math content, and, because of that, are not in the
# main document context.
foreach my $math_brace_command ('math') {
$context_brace_commands{$math_brace_command} = $math_brace_command;
- $brace_commands{$math_brace_command} = 'context';
- $math_commands{$math_brace_command} = 1;
}
our %explained_commands;
foreach my $explained_command ('abbr', 'acronym') {
$explained_commands{$explained_command} = 1;
- $brace_commands{$explained_command} = 'arguments';
$commands_args_number{$explained_command} = 2;
}
@@ -800,7 +559,6 @@ foreach my $inline_format_command ('inlineraw', 'inlinefmt',
'inlinefmtifelse') {
$inline_format_commands{$inline_format_command} = 1;
$commands_args_number{$inline_format_command} = 2;
- $brace_commands{$inline_format_command} = 'inline';
}
$commands_args_number{'inlinefmtifelse'} = 3;
@@ -809,22 +567,18 @@ our %inline_conditional_commands;
foreach my $inline_conditional_command ('inlineifclear', 'inlineifset') {
$inline_conditional_commands{$inline_conditional_command} = 1;
$commands_args_number{$inline_conditional_command} = 2;
- $brace_commands{$inline_conditional_command} = 'inline';
}
foreach my $two_arg_command('email') {
$commands_args_number{$two_arg_command} = 2;
- $brace_commands{$two_arg_command} = 'arguments';
}
foreach my $three_arg_command('uref','url','inforef') {
$commands_args_number{$three_arg_command} = 3;
- $brace_commands{$three_arg_command} = 'arguments';
}
foreach my $five_arg_command('xref','ref','pxref','image') {
$commands_args_number{$five_arg_command} = 5;
- $brace_commands{$five_arg_command} = 'arguments';
}
@@ -841,13 +595,6 @@ foreach my $unformatted_brace_command ('anchor',
'shortcaption',
$unformatted_brace_commands{$unformatted_brace_command} = 1;
}
-# commands delimiting blocks, with an @end.
-# Type of command, 'raw', 'def', 'conditional', 'multitable'...
-our %block_commands;
-
-# commands that have a possible content before an item
-our %blockitem_commands;
-
# Do nothing, used to mark translations for gettext. The strings
# are marked to be translated in the parsers with type 'untranslated'.
sub gdt($)
@@ -882,77 +629,20 @@ our %def_map = (
'deftypemethod', {'deftypeop' => gdt('Method')},
);
-our %def_commands;
-our %def_aliases;
-# consistent with XS parser flag
-our %def_alias_commands;
# Argument not metasyntactic variables only.
our %def_no_var_arg_commands;
+our %def_aliases;
foreach my $def_command(keys %def_map) {
if (ref($def_map{$def_command}) eq 'HASH') {
my ($real_command) = keys (%{$def_map{$def_command}});
$def_aliases{$def_command} = $real_command;
$def_aliases{$def_command.'x'} = $real_command.'x';
- $def_alias_commands{$def_command} = 1;
}
- $block_commands{$def_command} = 'def';
- $line_commands{$def_command.'x'} = 'line';
- $def_commands{$def_command} = 1;
- $def_commands{$def_command.'x'} = 1;
$def_no_var_arg_commands{$def_command} = 1 if ($def_command =~ /^deftype/);
}
-$block_commands{'multitable'} = 'multitable';
-$blockitem_commands{'multitable'} = 1;
-
-# block commands in which menu entry and menu comments appear
-foreach my $menu_command ('menu', 'detailmenu', 'direntry') {
- $block_commands{$menu_command} = 'menu';
-};
-
-foreach my $align_command('raggedright', 'flushleft', 'flushright',
- 'indentedblock', 'smallindentedblock',
- 'cartouche', 'group') {
- $block_commands{$align_command} = 'other';
-}
-
-foreach my $block_command('titlepage', 'copying', 'documentdescription') {
- $block_commands{$block_command} = 'region';
-}
-
-our %preformatted_commands;
-our %preformatted_code_commands;
-foreach my $preformatted_command(
- 'example', 'smallexample', 'lisp', 'smalllisp') {
- $block_commands{$preformatted_command} = 'preformatted';
- $preformatted_commands{$preformatted_command} = 1;
- $preformatted_code_commands{$preformatted_command} = 1;
-}
-
-# unlimited arguments
-our %variadic_commands = (
- 'example' => 1,
-);
-
-foreach my $preformatted_command(
- 'display', 'smalldisplay', 'format', 'smallformat') {
- $block_commands{$preformatted_command} = 'preformatted';
- $preformatted_commands{$preformatted_command} = 1;
-}
-
-foreach my $block_math_command('displaymath') {
- $block_commands{$block_math_command} = 'math';
- $math_commands{$block_math_command} = 1;
-}
-
-# macro/rmacro are special
-foreach my $raw_command ('verbatim', 'ignore', 'macro', 'rmacro') {
- $block_commands{$raw_command} = 'raw';
-}
-
our %texinfo_output_formats;
foreach my $format_raw_command('html', 'tex', 'xml', 'docbook', 'latex') {
- $block_commands{$format_raw_command} = 'format_raw';
$texinfo_output_formats{$format_raw_command} = $format_raw_command;
}
@@ -960,45 +650,28 @@ foreach my $output_format_command ('info', 'plaintext') {
$texinfo_output_formats{$output_format_command} = $output_format_command;
}
-foreach my $command (keys(%texinfo_output_formats)) {
- $block_commands{'if' . $command} = 'conditional';
- $block_commands{'ifnot' . $command} = 'conditional';
-}
-
-$block_commands{'ifset'} = 'conditional';
-$block_commands{'ifclear'} = 'conditional';
-
-$block_commands{'ifcommanddefined'} = 'conditional';
-$block_commands{'ifcommandnotdefined'} = 'conditional';
-
foreach my $item_container_command ('itemize', 'enumerate') {
- $block_commands{$item_container_command} = 'item_container';
$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';
$commands_args_number{$item_line_command} = 1;
- $blockitem_commands{$item_line_command} = 1;
}
foreach my $block_command_one_arg('quotation', 'smallquotation') {
- $block_commands{$block_command_one_arg} = 'quotation';
$commands_args_number{$block_command_one_arg} = 1;
}
-$block_commands{'float'} = 'float';
$commands_args_number{'float'} = 2;
# commands that forces closing an opened paragraph.
our %close_paragraph_commands;
-foreach my $block_command (keys(%block_commands)) {
+foreach my $block_command (keys(%Texinfo::Commands::block_commands)) {
$close_paragraph_commands{$block_command} = 1
- unless ($block_commands{$block_command} eq 'raw'
- or $block_commands{$block_command} eq 'conditional'
- or $block_commands{$block_command} eq 'format_raw');
+ unless ($Texinfo::Commands::block_commands{$block_command} eq 'raw'
+ or $Texinfo::Commands::block_commands{$block_command} eq
'conditional'
+ or $Texinfo::Commands::block_commands{$block_command} eq
'format_raw');
}
$close_paragraph_commands{'verbatim'} = 1;
@@ -1011,7 +684,7 @@ foreach my $close_paragraph_command ('titlefont',
'insertcopying', 'sp',
$close_paragraph_commands{$close_paragraph_command} = 1;
}
-foreach my $close_paragraph_command (keys(%def_commands)) {
+foreach my $close_paragraph_command (keys(%Texinfo::Commands::def_commands)) {
$close_paragraph_commands{$close_paragraph_command} = 1;
}
@@ -1028,8 +701,6 @@ for my $cmd ('example', 'display', 'format', 'lisp',
'quotation',
# commands that should only appear at the root level and contain up to
# the next root command. @node and sectioning commands.
-our %root_commands;
-
our %command_structuring_level = (
'top' => 0,
'part' => 0, # out of the main hierarchy
@@ -1091,16 +762,10 @@ our %level_to_structuring_command;
}
-our %sectioning_heading_commands;
-
foreach my $sectioning_command (keys (%command_structuring_level)) {
- $line_commands{$sectioning_command} = 'line';
if ($sectioning_command =~ /heading/) {
$close_paragraph_commands{$sectioning_command} = 1;
- } else {
- $root_commands{$sectioning_command} = 1;
}
- $sectioning_heading_commands{$sectioning_command} = 1;
}
@@ -1110,7 +775,7 @@ foreach my $sectioning_command (keys
(%command_structuring_level)) {
our %formatted_line_commands;
foreach my $formatted_line_command ('center', 'page',
'author', 'subtitle', 'title', 'exdent', 'item', 'itemx',
- 'node', keys(%sectioning_heading_commands)) {
+ 'node', keys(%Texinfo::Commands::sectioning_heading_commands)) {
$formatted_line_commands{$formatted_line_command} = 1;
}
@@ -1133,25 +798,15 @@ foreach my $formattable_line_command ('insertcopying',
$formattable_line_commands{$formattable_line_command} = 1;
}
-$root_commands{'node'} = 1;
-
-# Not used, kept here for completeness as documentation.
-# @txiinternalvalue is considered as a valid command only if a customization
-# option is set, such that it does not appear in user documents.
-our %internal_commands;
-%internal_commands = (
- 'txiinternalvalue' => 'brace',
-);
-
# %all_commands includes user-settable commands only.
# The internal commands are not in %all_commands.
# used in util/txicmdlist
our %all_commands;
foreach my $command (
- keys(%Texinfo::Common::block_commands),
- keys(%Texinfo::Common::brace_commands),
- keys(%Texinfo::Common::line_commands),
- keys(%Texinfo::Common::nobrace_commands),
+ keys(%Texinfo::Commands::block_commands),
+ keys(%Texinfo::Commands::brace_commands),
+ keys(%Texinfo::Commands::line_commands),
+ keys(%Texinfo::Commands::nobrace_commands),
) {
$all_commands{$command} = 1;
}
@@ -1160,19 +815,21 @@ foreach my $command (
our %preamble_commands;
foreach my $preamble_command ('direnty', 'hyphenation', 'errormsg',
'inlineraw', '*', keys(%document_settable_at_commands),
- (grep {$block_commands{$_} eq 'format_raw'
- or $block_commands{$_} eq 'region'} keys(%block_commands)),
+ (grep {$Texinfo::Commands::block_commands{$_} eq 'format_raw'
+ or $Texinfo::Commands::block_commands{$_} eq 'region'}
+
keys(%Texinfo::Commands::block_commands)),
keys(%inline_format_commands), keys(%inline_conditional_commands),
- keys(%unformatted_block_commands), keys(%line_commands),
- keys(%nobrace_commands)) {
+ keys(%unformatted_block_commands),
keys(%Texinfo::Commands::line_commands),
+ keys(%Texinfo::Commands::nobrace_commands)) {
$preamble_commands{$preamble_command} = 1;
}
foreach my $formattable_or_formatted_misc_command (
keys(%formattable_line_commands), keys(%formatted_line_commands),
keys(%formatted_nobrace_commands),
- keys(%default_index_commands), keys(%in_heading_spec_commands),
- keys(%def_commands)) {
+ keys(%Texinfo::Commands::default_index_commands),
+ keys(%Texinfo::Commands::in_heading_spec_commands),
+ keys(%Texinfo::Commands::def_commands)) {
delete $preamble_commands{$formattable_or_formatted_misc_command};
}
@@ -1656,7 +1313,7 @@ sub _informative_command_value($)
my $cmdname = $element->{'cmdname'};
- if ($line_commands{$cmdname} eq 'skipline') {
+ if ($Texinfo::Commands::line_commands{$cmdname} eq 'skipline') {
return 1;
} elsif (exists($element->{'extra'}->{'text_arg'})) {
return $element->{'extra'}->{'text_arg'};
@@ -1868,14 +1525,14 @@ sub is_content_empty($;$)
next;
}
}
- if (exists($line_commands{$content->{'cmdname'}})) {
+ if (exists($Texinfo::Commands::line_commands{$content->{'cmdname'}})) {
if ($formatted_line_commands{$content->{'cmdname'}}
or $formattable_line_commands{$content->{'cmdname'}}) {
return 0;
} else {
next;
}
- } elsif (exists($nobrace_commands{$content->{'cmdname'}})) {
+ } elsif
(exists($Texinfo::Commands::nobrace_commands{$content->{'cmdname'}})) {
if ($formatted_nobrace_commands{$content->{'cmdname'}}) {
return 0;
} else {
@@ -1912,7 +1569,7 @@ foreach my $type (@inline_types) {
$inline_types{$type} = 1;
}
-my %not_inline_commands = (%root_commands, %block_commands,
+my %not_inline_commands = (%Texinfo::Commands::root_commands,
%Texinfo::Commands::block_commands,
%context_brace_commands);
# Return 1 if inline in a running text, 0 if right in top-level or block
@@ -2062,10 +1719,10 @@ sub find_parent_root_command($$)
my $root_command;
while (1) {
if ($current->{'cmdname'}) {
- if ($root_commands{$current->{'cmdname'}}) {
+ if ($Texinfo::Commands::root_commands{$current->{'cmdname'}}) {
return $current;
- } elsif ($block_commands{$current->{'cmdname'}}
- and $block_commands{$current->{'cmdname'}} eq 'region') {
+ } elsif ($Texinfo::Commands::block_commands{$current->{'cmdname'}}
+ and $Texinfo::Commands::block_commands{$current->{'cmdname'}}
eq 'region') {
if ($current->{'cmdname'} eq 'copying' and $self
and $self->{'global_commands'}
and $self->{'global_commands'}->{'insertcopying'}) {
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 24a21257da..6a26f850a1 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -22,6 +22,7 @@ package Texinfo::Convert::DocBook;
use 5.00405;
use strict;
+use Texinfo::Commands;
use Texinfo::Common;
# for debugging
@@ -41,7 +42,7 @@ use vars qw($VERSION @ISA);
$VERSION = '6.8dev';
-my %brace_commands = %Texinfo::Common::brace_commands;
+my %brace_commands = %Texinfo::Commands::brace_commands;
my $nbsp = '&#'.hex('00A0').';';
@@ -171,14 +172,14 @@ my %docbook_line_elements_with_arg_map = (
'center' => 'simpara role="center"',
);
-my %docbook_nobrace_commands = %Texinfo::Common::nobrace_commands;
+my %docbook_nobrace_commands = %Texinfo::Commands::nobrace_commands;
foreach my $command ('item', 'headitem', 'tab',
keys(%docbook_no_arg_commands_formatting)) {
delete $docbook_nobrace_commands{$command};
}
-my %docbook_line_commands = %Texinfo::Common::line_commands;
-foreach my $command ('itemx', keys %Texinfo::Common::def_commands) {
+my %docbook_line_commands = %Texinfo::Commands::line_commands;
+foreach my $command ('itemx', keys %Texinfo::Commands::def_commands) {
delete $docbook_line_commands{$command};
}
@@ -274,8 +275,8 @@ sub converter_initialize($)
$self->{'document_context'} = [{'monospace' => [0], 'upper_case' => [0]}];
$self->{'context_block_commands'} = {%default_context_block_commands};
- foreach my $raw (grep {$Texinfo::Common::block_commands{$_} eq 'format_raw'}
- keys(%Texinfo::Common::block_commands)) {
+ foreach my $raw (grep {$Texinfo::Commands::block_commands{$_} eq
'format_raw'}
+ keys(%Texinfo::Commands::block_commands)) {
$self->{'context_block_commands'}->{$raw} = 1
if $self->{'expanded_formats_hash'}->{$raw};
}
@@ -718,7 +719,7 @@ sub _convert($$;$)
}
} elsif ($element->{'cmdname'} eq 'today') {
return $self->_convert(Texinfo::Convert::Utils::expand_today($self));
- } elsif ($Texinfo::Common::accent_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Commands::accent_commands{$element->{'cmdname'}}) {
return $self->xml_accents($element,
$self->{'document_context'}->[-1]->{'upper_case'}->[-1]);
} elsif ($element->{'cmdname'} eq 'item' or $element->{'cmdname'} eq
'itemx'
@@ -785,7 +786,7 @@ sub _convert($$;$)
Texinfo::Common::set_informative_command_value($self, $element);
return '';
}
- if ($Texinfo::Common::root_commands{$element->{'cmdname'}}) {
+ if ($Texinfo::Commands::root_commands{$element->{'cmdname'}}) {
if ($self->get_conf('NO_TOP_NODE_OUTPUT')) {
my $node_element;
if ($element->{'cmdname'} eq 'node') {
@@ -901,7 +902,7 @@ sub _convert($$;$)
}
} elsif ($element->{'cmdname'} eq 'c' or $element->{'cmdname'} eq
'comment') {
return $self->xml_comment($element->{'args'}->[0]->{'text'})
- } elsif
($Texinfo::Common::sectioning_heading_commands{$element->{'cmdname'}}) {
+ } elsif
($Texinfo::Commands::sectioning_heading_commands{$element->{'cmdname'}}) {
if ($element->{'args'} and $element->{'args'}->[0]) {
my ($arg, $end_line) =
$self->_convert_argument_and_end_line($element);
$result .=
@@ -959,7 +960,7 @@ sub _convert($$;$)
$result .= $arg;
} elsif ($element->{'args'}
- and
exists($Texinfo::Common::brace_commands{$element->{'cmdname'}})) {
+ and
exists($Texinfo::Commands::brace_commands{$element->{'cmdname'}})) {
#Texinfo::Common::debug_list(" brace command with args",
$element->{'args'});
if ($style_commands_formatting{$element->{'cmdname'}}) {
if ($Texinfo::Common::context_brace_commands{$element->{'cmdname'}}) {
@@ -1014,7 +1015,7 @@ sub _convert($$;$)
} else {
return '';
}
- } elsif ($Texinfo::Common::ref_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Commands::ref_commands{$element->{'cmdname'}}) {
if ($element->{'args'}) {
my $cmdname;
my $book_contents;
@@ -1376,7 +1377,7 @@ sub _convert($$;$)
}
return $result;
- } elsif ($Texinfo::Common::brace_commands{$element->{'cmdname'}} eq
'inline') {
+ } elsif ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq
'inline') {
my $expand = 0;
if ($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}) {
if ($element->{'cmdname'} eq 'inlinefmtifelse'
@@ -1419,7 +1420,7 @@ sub _convert($$;$)
} elsif ($element->{'cmdname'} eq 'w') {
return $w_command_mark;
- } elsif (exists($Texinfo::Common::block_commands{$element->{'cmdname'}})) {
+ } elsif
(exists($Texinfo::Commands::block_commands{$element->{'cmdname'}})) {
if ($ignored_block_commands{$element->{'cmdname'}}) {
return '';
}
@@ -1449,7 +1450,7 @@ sub _convert($$;$)
$numeration = 'arabic';
}
push @attributes, " numeration=\"$numeration\"";
- } elsif ($Texinfo::Common::block_commands{$element->{'cmdname'}} eq
'item_line') {
+ } elsif ($Texinfo::Commands::block_commands{$element->{'cmdname'}} eq
'item_line') {
push @format_elements, 'variablelist';
} elsif ($element->{'cmdname'} eq 'itemize') {
push @format_elements, 'itemizedlist';
@@ -1530,13 +1531,13 @@ sub _convert($$;$)
}
$format_element = 'blockquote' if (!defined($format_element));
push @format_elements, $format_element;
- } elsif ($Texinfo::Common::block_commands{$element->{'cmdname'}} eq
'format_raw') {
+ } elsif ($Texinfo::Commands::block_commands{$element->{'cmdname'}} eq
'format_raw') {
return '' if
(!$self->{'expanded_formats_hash'}->{$element->{'cmdname'}});
# the context is here only for the command, so this is forgotten
# once all the raw internal text has been formatted
$self->{'document_context'}->[-1]->{'raw'} = 1;
- } elsif ($Texinfo::Common::block_commands{$element->{'cmdname'}} eq 'raw'
- or $Texinfo::Common::block_commands{$element->{'cmdname'}} eq
'menu') {
+ } elsif ($Texinfo::Commands::block_commands{$element->{'cmdname'}} eq
'raw'
+ or $Texinfo::Commands::block_commands{$element->{'cmdname'}} eq
'menu') {
return '';
}
foreach my $format_element (@format_elements) {
@@ -1610,8 +1611,8 @@ sub _convert($$;$)
#warn " have contents $element->{'contents'}\n";
my $in_code;
if ($element->{'cmdname'}
- and
($Texinfo::Common::preformatted_code_commands{$element->{'cmdname'}}
- or $Texinfo::Common::math_commands{$element->{'cmdname'}})) {
+ and
($Texinfo::Commands::preformatted_code_commands{$element->{'cmdname'}}
+ or $Texinfo::Commands::math_commands{$element->{'cmdname'}})) {
$in_code = 1;
}
push @{$self->{'document_context'}->[-1]->{'monospace'}}, 1
@@ -1652,7 +1653,7 @@ sub _convert($$;$)
}
if ($element->{'cmdname'}
- and exists($Texinfo::Common::block_commands{$element->{'cmdname'}})) {
+ and exists($Texinfo::Commands::block_commands{$element->{'cmdname'}})) {
# a pending_prepend still there may happen if a quotation is empty.
delete $self->{'pending_prepend'};
#$result .= "</$element->{'cmdname'}>\n";
@@ -1672,7 +1673,7 @@ sub _convert($$;$)
if ($format ne $docbook_preformatted_formats{$element->{'type'}});
# close sectioning command
} elsif ($element->{'cmdname'} and $element->{'cmdname'} ne 'node'
- and $Texinfo::Common::root_commands{$element->{'cmdname'}}) {
+ and $Texinfo::Commands::root_commands{$element->{'cmdname'}}) {
my $docbook_sectioning_element = $self->_docbook_section_element($element);
if ($docbook_sectioning_element eq 'part'
and not ($element->{'extra'}
@@ -1707,7 +1708,7 @@ sub _convert($$;$)
}
if ($element->{'cmdname'}
- and $Texinfo::Common::root_commands{$element->{'cmdname'}}
+ and $Texinfo::Commands::root_commands{$element->{'cmdname'}}
and defined($self->{'in_skipped_node_top'})
and $self->{'in_skipped_node_top'} == 1) {
return '';
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 33f01ac1fe..656f64d85c 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -52,6 +52,7 @@ use Storable;
use Encode qw(find_encoding decode encode);
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Config;
use Texinfo::Convert::Unicode;
@@ -93,29 +94,30 @@ sub import {
-# misc commands that are of use for formatting.
+my %nobrace_commands = %Texinfo::Commands::nobrace_commands;
+my %line_commands = %Texinfo::Commands::line_commands;
+my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
+my %accent_commands = %Texinfo::Commands::accent_commands;
+my %sectioning_heading_commands =
%Texinfo::Commands::sectioning_heading_commands;
+my %def_commands = %Texinfo::Commands::def_commands;
+my %ref_commands = %Texinfo::Commands::ref_commands;
+my %brace_commands = %Texinfo::Commands::brace_commands;
+my %block_commands = %Texinfo::Commands::block_commands;
+my %root_commands = %Texinfo::Commands::root_commands;
+my %preformatted_commands = %Texinfo::Commands::preformatted_commands;
+my %math_commands = %Texinfo::Commands::math_commands;
+my %preformatted_code_commands =
%Texinfo::Commands::preformatted_code_commands;
+
+my %context_brace_commands = %Texinfo::Common::context_brace_commands;
+my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
+
my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
my %formatted_nobrace_commands = %Texinfo::Common::formatted_nobrace_commands;
my %formattable_line_commands = %Texinfo::Common::formattable_line_commands;
-my %nobrace_commands = %Texinfo::Common::nobrace_commands;
-my %line_commands = %Texinfo::Common::line_commands;
-my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
-my %accent_commands = %Texinfo::Common::accent_commands;
-my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
-my %def_commands = %Texinfo::Common::def_commands;
-my %ref_commands = %Texinfo::Common::ref_commands;
-my %brace_commands = %Texinfo::Common::brace_commands;
-my %block_commands = %Texinfo::Common::block_commands;
-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 %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %brace_code_commands = %Texinfo::Common::brace_code_commands;
-my %preformatted_code_commands = %Texinfo::Common::preformatted_code_commands;
-my %default_index_commands = %Texinfo::Common::default_index_commands;
-my %context_brace_commands = %Texinfo::Common::context_brace_commands;
-my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
+my %default_index_commands = %Texinfo::Commands::default_index_commands;
my %small_block_associated_command =
%Texinfo::Common::small_block_associated_command;
foreach my $def_command (keys(%def_commands)) {
@@ -3654,7 +3656,7 @@ sub _convert_heading_command($$$$$)
.Texinfo::Convert::Texinfo::root_heading_command_to_texinfo($element)."\n"
if ($self->get_conf('DEBUG'));
my $tree_unit;
- if ($Texinfo::Common::root_commands{$element->{'cmdname'}}
+ if ($Texinfo::Commands::root_commands{$element->{'cmdname'}}
and $element->{'structure'}->{'associated_unit'}) {
$tree_unit = $element->{'structure'}->{'associated_unit'};
}
@@ -3689,7 +3691,7 @@ sub _convert_heading_command($$$$$)
}
if ($self->get_conf('NO_TOP_NODE_OUTPUT')
- and $Texinfo::Common::root_commands{$cmdname}) {
+ and $Texinfo::Commands::root_commands{$cmdname}) {
my $in_skipped_node_top
= $self->shared_conversion_state('in_skipped_node_top', 0);
my $node_element;
@@ -3744,7 +3746,7 @@ sub _convert_heading_command($$$$$)
# the section was opened before when the node was encountered
and not $element->{'extra'}->{'associated_node'}
# to avoid *heading* @-commands
- and $Texinfo::Common::root_commands{$cmdname}) {
+ and $Texinfo::Commands::root_commands{$cmdname}) {
$opening_section = $element;
$level_corrected_opening_section_cmdname = $level_corrected_cmdname;
}
@@ -3816,7 +3818,7 @@ sub _convert_heading_command($$$$$)
if ($do_heading) {
if ($self->get_conf('TOC_LINKS')
- and $Texinfo::Common::root_commands{$cmdname}
+ and $Texinfo::Commands::root_commands{$cmdname}
and $sectioning_heading_commands{$cmdname}) {
my $content_href = $self->command_contents_href($element, 'contents');
if ($content_href ne '') {
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index ce90f6ad72..00e96524b2 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -66,11 +66,12 @@ use 5.00405;
use strict;
use MIME::Base64;
-use Texinfo::Convert::TexinfoSXML;
-use Texinfo::Common;
-
use Carp qw(cluck);
+use Texinfo::Commands;
+use Texinfo::Common;
+use Texinfo::Convert::TexinfoSXML;
+
use vars qw($VERSION @ISA);
@ISA = qw(Texinfo::Convert::Converter);
@@ -245,7 +246,7 @@ sub _get_element($$)
}
}
if ($current->{'cmdname'}) {
- if ($Texinfo::Common::root_commands{$current->{'cmdname'}}) {
+ if ($Texinfo::Commands::root_commands{$current->{'cmdname'}}) {
$root_command = $current;
return ($element, $root_command) if defined($element);
}
@@ -401,8 +402,8 @@ sub output_ixin($$)
# FIXME this code is unclear and probably needs to be fixed if developemnt
# resumes. Maybe could be replaced by set_global_document_commands.
foreach my $global_command (keys(%{$self->{'global_commands'}})) {
- if ((($Texinfo::Common::line_commands{$global_command}
- and $Texinfo::Common::line_commands{$global_command} eq 'specific')
+ if ((($Texinfo::Commands::line_commands{$global_command}
+ and $Texinfo::Commands::line_commands{$global_command} eq 'specific')
or $additional_setting_commands{$global_command})
and !$global_line_not_setting_commands{$global_command}) {
if (ref($self->{'global_commands'}->{$global_command}) eq 'ARRAY') {
@@ -458,7 +459,7 @@ sub output_ixin($$)
$result .= ' ';
# FIXME lineraw is most probably not the right type of line
# command. Maybe should be specific?
- if ($Texinfo::Common::line_commands{$command_name} eq 'lineraw') {
+ if ($Texinfo::Commands::line_commands{$command_name} eq 'lineraw') {
$result .= $self->ixin_list_element('settingvalue',
[['value', $settings{$command_name}]]);
} else {
@@ -564,7 +565,7 @@ sub output_ixin($$)
$nodes_index .= ' ';
# FIXME Probably not the right line type, lineraw commands are c,
# comment and vskip.
- if ($Texinfo::Common::line_commands{$command_name} eq 'lineraw') {
+ if ($Texinfo::Commands::line_commands{$command_name} eq 'lineraw') {
$nodes_index .= $self->ixin_list_element('nodetweakvalue',
[['value', $node_tweaks{$normalized_node_name}->{$command_name}]]);
} else {
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index f536f27136..f774731f5c 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -176,12 +176,12 @@ use File::Spec;
use Carp qw(cluck confess);
-use Texinfo::Convert::Converter;
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
use Texinfo::Convert::NodeNameNormalization;
-
use Texinfo::Convert::Text;
+use Texinfo::Convert::Converter;
use vars qw($VERSION @ISA);
@ISA = qw(Texinfo::Convert::Converter);
@@ -210,29 +210,30 @@ foreach my $informative_command (keys
(%Texinfo::Common::document_settable_at_co
$informative_commands{$informative_command} = 1;
}
-my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
my %brace_no_arg_commands;
-foreach my $command (keys (%Texinfo::Common::brace_commands)) {
+foreach my $command (keys (%Texinfo::Commands::brace_commands)) {
$brace_no_arg_commands{$command} = 1
- if ($Texinfo::Common::brace_commands{$command} eq 'noarg');
-}
-my %accent_commands = %Texinfo::Common::accent_commands;
-my %line_commands = %Texinfo::Common::line_commands;
-my %nobrace_commands = %Texinfo::Common::nobrace_commands;
-my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
-my %def_commands = %Texinfo::Common::def_commands;
-my %ref_commands = %Texinfo::Common::ref_commands;
-my %block_commands = %Texinfo::Common::block_commands;
-my %root_commands = %Texinfo::Common::root_commands;
-my %preformatted_commands = %Texinfo::Common::preformatted_commands;
-my %math_commands = %Texinfo::Common::math_commands;
+ if ($Texinfo::Commands::brace_commands{$command} eq 'noarg');
+}
+my %accent_commands = %Texinfo::Commands::accent_commands;
+my %line_commands = %Texinfo::Commands::line_commands;
+my %nobrace_commands = %Texinfo::Commands::nobrace_commands;
+my %sectioning_heading_commands =
%Texinfo::Commands::sectioning_heading_commands;
+my %def_commands = %Texinfo::Commands::def_commands;
+my %ref_commands = %Texinfo::Commands::ref_commands;
+my %block_commands = %Texinfo::Commands::block_commands;
+my %root_commands = %Texinfo::Commands::root_commands;
+my %preformatted_commands = %Texinfo::Commands::preformatted_commands;
+my %math_commands = %Texinfo::Commands::math_commands;
+my %preformatted_code_commands =
%Texinfo::Commands::preformatted_code_commands;
+my %default_index_commands = %Texinfo::Commands::default_index_commands;
+my %heading_spec_commands = %Texinfo::Commands::heading_spec_commands;
+
+my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
+my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
my %explained_commands = %Texinfo::Common::explained_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %brace_code_commands = %Texinfo::Common::brace_code_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 %heading_spec_commands = %Texinfo::Common::heading_spec_commands;
my %unformatted_brace_command = %Texinfo::Common::unformatted_brace_command;
my %preamble_commands = %Texinfo::Common::preamble_commands;
@@ -2223,8 +2224,8 @@ sub _convert($$)
if ((defined($type) and $self->{'ignored_types'}->{$type})
or (defined($cmdname)
and ($self->{'ignored_commands'}->{$cmdname}
- or ($Texinfo::Common::brace_commands{$cmdname}
- and $Texinfo::Common::brace_commands{$cmdname} eq 'inline'
+ or ($Texinfo::Commands::brace_commands{$cmdname}
+ and $Texinfo::Commands::brace_commands{$cmdname} eq
'inline'
and $cmdname ne 'inlinefmtifelse'
and (($inline_format_commands{$cmdname}
and (!$element->{'extra'}->{'format'}
@@ -2984,8 +2985,8 @@ sub _convert($$)
}
}
return $result;
- } elsif ($Texinfo::Common::brace_commands{$cmdname}
- and $Texinfo::Common::brace_commands{$cmdname} eq 'inline') {
+ } elsif ($Texinfo::Commands::brace_commands{$cmdname}
+ and $Texinfo::Commands::brace_commands{$cmdname} eq 'inline') {
my $arg_index = 1;
if ($cmdname eq 'inlinefmtifelse'
and (!$element->{'extra'}->{'format'}
diff --git a/tp/Texinfo/Convert/NodeNameNormalization.pm
b/tp/Texinfo/Convert/NodeNameNormalization.pm
index 336d1af134..31e9f408f3 100644
--- a/tp/Texinfo/Convert/NodeNameNormalization.pm
+++ b/tp/Texinfo/Convert/NodeNameNormalization.pm
@@ -33,6 +33,7 @@ use Unicode::Normalize;
use Text::Unidecode;
# commands classes
+use Texinfo::Commands;
use Texinfo::Common;
# use the hashes and functions
use Texinfo::Convert::Unicode;
@@ -65,7 +66,7 @@ my %normalize_node_nobrace_symbol_text
= %Texinfo::Common::nobrace_symbol_text;
$normalize_node_nobrace_symbol_text{'*'} = ' ';
-my %accent_commands = %Texinfo::Common::accent_commands;
+my %accent_commands = %Texinfo::Commands::accent_commands;
my %ignored_brace_commands;
foreach my $ignored_brace_command ('anchor', 'footnote', 'shortcaption',
@@ -285,7 +286,7 @@ sub _convert($;$)
}
#} elsif ($element->{'cmdname'} eq 'image') {
# return _convert($element->{'args'}->[0]);
- } elsif ($Texinfo::Common::ref_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Commands::ref_commands{$element->{'cmdname'}}) {
my @args_try_order;
if ($element->{'cmdname'} eq 'inforef') {
@args_try_order = (0, 1, 2);
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index deea10801e..8115701ef2 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -30,6 +30,7 @@ use if $] >= 5.014, re => '/a';
use strict;
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
use Texinfo::Convert::Utils;
@@ -63,7 +64,7 @@ $VERSION = '6.8dev';
my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
my %formatted_nobrace_commands = %Texinfo::Common::formatted_nobrace_commands;
my %formattable_line_commands = %Texinfo::Common::formattable_line_commands;
-my %brace_commands = %Texinfo::Common::brace_commands;
+my %brace_commands = %Texinfo::Commands::brace_commands;
my $NO_NUMBER_FOOTNOTE_SYMBOL = '*';
@@ -84,28 +85,29 @@ sub get_informative_global_commands($)
return @informative_global_commands;
}
-my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
my %brace_no_arg_commands;
foreach my $command (keys (%brace_commands)) {
$brace_no_arg_commands{$command} = 1
if ($brace_commands{$command} eq 'noarg');
}
-my %accent_commands = %Texinfo::Common::accent_commands;
-my %line_commands = %Texinfo::Common::line_commands;
-my %nobrace_commands = %Texinfo::Common::nobrace_commands;
-my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
-my %def_commands = %Texinfo::Common::def_commands;
-my %ref_commands = %Texinfo::Common::ref_commands;
-my %block_commands = %Texinfo::Common::block_commands;
-my %root_commands = %Texinfo::Common::root_commands;
-my %preformatted_commands = %Texinfo::Common::preformatted_commands;
-my %math_commands = %Texinfo::Common::math_commands;
+my %accent_commands = %Texinfo::Commands::accent_commands;
+my %line_commands = %Texinfo::Commands::line_commands;
+my %nobrace_commands = %Texinfo::Commands::nobrace_commands;
+my %sectioning_heading_commands =
%Texinfo::Commands::sectioning_heading_commands;
+my %def_commands = %Texinfo::Commands::def_commands;
+my %ref_commands = %Texinfo::Commands::ref_commands;
+my %block_commands = %Texinfo::Commands::block_commands;
+my %root_commands = %Texinfo::Commands::root_commands;
+my %preformatted_commands = %Texinfo::Commands::preformatted_commands;
+my %math_commands = %Texinfo::Commands::math_commands;
+my %preformatted_code_commands =
%Texinfo::Commands::preformatted_code_commands;
+my %default_index_commands = %Texinfo::Commands::default_index_commands;
+
+my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
+my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
my %explained_commands = %Texinfo::Common::explained_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %brace_code_commands = %Texinfo::Common::brace_code_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 @contents_commands = ('contents', 'shortcontents', 'summarycontents');
diff --git a/tp/Texinfo/Convert/Texinfo.pm b/tp/Texinfo/Convert/Texinfo.pm
index 0388c25978..8f1bd827c0 100644
--- a/tp/Texinfo/Convert/Texinfo.pm
+++ b/tp/Texinfo/Convert/Texinfo.pm
@@ -26,7 +26,7 @@ use strict;
use Carp qw(cluck confess);
# commands definitions
-use Texinfo::Common;
+use Texinfo::Commands;
require Exporter;
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
@@ -42,12 +42,12 @@ use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
$VERSION = '6.8dev';
-my %brace_commands = %Texinfo::Common::brace_commands;
-my %block_commands = %Texinfo::Common::block_commands;
-my %def_commands = %Texinfo::Common::def_commands;
+my %brace_commands = %Texinfo::Commands::brace_commands;
+my %block_commands = %Texinfo::Commands::block_commands;
+my %def_commands = %Texinfo::Commands::def_commands;
# used in root_heading_command_to_texinfo
-my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
+my %sectioning_heading_commands =
%Texinfo::Commands::sectioning_heading_commands;
my @ignored_types = ('spaces_inserted', 'bracketed_inserted',
'command_as_argument_inserted');
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index f063cb4072..9d0efbcffc 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -32,6 +32,7 @@ package Texinfo::Convert::TexinfoMarkup;
use 5.00405;
use strict;
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Converter;
use Texinfo::Convert::Unicode;
@@ -99,7 +100,7 @@ our %no_arg_commands_formatting = (
'guillemotright' => 'guillemotright',
);
-my %brace_commands = %Texinfo::Common::brace_commands;
+my %brace_commands = %Texinfo::Commands::brace_commands;
# use default XML formatting to complete the hash, removing XML
# specific formatting. This avoids some code duplication.
@@ -158,15 +159,15 @@ my %line_command_numbered_arguments_attributes = (
'synindex' => [ 'from', 'to' ],
);
-my %nobrace_commands = %Texinfo::Common::nobrace_commands;
-my %line_commands = %Texinfo::Common::line_commands;
+my %nobrace_commands = %Texinfo::Commands::nobrace_commands;
+my %line_commands = %Texinfo::Commands::line_commands;
foreach my $command ('item', 'headitem', 'tab') {
delete $nobrace_commands{$command};
}
foreach my $command ('item', 'itemx',
- keys %Texinfo::Common::def_commands) {
+ keys(%Texinfo::Commands::def_commands)) {
delete $line_commands{$command};
}
@@ -200,8 +201,8 @@ foreach my $explained_command
(keys(%Texinfo::Common::explained_commands)) {
"${explained_command}desc"];
}
-foreach my $brace_command (keys(%Texinfo::Common::brace_commands)) {
- if ($Texinfo::Common::brace_commands{$brace_command} eq 'inline') {
+foreach my $brace_command (keys(%Texinfo::Commands::brace_commands)) {
+ if ($Texinfo::Commands::brace_commands{$brace_command} eq 'inline') {
if ($brace_command eq 'inlinefmtifelse') {
$commands_args_elements{$brace_command} = ["${brace_command}format",
"${brace_command}contentif", "${brace_command}contentelse"];
@@ -267,8 +268,8 @@ sub converter_initialize($)
$self->{'document_context'} = [{'monospace' => [0]}];
$self->{'context_block_commands'} = {%default_context_block_commands};
- foreach my $raw (grep {$Texinfo::Common::block_commands{$_} eq 'format_raw'}
- keys(%Texinfo::Common::block_commands)) {
+ foreach my $raw (grep {$Texinfo::Commands::block_commands{$_} eq
'format_raw'}
+ keys(%Texinfo::Commands::block_commands)) {
$self->{'context_block_commands'}->{$raw} = 1
if $self->{'expanded_formats_hash'}->{$raw};
}
@@ -375,8 +376,8 @@ sub _index_entry($$)
if ($self->{'indices_information'}) {
my $in_code
=
$self->{'indices_information'}->{$index_entry->{'index_name'}}->{'in_code'};
- if (!$Texinfo::Common::index_names{$index_entry->{'index_name'}}
- or $in_code !=
$Texinfo::Common::index_names{$index_entry->{'index_name'}}->{'in_code'}) {
+ if (!$Texinfo::Commands::index_names{$index_entry->{'index_name'}}
+ or $in_code !=
$Texinfo::Commands::index_names{$index_entry->{'index_name'}}->{'in_code'}) {
push @$attribute, ['incode', $in_code];
}
if
($self->{'indices_information'}->{$index_entry->{'index_name'}}->{'merged_in'})
{
@@ -802,7 +803,7 @@ sub _convert($$;$)
}
$result .= $self->format_comment_or_return_end_line($element);
pop @{$self->{'document_context'}->[-1]->{'monospace'}};
- } elsif ($Texinfo::Common::root_commands{$cmdname}) {
+ } elsif ($Texinfo::Commands::root_commands{$cmdname}) {
my $attribute = [_leading_spaces_arg($element)];
my $level_adjusted_cmdname
=
Texinfo::Structuring::section_level_adjusted_command_name($element);
@@ -1099,7 +1100,7 @@ sub _convert($$;$)
if (Texinfo::Common::element_is_inline($element)) {
push @$attribute, ['where', 'inline'];
}
- } elsif ($Texinfo::Common::ref_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Commands::ref_commands{$element->{'cmdname'}}) {
if ($element->{'args'}) {
my $normalized;
if ($element->{'extra'}->{'node_argument'}
@@ -1153,7 +1154,7 @@ sub _convert($$;$)
push @$attribute, _leading_spaces_arg($element);
return $self->txi_markup_open_element($main_cmdname, $attribute)
.$args_or_one_arg_cmd.$self->txi_markup_close_element($main_cmdname);
- } elsif (exists($Texinfo::Common::block_commands{$element->{'cmdname'}})) {
+ } elsif
(exists($Texinfo::Commands::block_commands{$element->{'cmdname'}})) {
if ($self->{'context_block_commands'}->{$element->{'cmdname'}}) {
push @{$self->{'document_context'}}, {'monospace' => [0]};
}
@@ -1498,8 +1499,8 @@ sub _convert($$;$)
if ($element->{'contents'}) {
my $in_code;
if ($element->{'cmdname'}
- and
($Texinfo::Common::preformatted_code_commands{$element->{'cmdname'}}
- or $Texinfo::Common::math_commands{$element->{'cmdname'}})) {
+ and
($Texinfo::Commands::preformatted_code_commands{$element->{'cmdname'}}
+ or $Texinfo::Commands::math_commands{$element->{'cmdname'}})) {
$in_code = 1;
}
push @{$self->{'document_context'}->[-1]->{'monospace'}}, 1
@@ -1553,7 +1554,7 @@ sub _convert($$;$)
$result .= $self->txi_markup_close_element($format_element);
}
if ($element->{'cmdname'}
- and exists($Texinfo::Common::block_commands{$element->{'cmdname'}})) {
+ and exists($Texinfo::Commands::block_commands{$element->{'cmdname'}})) {
if ($self->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
} else {
if ($element->{'contents'} and scalar(@{$element->{'contents'}}) > 0
@@ -1575,7 +1576,7 @@ sub _convert($$;$)
and !($element->{'extra'}->{'unit_command'}->{'cmdname'}
and $element->{'extra'}->{'unit_command'}->{'cmdname'} eq
'node'))
or ($element->{'cmdname'}
- and $Texinfo::Common::root_commands{$element->{'cmdname'}}
+ and $Texinfo::Commands::root_commands{$element->{'cmdname'}}
and $element->{'cmdname'} ne 'node'
and !($element->{'structure'}->{'associated_unit'}
and
$element->{'structure'}->{'associated_unit'}->{'extra'}
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 55c5c4d578..6f3e417a6d 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -28,6 +28,7 @@ use Data::Dumper;
use Carp qw(cluck carp);
use Encode qw(decode);
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Unicode;
# for debugging
@@ -141,7 +142,7 @@ foreach my $accent_letter ('o','O','l','L') {
$sort_brace_no_arg_commands{$accent_letter} = $accent_letter;
}
-my %accent_commands = %Texinfo::Common::accent_commands;
+my %accent_commands = %Texinfo::Commands::accent_commands;
my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
# 'page' is a formatted_line_commands and therefore is replaced by an empty
line.
@@ -386,8 +387,8 @@ sub _convert($;$)
or ($ignored_block_commands{$element->{'cmdname'}}
and !(defined($options->{'expanded_formats_hash'})
and
$options->{'expanded_formats_hash'}->{$element->{'cmdname'}}))
- or ($Texinfo::Common::brace_commands{$element->{'cmdname'}}
- and
$Texinfo::Common::brace_commands{$element->{'cmdname'}} eq 'inline'
+ or ($Texinfo::Commands::brace_commands{$element->{'cmdname'}}
+ and
$Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 'inline'
and $element->{'cmdname'} ne 'inlinefmtifelse'
and
(($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
and (!$element->{'extra'}->{'format'}
@@ -495,8 +496,8 @@ sub _convert($;$)
} else {
return _convert($element->{'args'}->[0], $options);
}
- } elsif ($Texinfo::Common::brace_commands{$element->{'cmdname'}}
- and $Texinfo::Common::brace_commands{$element->{'cmdname'}} eq
'inline') {
+ } elsif ($Texinfo::Commands::brace_commands{$element->{'cmdname'}}
+ and $Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq
'inline') {
$options->{'raw'} = 1 if ($element->{'cmdname'} eq 'inlineraw');
my $arg_index = 1;
if ($element->{'cmdname'} eq 'inlinefmtifelse'
@@ -512,13 +513,13 @@ sub _convert($;$)
} elsif ($element->{'args'} and $element->{'args'}->[0]
and (($element->{'args'}->[0]->{'type'}
and $element->{'args'}->[0]->{'type'} eq 'brace_command_arg')
- or ($Texinfo::Common::math_commands{$element->{'cmdname'}}
- and
defined($Texinfo::Common::brace_commands{$element->{'cmdname'}})))) {
+ or ($Texinfo::Commands::math_commands{$element->{'cmdname'}}
+ and
defined($Texinfo::Commands::brace_commands{$element->{'cmdname'}})))) {
my $result;
my $in_code;
$options->{'sc'}++ if ($element->{'cmdname'} eq 'sc');
if ($Texinfo::Common::brace_code_commands{$element->{'cmdname'}}
- or $Texinfo::Common::math_commands{$element->{'cmdname'}}) {
+ or $Texinfo::Commands::math_commands{$element->{'cmdname'}}) {
$in_code = 1;
}
$options->{_code_options}++ if ($in_code);
@@ -551,7 +552,7 @@ sub _convert($;$)
} else {
$result = _convert($element->{'args'}->[0], $options);
}
- if
($Texinfo::Common::sectioning_heading_commands{$element->{'cmdname'}}) {
+ if
($Texinfo::Commands::sectioning_heading_commands{$element->{'cmdname'}}) {
$result = text_heading($element, $result, $options->{'converter'},
$options->{'NUMBER_SECTIONS'});
} else {
@@ -629,10 +630,10 @@ sub _convert($;$)
if ($element->{'contents'}) {
my $in_code;
if ($element->{'cmdname'}
- and
($Texinfo::Common::preformatted_code_commands{$element->{'cmdname'}}
- or $Texinfo::Common::math_commands{$element->{'cmdname'}}
- or
(defined($Texinfo::Common::block_commands{$element->{'cmdname'}})
- and $Texinfo::Common::block_commands{$element->{'cmdname'}}
eq 'raw'))) {
+ and
($Texinfo::Commands::preformatted_code_commands{$element->{'cmdname'}}
+ or $Texinfo::Commands::math_commands{$element->{'cmdname'}}
+ or
(defined($Texinfo::Commands::block_commands{$element->{'cmdname'}})
+ and $Texinfo::Commands::block_commands{$element->{'cmdname'}}
eq 'raw'))) {
$in_code = 1;
}
if (ref($element->{'contents'}) ne 'ARRAY') {
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 5697a1785a..d1053ea1a1 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -22,6 +22,7 @@ package Texinfo::Convert::TextContent;
use 5.00405;
use strict;
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Utils;
use Texinfo::Convert::Text;
@@ -130,7 +131,7 @@ sub _convert($$)
return "$Texinfo::Convert::Utils::MONTH_NAMES[$mon] $mday, $year";
} elsif
(defined($Texinfo::Convert::Text::text_brace_no_arg_commands{$element->{'cmdname'}}))
{
return Texinfo::Convert::Text::brace_no_arg_command($element, undef);
- } elsif ($Texinfo::Common::accent_commands{$element->{'cmdname'}}) {
+ } elsif ($Texinfo::Commands::accent_commands{$element->{'cmdname'}}) {
my %options =
Texinfo::Convert::Text::copy_options_for_convert_text($self);
my $result = Texinfo::Convert::Text::text_accents($element,
$options{'enabled_encoding'});
@@ -140,7 +141,7 @@ sub _convert($$)
my $result = '';
if ($element->{'args'}
and (!$element->{'cmdname'}
- or !$Texinfo::Common::blockitem_commands{$element->{'cmdname'}})) {
+ or !$Texinfo::Commands::blockitem_commands{$element->{'cmdname'}}))
{
my $args;
if ($element->{'cmdname'}
and $Texinfo::Common::inline_format_commands{$element->{'cmdname'}}) {
diff --git a/tp/Texinfo/Convert/Utils.pm b/tp/Texinfo/Convert/Utils.pm
index d55e0dc633..51b9037539 100644
--- a/tp/Texinfo/Convert/Utils.pm
+++ b/tp/Texinfo/Convert/Utils.pm
@@ -33,6 +33,7 @@ use strict;
# debugging
use Carp qw(cluck);
+use Texinfo::Commands;
use Texinfo::Common;
# only needed in debugging comments. Ok to keep it here anyway.
use Texinfo::Convert::Texinfo;
@@ -161,7 +162,7 @@ sub find_innermost_accent_contents($)
while (1) {
# the following can happen if called with a bad tree
if (!$current->{'cmdname'}
- or !$Texinfo::Common::accent_commands{$current->{'cmdname'}}) {
+ or !$Texinfo::Commands::accent_commands{$current->{'cmdname'}}) {
#print STDERR "BUG: Not an accent command in accent\n";
cluck "BUG: Not an accent command in accent\n";
#print STDERR
Texinfo::Convert::Texinfo::convert_to_texinfo($current)."\n";
@@ -183,7 +184,7 @@ sub find_innermost_accent_contents($)
if (!($content->{'cmdname'} and ($content->{'cmdname'} eq 'c'
or $content->{'cmdname'} eq
'comment'))) {
if ($content->{'cmdname'}
- and $Texinfo::Common::accent_commands{$content->{'cmdname'}}) {
+ and $Texinfo::Commands::accent_commands{$content->{'cmdname'}}) {
$current = $content;
next ACCENT;
} else {
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index 685595461c..e69dd4e7db 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -33,6 +33,8 @@ use strict;
use Carp qw(cluck confess);
+# for %root_commands
+use Texinfo::Commands;
use Texinfo::Common;
# for error messages
@@ -922,7 +924,7 @@ sub split_by_section($)
push @$tree_units, $current;
}
} elsif ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
- and $Texinfo::Common::root_commands{$content->{'cmdname'}}) {
+ and $Texinfo::Commands::root_commands{$content->{'cmdname'}}) {
if (not defined($current->{'extra'})
or not defined($current->{'extra'}->{'unit_command'})) {
#$current->{'extra'} = {} if (! $current->{'extra'});
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 7aeea6cb9c..7136dea511 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -30,6 +30,7 @@ use strict;
use Carp qw(cluck);
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Translations;
use Texinfo::Structuring;
@@ -82,7 +83,7 @@ sub fill_gaps_in_sectioning($)
my @sections_list;
foreach my $content (@{$root->{'contents'}}) {
if ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
- and $Texinfo::Common::root_commands{$content->{'cmdname'}}) {
+ and $Texinfo::Commands::root_commands{$content->{'cmdname'}}) {
push @sections_list, $content;
}
}
@@ -162,7 +163,7 @@ sub _reference_to_arg($$$)
my $current = shift;
if ($current->{'cmdname'} and
- $Texinfo::Common::ref_commands{$current->{'cmdname'}}
+ $Texinfo::Commands::ref_commands{$current->{'cmdname'}}
and $current->{'args'}) {
my @args_try_order;
if ($current->{'cmdname'} eq 'inforef') {
@@ -358,7 +359,7 @@ sub insert_nodes_for_sectioning_commands($$$$)
foreach my $content (@{$root->{'contents'}}) {
if ($content->{'cmdname'} and $content->{'cmdname'} ne 'node'
and $content->{'cmdname'} ne 'part'
- and $Texinfo::Common::root_commands{$content->{'cmdname'}}
+ and $Texinfo::Commands::root_commands{$content->{'cmdname'}}
and not ($content->{'extra'}
and $content->{'extra'}->{'associated_node'})) {
my $new_node_tree;
@@ -757,8 +758,8 @@ sub menu_to_simple_menu($)
}
}
} elsif ($content->{'cmdname'}
- and $Texinfo::Common::block_commands{$content->{'cmdname'}}
- and $Texinfo::Common::block_commands{$content->{'cmdname'}} eq 'menu') {
+ and $Texinfo::Commands::block_commands{$content->{'cmdname'}}
+ and $Texinfo::Commands::block_commands{$content->{'cmdname'}} eq 'menu') {
menu_to_simple_menu($content);
push @contents, $content;
} else {
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt
b/tp/Texinfo/XS/parsetexi/command_data.txt
index 286cd2f857..b6cba57075 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -22,6 +22,14 @@
# invalid if not accept_internalvalue set in configuration
txiinternalvalue internal,brace INTERNAL_brace
+# nobrace:
+# commands never taking braces nor arguments on the line
+#
+# symbol: non-alphabetical one letter commands without braces.
+# skipspace: following spaces are skipped.
+# other: other.
+
+
##############################################################
# no brace commands - single letter commands
@@ -48,12 +56,32 @@ txiinternalvalue internal,brace
INTERNAL_brace
# line commands
#
##########################################################
+
+# commands taking a line as argument or no argument.
+# index commands are added dynamically.
+#
+# The values signification is:
+# special: no value and macro expansion, all the line is used, and
+# analysed during parsing (_parse_special_misc_command)
+# lineraw: no value and macro expansion, the line is kept as-is, not
+# analysed
+# skipline: no argument, everything else on the line is skipped
+# text: the line is parsed as texinfo, and the argument is converted
+# to simple text (in _end_line)
+# line: the line is parsed as texinfo
+# specific: the line is parsed as texinfo and the result should be plain
+# text maybe followed by a comment; the result is analysed
+# during parsing (parse_line_command_args).
+#
+# Beware that @item may be a 'line' command or a 'nobrace' command
+# depending on the context.
+
# line commands number of arguments is only set for LINE_specific commands
# and is not used anywhere in the code, it is here as documentation only
node line LINE_line
bye line LINE_skipline
end line LINE_text
-# set, clear
+# set, clear, special argument
set line LINE_special
clear line LINE_special
unmacro line LINE_special
@@ -76,27 +104,40 @@ contents line,global
LINE_skipline
shortcontents line,global LINE_skipline
summarycontents line,global LINE_skipline
insertcopying line,global LINE_skipline
+# arg should be an @-command
clickstyle line,global LINE_special
# more relevant in preamble
documentencoding line,global LINE_text
novalidate line,global_unique LINE_skipline
+# Position with regard with direntry is significant
dircategory line LINE_line
-# with direntry is significant
+# arg like 200mm,150mm or 11.5in
pagesizes line,global_unique LINE_line
-# or one? 200mm,150mm 11.5in
finalout line LINE_skipline
-paragraphindent line,global LINE_specific 1
+# arg none asis
# or a number and forbids anything else on the line
+paragraphindent line,global LINE_specific 1
+# arg none insert
firstparagraphindent line,global LINE_specific 1
+# arg on off
frenchspacing line,global LINE_specific 1
+# arg on off
codequoteundirected line,global LINE_specific 1
+# arg on off
codequotebacktick line,global LINE_specific 1
+# arg on off
xrefautomaticsectiontitle line,global LINE_specific 1
+# arg on off
deftypefnnewline line,global LINE_specific 1
+# arg 10 11
fonttextsize line,global_unique LINE_specific 1
+# arg false or true
allowcodebreaks line,global LINE_specific 1
+# arg asis or a number
exampleindent line,global LINE_specific 1
+# args end and separate, nothing else on the line
footnotestyle line,global_unique LINE_specific 1
+# arg after|before|none
urefbreakstyle line,global LINE_specific 1
smallbook line,global_unique LINE_skipline
afourpaper line,global_unique LINE_skipline
@@ -104,8 +145,12 @@ afivepaper line,global_unique
LINE_skipline
afourlatex line,global_unique LINE_skipline
afourwide line,global_unique LINE_skipline
bsixpaper line,global_unique LINE_skipline
+# arg off on single double singleafter doubleafter
+# interacts with setchapternewpage
headings line,global LINE_specific 1
+# arg off on odd
setchapternewpage line,global_unique LINE_specific 1
+# arg on off
microtype line,global LINE_specific 1
everyheading line,global,heading_spec LINE_line
@@ -115,12 +160,18 @@ evenfooting line,global,heading_spec
LINE_line
oddheading line,global,heading_spec LINE_line
oddfooting line,global,heading_spec LINE_line
+# args are index identifiers
syncodeindex line LINE_specific 2
synindex line LINE_specific 2
+# one identifier arg
defindex line LINE_specific 1
+# one identifier arg
defcodeindex line LINE_specific 1
+# language code arg
documentlanguage line,global LINE_text
+# arg code example distinct
kbdinputstyle line,global LINE_specific 1
+# arg top bottom
everyheadingmarks line,global_unique LINE_specific 1
everyfootingmarks line,global_unique LINE_specific 1
evenheadingmarks line,global_unique LINE_specific 1
@@ -139,8 +190,10 @@ settitle line,global_unique
LINE_line
author line,global LINE_line
subtitle line,global LINE_line
title line,global_unique LINE_line
+# numerical arg
sp line LINE_specific 1
page line LINE_skipline
+# one numerical/real arg
need line LINE_specific 1
# not valid for info (should be in @iftex)
@@ -148,6 +201,7 @@ vskip line
LINE_lineraw
exdent line LINE_line
+# or nobrace skipspace, depending on the context
item_LINE line LINE_line
itemx line LINE_line
@@ -302,6 +356,11 @@ t brace
BRACE_style_code
# No code style commands
r brace BRACE_style_no_code
+# in this category, the leading and trailing spaces are put in specific
+# text with type, but commas do not delimitate arguments.
+# As other arguments brace_commands, they can only contain simple text,
+# ie not ref, footnote, titlefont, anchor, verb.
+# Parsers have specific checks for U content.
U brace BRACE_arguments 1
hyphenation brace,global,contain_plain_text BRACE_arguments 1
anchor brace BRACE_arguments 1
@@ -310,11 +369,14 @@ sortas brace,contain_plain_text
BRACE_arguments 1
seeentry brace BRACE_arguments 1
seealso brace BRACE_arguments 1
+# Leading and trailing spaces kept in main text.
+# verb is treated especially, it should not matter much in which category it
is.
+# value also is treated especially.
value brace BRACE_special
verb brace BRACE_special
w brace,contain_simple_text BRACE_special
-# other brace commands, leading and trailing spaces not ignored
+# other brace commands, leading and trailing spaces kept in main text
dmn brace,contain_plain_text BRACE_other 1
titlefont brace,global BRACE_other 1
@@ -322,6 +384,8 @@ titlefont brace,global
BRACE_other 1
footnote brace,global BRACE_context
caption brace BRACE_context
shortcaption brace BRACE_context
+# Commands that enclose math content, and, because of that, are not in the
+# main document context.
math brace,math BRACE_context
# explained commands
@@ -351,6 +415,7 @@ image brace
BRACE_arguments 5
##########################################################
+# commands delimiting blocks, with an @end.
# def* commands
deffn block,def BLOCK_def
@@ -400,7 +465,7 @@ deftypemethodx line,def,def_alias
LINE_line
multitable block,blockitem BLOCK_multitable
-# menu commands
+# menu commands in which menu entry and menu comments appear
menu block BLOCK_menu
detailmenu block,global BLOCK_menu
direntry block BLOCK_menu
diff --git a/tp/Texinfo/XS/parsetexi/commands.h
b/tp/Texinfo/XS/parsetexi/commands.h
index 888f6482e3..c787ae1436 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -50,20 +50,24 @@ void wipe_user_commands (void);
#define CF_line 0x0001
#define CF_deprecated 0x0002
+/* commands that should only appear at the root level and contain up to
+ the next root command. @node and sectioning commands. */
#define CF_root 0x0004
#define CF_sectioning_heading 0x0008
#define CF_brace 0x0010
/* CF_letter_no_arg is not used, in Common */
#define CF_letter_no_arg 0x0020
#define CF_accent 0x0040
-/* CF_math is not used, in Common */
+/* CF_math is not used, used in perl */
#define CF_math 0x0080
#define CF_variadic 0x0100
#define CF_INFOENCLOSE 0x0200
+/* in_heading_spec only valid in heading or footing specifications */
#define CF_in_heading_spec 0x0400
#define CF_ref 0x0800
#define CF_ALIAS 0x1000
#define CF_block 0x2000
+/* in_heading_spec commands are only valid in heading_spec */
#define CF_heading_spec 0x4000
/* CF_internal is not used in code, but it should be kept as internal
* commands marker */
@@ -71,6 +75,7 @@ void wipe_user_commands (void);
#define CF_global 0x00010000
#define CF_def 0x00020000
#define CF_def_alias 0x00040000
+/* only accept plain text, ie only accent, symbol and glyph commands */
#define CF_contain_plain_text 0x00080000
/* CF_align is not used */
#define CF_align 0x00100000
@@ -82,6 +87,7 @@ void wipe_user_commands (void);
/* CF_item_line is not used */
#define CF_item_line 0x02000000
#define CF_nobrace 0x04000000
+/* blockitem commands have a possible content before an item */
#define CF_blockitem 0x08000000
/* CF_inline is not used */
#define CF_inline 0x10000000
diff --git a/tp/init/book.pm b/tp/init/book.pm
index 6b171194ad..58fdbeecfd 100644
--- a/tp/init/book.pm
+++ b/tp/init/book.pm
@@ -21,6 +21,7 @@
use strict;
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
use Texinfo::Structuring;
@@ -187,7 +188,7 @@ sub book_convert_heading_command($$$$$)
.Texinfo::Convert::Texinfo::root_heading_command_to_texinfo($element)."\n"
if ($self->get_conf('DEBUG'));
my $tree_unit;
- if ($Texinfo::Common::root_commands{$element->{'cmdname'}}
+ if ($Texinfo::Commands::root_commands{$element->{'cmdname'}}
and $element->{'structure'}->{'associated_unit'}) {
$tree_unit = $element->{'structure'}->{'associated_unit'};
}
@@ -220,7 +221,7 @@ sub book_convert_heading_command($$$$$)
and @{$element->{'structure'}->{'section_childs'}}
# FIXME why not @top?
and $cmdname ne 'top'
- and $Texinfo::Common::sectioning_heading_commands{$cmdname}) {
+ and $Texinfo::Commands::sectioning_heading_commands{$cmdname}) {
$sub_toc .= $self->html_attribute_class('ul',
[$toc_numbered_mark_class]).">\n";
$sub_toc .= book_print_sub_toc($self, $element,
$element->{'structure'}->{'section_childs'}->[0]);
@@ -228,7 +229,7 @@ sub book_convert_heading_command($$$$$)
}
if ($self->get_conf('NO_TOP_NODE_OUTPUT')
- and $Texinfo::Common::root_commands{$cmdname}) {
+ and $Texinfo::Commands::root_commands{$cmdname}) {
my $in_skipped_node_top
= $self->shared_conversion_state('in_skipped_node_top', 0);
if ($cmdname eq 'node') {
@@ -276,7 +277,7 @@ sub book_convert_heading_command($$$$$)
# the section was opened before when the node was encountered
and not $element->{'extra'}->{'associated_node'}
# to avoid *heading* @-commands
- and $Texinfo::Common::root_commands{$cmdname}) {
+ and $Texinfo::Commands::root_commands{$cmdname}) {
$opening_section = $element;
$level_corrected_opening_section_cmdname = $level_corrected_cmdname;
}
@@ -348,8 +349,8 @@ sub book_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 $Texinfo::Commands::root_commands{$cmdname}
+ and $Texinfo::Commands::sectioning_heading_commands{$cmdname}) {
my $content_href = $self->command_contents_href($element, 'contents');
if ($content_href ne '') {
$heading = "<a href=\"$content_href\">$heading</a>";
@@ -385,7 +386,7 @@ sub book_convert_heading_command($$$$$)
return $result;
}
-foreach my $command (keys(%Texinfo::Common::sectioning_heading_commands),
+foreach my $command (keys(%Texinfo::Commands::sectioning_heading_commands),
'node') {
texinfo_register_command_formatting($command,
\&book_convert_heading_command);
diff --git a/tp/init/highlight_syntax.pm b/tp/init/highlight_syntax.pm
index 313ac2ae1b..c8574ea643 100644
--- a/tp/init/highlight_syntax.pm
+++ b/tp/init/highlight_syntax.pm
@@ -20,6 +20,7 @@ use strict;
use File::Spec;
+use Texinfo::Commands;
# also for __(
use Texinfo::Common;
use Texinfo::Convert::Text;
@@ -389,8 +390,8 @@ sub highlight_preformatted_command($$$$$)
# FIXME maybe add or $pre_class eq 'menu' to override
# 'menu' with 'menu-comment'?
$pre_class = $class unless ($pre_class
- and
$Texinfo::Common::preformatted_code_commands{$pre_class}
- and !($Texinfo::Common::preformatted_code_commands{$class}
+ and
$Texinfo::Commands::preformatted_code_commands{$pre_class}
+ and
!($Texinfo::Commands::preformatted_code_commands{$class}
or $class eq 'menu'));
}
$pre_class = $pre_class.'-preformatted';
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index 628656ee69..6521f0da7b 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -58,6 +58,7 @@ use Storable qw(dclone); # standard in 5.007003
use Getopt::Long qw(GetOptions);
use Locale::Messages ();
+use Texinfo::Commands;
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
use Texinfo::Config;
@@ -985,7 +986,7 @@ sub test($$)
# take the initial values to record only if there is something new
# do a copy to compare the values and not the references
- my $initial_index_names = dclone(\%Texinfo::Common::index_names);
+ my $initial_index_names = dclone(\%Texinfo::Commands::index_names);
my $tree;
if (!$test_file) {
if ($full_document) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm, tp/Texinfo/Structuring.pm, tp/Texinfo/Transformations.pm, tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h, tp/init/book.pm, tp/init/highlight_syntax.pm: use information from Texinfo::Commands, remove the corresponding hashes from Texinfo::Common. Move comments from Common.pm to command_data.txt and commands.h.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Utils.pm (definition_category_tree), tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/maintain/regenerate_commands_perl_info.pl: define %command_index in ParserNonXS.pm, not in Common.pm. Update definition_category_tree() to use directly the command names. Remove %deprecated_commands from Common.pm, do not use values of %deprecated_commands, only the keys. Generate %index_names in regenerate_commands_perl_info.pl and output code that a [...]
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm, tp/maintain/regenerate_commands_perl_info.pl: generate %commands_args_number in regenerate_commands_perl_info.pl, remove from Texinfo::Common.
- Previous by thread:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/Utils.pm (definition_category_tree), tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/maintain/regenerate_commands_perl_info.pl: define %command_index in ParserNonXS.pm, not in Common.pm. Update definition_category_tree() to use directly the command names. Remove %deprecated_commands from Common.pm, do not use values of %deprecated_commands, only the keys. Generate %index_names in regenerate_commands_perl_info.pl and output code that a [...]
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm, tp/maintain/regenerate_commands_perl_info.pl: generate %commands_args_number in regenerate_commands_perl_info.pl, remove from Texinfo::Common.
- Index(es):