[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%formatted_line_commands)
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%formatted_line_commands) (%formatted_nobrace_commands, %formattable_line_commands) (_informative_command_value), tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, util/txixml2texi.pl: remove %other_commands and %misc_commands. Split %formatted_misc_commands as %formatted_line_commands and [...] |
Date: |
Sat, 01 Oct 2022 05:17:11 -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 8443b40f02 * tp/Texinfo/Common.pm (%formatted_line_commands)
(%formatted_nobrace_commands, %formattable_line_commands)
(_informative_command_value), tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm,
tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm
(_convert), tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm,
util/txixml2texi.pl: remove %other_commands and %misc_commands. Split
%formatted_misc_commands as %format [...]
8443b40f02 is described below
commit 8443b40f026900c85224c69100534dac2ff78ab2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 1 11:17:00 2022 +0200
* tp/Texinfo/Common.pm (%formatted_line_commands)
(%formatted_nobrace_commands, %formattable_line_commands)
(_informative_command_value), tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm,
tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm
(_convert), tp/Texinfo/Convert/Text.pm,
tp/Texinfo/Convert/TextContent.pm, util/txixml2texi.pl: remove
%other_commands and %misc_commands. Split %formatted_misc_commands as
%formatted_line_commands and %formatted_nobrace_commands. Rename
%formattable_misc_commands as %formattable_line_commands. Rename
similarly other variables in converters.
* util/txixml2texi.pl: update %no_arg_commands_formatting handling
for changes in markup attributes.
---
ChangeLog | 17 +++++
tp/Texinfo/Common.pm | 128 ++++++++++++++++++++----------------
tp/Texinfo/Convert/HTML.pm | 35 +++++-----
tp/Texinfo/Convert/IXIN.pm | 26 +++++---
tp/Texinfo/Convert/LaTeX.pm | 41 +++++++-----
tp/Texinfo/Convert/Plaintext.pm | 36 ++++++----
tp/Texinfo/Convert/Texinfo.pm | 2 +-
tp/Texinfo/Convert/TexinfoMarkup.pm | 48 ++++++++------
tp/Texinfo/Convert/Text.pm | 20 +++---
tp/Texinfo/Convert/TextContent.pm | 12 ++--
util/txixml2texi.pl | 23 +++++--
11 files changed, 239 insertions(+), 149 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5246c412df..b7fc36a415 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2022-10-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (%formatted_line_commands)
+ (%formatted_nobrace_commands, %formattable_line_commands)
+ (_informative_command_value), tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm,
+ tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm
+ (_convert), tp/Texinfo/Convert/Text.pm,
+ tp/Texinfo/Convert/TextContent.pm, util/txixml2texi.pl: remove
+ %other_commands and %misc_commands. Split %formatted_misc_commands as
+ %formatted_line_commands and %formatted_nobrace_commands. Rename
+ %formattable_misc_commands as %formattable_line_commands. Rename
+ similarly other variables in converters.
+
+ * util/txixml2texi.pl: update %no_arg_commands_formatting handling
+ for changes in markup attributes.
+
2022-09-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/DocBook.pm (_convert): format separately
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 59e6ca336a..3299662fa1 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -496,12 +496,6 @@ our %nobrace_symbol_text;
'\\', '\\', # should only appear in math
);
-# commands never taking braces
-our %nobrace_commands;
-foreach my $nobrace_command (keys(%nobrace_symbol_text)) {
- $nobrace_commands{$nobrace_command} = 'symbol';
-}
-
# @-commands max number of arguments. Not set for all commands,
# in general it only matters if > 1, as commands with 0 args
# are in specific categories, and default handling of commands
@@ -618,7 +612,7 @@ our %line_commands = (
'need' => 'specific', # 1: one numerical/real arg
# formatting
'exdent' => 'line',
- 'item' => 'line', # or skipspace, depending on the context
+ '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
@@ -627,12 +621,12 @@ our %line_commands = (
$commands_args_number{'node'} = 4;
-# commands that do not take the whole line as argument
-#
-# skipspace: no argument, following spaces are skipped.
-# noarg: no argument
+# commands never taking braces nor arguments on the line
#
-my %other_commands = (
+# symbol: non-alphabetical one letter commands without braces.
+# skipspace: following spaces are skipped.
+# other: other.
+our %nobrace_commands = (
# formatting
'noindent' => 'skipspace',
'indent' => 'skipspace',
@@ -642,6 +636,10 @@ my %other_commands = (
'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',
@@ -649,11 +647,7 @@ foreach my $in_heading_command ('thischapter',
'thischaptername',
'thisfile', 'thispage', 'thistitle') {
$in_heading_spec_commands{$in_heading_command} = 1;
- $other_commands{$in_heading_command} = 'other';
-}
-
-foreach my $nobrace_command (keys(%other_commands)) {
- $nobrace_commands{$nobrace_command} = $other_commands{$nobrace_command};
+ $nobrace_commands{$in_heading_command} = 'other';
}
# %in_heading_spec_commands and @| are only valid in the following @-commands
@@ -1140,35 +1134,38 @@ foreach my $sectioning_command (keys
(%command_structuring_level)) {
}
-# misc commands which arguments may be formatted as text.
+# line commands which arguments may be formatted as text.
# index commands may be too, but index command may be added with
# @def*index so they are not added here.
-our %formatted_misc_commands;
-foreach my $formatted_misc_command ('center', 'page',
- 'author', 'subtitle', 'title', 'exdent', 'headitem', 'item',
- 'itemx', 'tab', 'node', keys(%sectioning_heading_commands)) {
- $formatted_misc_commands{$formatted_misc_command} = 1;
-}
-
-# misc commands which may be formatted as text, but that
-# require constructing some replacement text
-# depending on the case, @contents, @shortcontents and
-# @summarycontents may be formattable_misc_commands too.
-# Since they already are global commands they are not in the
-# default formattable_misc_commands.
-our %formattable_misc_commands;
-foreach my $formattable_misc_command ('insertcopying',
+our %formatted_line_commands;
+foreach my $formatted_line_command ('center', 'page',
+ 'author', 'subtitle', 'title', 'exdent', 'item', 'itemx',
+ 'node', keys(%sectioning_heading_commands)) {
+ $formatted_line_commands{$formatted_line_command} = 1;
+}
+
+our %formatted_nobrace_commands;
+foreach my $formatted_command ('headitem', 'item', 'tab',
+ keys(%nobrace_symbol_text)) {
+ $formatted_nobrace_commands{$formatted_command} = 1;
+}
+
+# line commands which may be formatted as text, but that
+# require constructing some replacement text.
+# Depending on the case, @contents, @shortcontents and
+# @summarycontents may be formattable_line_commands too, but
+# they are global commands and are, in general, processed as such in
+# converters, so they are not put in formattable_line_commands.
+our %formattable_line_commands;
+foreach my $formattable_line_command ('insertcopying',
'printindex', 'listoffloats', 'need', 'sp', 'verbatiminclude',
'vskip') {
- $formattable_misc_commands{$formattable_misc_command} = 1;
+ $formattable_line_commands{$formattable_line_command} = 1;
}
-# used in converters, not in the parser
-our %misc_commands = (%line_commands, %other_commands);
-
$root_commands{'node'} = 1;
-# Not used, kept here as documenation.
+# 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;
@@ -1176,8 +1173,8 @@ our %internal_commands;
'txiinternalvalue' => 'brace',
);
-# The internal commands are not in %all_commands, which includes user-settable
-# commands only.
+# %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 (
@@ -1195,13 +1192,15 @@ foreach my $preamble_command ('direnty', 'hyphenation',
'errormsg',
'inlineraw', '*', keys(%document_settable_at_commands),
(grep {$block_commands{$_} eq 'format_raw'} keys(%block_commands)),
keys(%inline_format_commands), keys(%inline_conditional_commands),
- keys(%unformatted_block_commands), keys(%misc_commands),
+ keys(%unformatted_block_commands), keys(%line_commands),
+ keys(%nobrace_commands),
keys(%region_commands)) {
$preamble_commands{$preamble_command} = 1;
}
foreach my $formattable_or_formatted_misc_command (
- keys(%formattable_misc_commands), keys(%formatted_misc_commands),
+ keys(%formattable_line_commands), keys(%formatted_line_commands),
+ keys(%formatted_nobrace_commands),
keys(%default_index_commands), keys(%in_heading_spec_commands),
keys(%def_commands)) {
delete $preamble_commands{$formattable_or_formatted_misc_command};
@@ -1687,7 +1686,7 @@ sub _informative_command_value($)
my $cmdname = $element->{'cmdname'};
- if ($misc_commands{$cmdname} eq 'skipline') {
+ if ($line_commands{$cmdname} eq 'skipline') {
return 1;
} elsif (exists($element->{'extra'}->{'text_arg'})) {
return $element->{'extra'}->{'text_arg'};
@@ -1899,9 +1898,15 @@ sub is_content_empty($;$)
next;
}
}
- if (exists($misc_commands{$content->{'cmdname'}})) {
- if ($formatted_misc_commands{$content->{'cmdname'}}
- or $formattable_misc_commands{$content->{'cmdname'}}) {
+ if (exists($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'}})) {
+ if ($formatted_nobrace_commands{$content->{'cmdname'}}) {
return 0;
} else {
next;
@@ -3121,20 +3126,33 @@ X<C<%math_commands>>
@-commands which contains math, like C<@math> or C<@displaymath>.
-=item %misc_commands
-X<C<%misc_commands>>
+=item %line_commands
+X<C<%line_commands>>
+
+Command that do not take braces, take arguments on the command line and are
+not block commands either, like C<@node>, C<@chapter>, C<@cindex>, C<@deffnx>,
+C<@end>, C<@footnotestyle>, C<@set>, C<@settitle>, C<@itemx>,
+C<@definfoenclose>, C<@comment> and many others.
+
+Note that C<@item> is in C<%line_commands> for its role in C<@table> and
+similar @-commands.
+
+=item %nobrace_commands
+X<C<%nobrace_commands>>
+
+Command that do not take braces, do not have argument on their line and
+are not block commands either. The value is I<symbol> for single character
+non-alphabetical @-commands such as C<@@>, C<@ > or @C<@:>. Other commands in
that hash
+include C<@indent>, C<@tab> or C<@thissection>.
-Command that do not take braces and are not block commands either, like
-C<@node>, C<@chapter>, C<@cindex>, C<@deffnx>, C<@end>, C<@footnotestyle>,
-C<@set>, C<@settitle>, C<@indent>, C<@definfoenclose>, C<@comment> and many
-others.
+Note that C<@item> is in C<%nobrace_commands> for its role in C<@multitable>,
+C<@itemize> and C<@enumerate>.
=item %nobrace_symbol_text
X<C<%nobrace_symbol_text>>
-Commands without brace with a single character as name, like C<*>
-or C<:>. The value is an ASCII representation of the command. It
-may be an empty string.
+Values are ASCII representation of single character non-alphabetical commands
+without brace such as C<*> or C<:>. The value may be an empty string.
=item %preformatted_commands
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 646aab31e5..60526549b9 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -94,13 +94,13 @@ sub import {
# misc commands that are of use for formatting.
-my %formatted_misc_commands = %Texinfo::Common::formatted_misc_commands;
-my %formattable_misc_commands = %Texinfo::Common::formattable_misc_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 %misc_commands = %Texinfo::Common::misc_commands;
my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
my %def_commands = %Texinfo::Common::def_commands;
my %ref_commands = %Texinfo::Common::ref_commands;
@@ -121,7 +121,7 @@ my %letter_no_arg_commands =
%Texinfo::Common::letter_no_arg_commands;
my %small_block_associated_command =
%Texinfo::Common::small_block_associated_command;
foreach my $def_command (keys(%def_commands)) {
- $formatted_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
+ $formatted_line_commands{$def_command} = 1 if ($line_commands{$def_command});
}
# FIXME remove raw commands?
@@ -2204,26 +2204,31 @@ sub _noticed_line_warn($$$)
return $self->line_warn($self, $text, $line_nr);
}
-my %kept_misc_commands;
+my %kept_line_commands;
my @informative_global_commands = ('documentlanguage', 'footnotestyle',
'xrefautomaticsectiontitle', 'deftypefnnewline');
my @contents_commands = ('contents', 'shortcontents', 'summarycontents');
-foreach my $misc_command (@informative_global_commands,
- @contents_commands, keys(%formattable_misc_commands),
- keys(%formatted_misc_commands),
+foreach my $line_command (@informative_global_commands,
+ @contents_commands, keys(%formattable_line_commands),
+ keys(%formatted_line_commands),
keys(%default_index_commands)) {
- $kept_misc_commands{$misc_command} = 1;
+ $kept_line_commands{$line_command} = 1;
}
-foreach my $misc_command (keys(%misc_commands)) {
- $default_commands_conversion{$misc_command} = undef
- unless ($kept_misc_commands{$misc_command});
+foreach my $line_command (keys(%line_commands)) {
+ $default_commands_conversion{$line_command} = undef
+ unless ($kept_line_commands{$line_command});
}
-# formatted/formattable @-commands that are not of converted in
+foreach my $nobrace_command (keys(%nobrace_commands)) {
+ $default_commands_conversion{$nobrace_command} = undef
+ unless ($formatted_nobrace_commands{$nobrace_command});
+}
+
+# formatted/formattable @-commands that are not converted in
# HTML in the default case.
$default_commands_conversion{'page'} = undef;
$default_commands_conversion{'need'} = undef;
@@ -10200,8 +10205,8 @@ sub _convert($$;$)
}
my $args_formatted;
if ($brace_commands{$command_name}
- or ($misc_commands{$command_name}
- and $misc_commands{$command_name} eq 'line')
+ or ($line_commands{$command_name}
+ and $line_commands{$command_name} eq 'line')
or (($command_name eq 'item' or $command_name eq 'itemx')
and ($element->{'parent'}->{'type'}
and $element->{'parent'}->{'type'} eq 'table_term'))
diff --git a/tp/Texinfo/Convert/IXIN.pm b/tp/Texinfo/Convert/IXIN.pm
index 47fc0c0947..ce90f6ad72 100644
--- a/tp/Texinfo/Convert/IXIN.pm
+++ b/tp/Texinfo/Convert/IXIN.pm
@@ -86,17 +86,19 @@ sub _ixin_version($)
}
my %additional_setting_commands;
-# FIXME pagesizes is line
+# those commands are not line specific global/global_unique commands
+# but are considered to be settings.
+# FIXME some seem to be missing, 'smallbook', 'afourpaper', 'afivepaper',
+# 'afourlatex', 'afourwide', 'bsixpaper'
foreach my $command ('pagesizes', 'everyheading', 'everyfooting',
'evenheading', 'evenfooting', 'oddheading', 'oddfooting',
'documentencoding', 'documentlanguage', 'clickstyle') {
$additional_setting_commands{$command} = 1;
}
-# Here are all the commands that are misc_commands with type matching \d
-# and are also global_unique_commands/global_multiple_commands
-# but are not setting commands.
-my %global_misc_not_setting_commands = (
+# Here are all the line specific global/global_unique commands
+# that are not setting commands.
+my %global_line_not_setting_commands = (
'printindex' => 1,
);
@@ -399,10 +401,10 @@ 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::misc_commands{$global_command}
- and $Texinfo::Common::misc_commands{$global_command} =~ /^\d/)
+ if ((($Texinfo::Common::line_commands{$global_command}
+ and $Texinfo::Common::line_commands{$global_command} eq 'specific')
or $additional_setting_commands{$global_command})
- and !$global_misc_not_setting_commands{$global_command}) {
+ and !$global_line_not_setting_commands{$global_command}) {
if (ref($self->{'global_commands'}->{$global_command}) eq 'ARRAY') {
if
(defined($Texinfo::Common::document_settable_multiple_at_commands{$global_command}))
{
$setting_commands_defaults{$global_command}
@@ -454,7 +456,9 @@ sub output_ixin($$)
$result .= $self->ixin_open_element('setting');
$result .= $self->ixin_symbol_element('settingname', $command_name);
$result .= ' ';
- if ($Texinfo::Common::misc_commands{$command_name} eq 'lineraw') {
+ # 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') {
$result .= $self->ixin_list_element('settingvalue',
[['value', $settings{$command_name}]]);
} else {
@@ -558,7 +562,9 @@ sub output_ixin($$)
$nodes_index .= $self->ixin_open_element('nodetweak');
$nodes_index .= $self->ixin_symbol_element('nodetweakname',
$command_name);
$nodes_index .= ' ';
- if ($Texinfo::Common::misc_commands{$command_name} eq 'lineraw') {
+ # FIXME Probably not the right line type, lineraw commands are c,
+ # comment and vskip.
+ if ($Texinfo::Common::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 8c1b1aea9d..fc752b10c7 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -198,9 +198,10 @@ $VERSION = '6.8dev';
# could export convert_to_latex_math
-# misc commands that are of use for formatting.
-my %formatted_misc_commands = %Texinfo::Common::formatted_misc_commands;
-my %formattable_misc_commands = %Texinfo::Common::formattable_misc_commands;
+# commands that are of use for formatting.
+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 %paper_geometry_commands = (
'afourpaper' => 'papername=a4paper',
@@ -223,7 +224,8 @@ foreach my $command (keys
(%Texinfo::Common::brace_commands)) {
if ($Texinfo::Common::brace_commands{$command} eq 'noarg');
}
my %accent_commands = %Texinfo::Common::accent_commands;
-my %misc_commands = %Texinfo::Common::misc_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;
@@ -244,15 +246,18 @@ my %unformatted_brace_command =
%Texinfo::Common::unformatted_brace_command;
my %preamble_commands = %Texinfo::Common::preamble_commands;
foreach my $kept_command (keys(%informative_commands),
- keys(%default_index_commands),
- keys(%in_heading_spec_commands),
- keys(%formattable_misc_commands),
- 'indent', 'noindent') {
- $formatted_misc_commands{$kept_command} = 1;
+ keys(%default_index_commands),
+ keys(%formattable_line_commands)) {
+ $formatted_line_commands{$kept_command} = 1;
}
foreach my $def_command (keys(%def_commands)) {
- $formatted_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
+ $formatted_line_commands{$def_command} = 1 if ($line_commands{$def_command});
+}
+
+foreach my $kept_command (keys(%in_heading_spec_commands),
+ 'indent', 'noindent') {
+ $formatted_nobrace_commands{$kept_command} = 1;
}
# There are stacks that define the context.
@@ -269,10 +274,16 @@ foreach my $block_math_command (keys(%math_commands)) {
}
}
-my %ignored_misc_commands;
-foreach my $misc_command (keys(%misc_commands)) {
- $ignored_misc_commands{$misc_command} = 1
- unless ($formatted_misc_commands{$misc_command});
+my %ignored_line_commands;
+foreach my $line_command (keys(%line_commands)) {
+ $ignored_line_commands{$line_command} = 1
+ unless ($formatted_line_commands{$line_command});
+}
+
+my %ignored_nobrace_commands;
+foreach my $nobrace_command (keys(%nobrace_commands)) {
+ $ignored_nobrace_commands{$nobrace_command} = 1
+ unless ($formatted_nobrace_commands{$nobrace_command});
}
# from \def\Gin@extensions in graphics-def/pdftex.def
@@ -460,7 +471,7 @@ my %LaTeX_in_heading_spec_commands = (
'thistitle' => '\GNUTexinfosettitle{}',
);
-my %ignored_commands = %ignored_misc_commands;
+my %ignored_commands = (%ignored_line_commands, %ignored_nobrace_commands);
# processed as part of the index command or type formatting
foreach my $ignored_brace_commands (
'sortas', 'seeentry', 'seealso') {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 7e22972245..a3cda7eb74 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -59,9 +59,10 @@ sub import {
$VERSION = '6.8dev';
-# misc commands that are of use for formatting.
-my %formatted_misc_commands = %Texinfo::Common::formatted_misc_commands;
-my %formattable_misc_commands = %Texinfo::Common::formattable_misc_commands;
+# commands that are of use for formatting.
+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;
@@ -90,7 +91,8 @@ foreach my $command (keys (%brace_commands)) {
if ($brace_commands{$command} eq 'noarg');
}
my %accent_commands = %Texinfo::Common::accent_commands;
-my %misc_commands = %Texinfo::Common::misc_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;
@@ -108,18 +110,18 @@ my %letter_no_arg_commands =
%Texinfo::Common::letter_no_arg_commands;
my @contents_commands = ('contents', 'shortcontents', 'summarycontents');
foreach my $kept_command (keys (%informative_commands), @contents_commands,
- keys (%default_index_commands), keys(%formattable_misc_commands)) {
- $formatted_misc_commands{$kept_command} = 1;
+ keys (%default_index_commands), keys(%formattable_line_commands)) {
+ $formatted_line_commands{$kept_command} = 1;
}
# formatted/formattable @-commands not formatted in Plaintext/Info
-foreach my $non_formatted_misc_command ('page', 'need', 'vskip',
+foreach my $non_formatted_line_command ('page', 'need', 'vskip',
'author', 'subtitle', 'title') {
- delete $formatted_misc_commands{$non_formatted_misc_command};
+ delete $formatted_line_commands{$non_formatted_line_command};
}
foreach my $def_command (keys(%def_commands)) {
- $formatted_misc_commands{$def_command} = 1 if ($misc_commands{$def_command});
+ $formatted_line_commands{$def_command} = 1 if ($line_commands{$def_command});
}
# There are 6 stacks that define the context.
@@ -181,13 +183,19 @@ foreach my $block_math_command (keys(%math_commands)) {
}
}
-my %ignored_misc_commands;
-foreach my $misc_command (keys(%misc_commands)) {
- $ignored_misc_commands{$misc_command} = 1
- unless ($formatted_misc_commands{$misc_command});
+my %ignored_line_commands;
+foreach my $line_command (keys(%line_commands)) {
+ $ignored_line_commands{$line_command} = 1
+ unless ($formatted_line_commands{$line_command});
}
-my %ignored_commands = %ignored_misc_commands;
+my %ignored_nobrace_commands;
+foreach my $nobrace_command (keys(%nobrace_commands)) {
+ $ignored_nobrace_commands{$nobrace_command} = 1
+ unless ($formatted_nobrace_commands{$nobrace_command});
+}
+
+my %ignored_commands = (%ignored_line_commands, %ignored_nobrace_commands);
foreach my $ignored_brace_commands ('caption', 'shortcaption',
'hyphenation', 'sortas') {
$ignored_commands{$ignored_brace_commands} = 1;
diff --git a/tp/Texinfo/Convert/Texinfo.pm b/tp/Texinfo/Convert/Texinfo.pm
index 30d8005381..0388c25978 100644
--- a/tp/Texinfo/Convert/Texinfo.pm
+++ b/tp/Texinfo/Convert/Texinfo.pm
@@ -175,7 +175,7 @@ sub _expand_cmd_args_to_texi($;$) {
foreach my $arg (@{$cmd->{'args'}}) {
$result .= convert_to_texinfo($arg, $expand_replaced);
}
- # for misc_commands with type special
+ # arg_line set for line_commands with type special
} elsif (($cmd->{'extra'} or $cmdname eq 'macro' or $cmdname eq 'rmacro')
and defined($cmd->{'extra'}->{'arg_line'})) {
$result .= $cmd->{'extra'}->{'spaces_before_argument'}
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 767991adfc..d438788f3f 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -144,25 +144,30 @@ foreach my $accent (@other_accents) {
$accent_types{$accent} = $accent;
}
-my %misc_command_line_attributes = (
+my %line_command_line_attributes = (
'setfilename' => 'file',
'documentencoding' => 'encoding',
'verbatiminclude' => 'file',
'documentlanguage' => 'lang',
);
-my %misc_command_numbered_arguments_attributes = (
+my %line_command_numbered_arguments_attributes = (
'definfoenclose' => [ 'command', 'open', 'close' ],
'alias' => [ 'new', 'existing' ],
'syncodeindex' => [ 'from', 'to' ],
'synindex' => [ 'from', 'to' ],
);
-my %misc_commands = %Texinfo::Common::misc_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
+my %line_commands = %Texinfo::Common::line_commands;
-foreach my $command ('item', 'headitem', 'itemx', 'tab',
+foreach my $command ('item', 'headitem', 'tab') {
+ delete $nobrace_commands{$command};
+}
+
+foreach my $command ('item', 'itemx',
keys %Texinfo::Common::def_commands) {
- delete $misc_commands{$command};
+ delete $line_commands{$command};
}
my %default_args_code_style
@@ -699,7 +704,7 @@ sub _convert($$;$)
} elsif ($element->{'type'} and $element->{'type'} eq
'index_entry_command') {
my $format_element;
my $attribute = [];
- if (exists $Texinfo::Common::misc_commands{$element->{'cmdname'}}) {
+ if (exists $line_commands{$element->{'cmdname'}}) {
$format_element = $element->{'cmdname'};
} else {
$format_element = 'indexcommand';
@@ -714,15 +719,15 @@ sub _convert($$;$)
.$self->_index_entry($element)
.$self->txi_markup_close_element($format_element)
.${end_line};
- } elsif (exists($misc_commands{$element->{'cmdname'}})) {
+ } elsif (exists($line_commands{$element->{'cmdname'}})) {
my $cmdname = $element->{'cmdname'};
- my $type = $misc_commands{$cmdname};
+ my $type = $line_commands{$cmdname};
if ($type eq 'text') {
return '' if ($cmdname eq 'end');
my $attribute;
- if ($misc_command_line_attributes{$cmdname}) {
+ if ($line_command_line_attributes{$cmdname}) {
if ($element->{'extra'} and
defined($element->{'extra'}->{'text_arg'})) {
- push @$attribute, [$misc_command_line_attributes{$cmdname},
+ push @$attribute, [$line_command_line_attributes{$cmdname},
$element->{'extra'}->{'text_arg'}];
}
}
@@ -850,13 +855,6 @@ sub _convert($$;$)
}
return $self->txi_markup_open_element($cmdname, $attribute)
.$self->txi_markup_close_element($cmdname)."\n";
- } elsif ($type eq 'other' or $type eq 'skipspace') {
- my $spaces = '';
- $spaces = $element->{'extra'}->{'spaces_after_command'}
- if ($element->{'extra'} and
$element->{'extra'}->{'spaces_after_command'}
- and $element->{'extra'}->{'spaces_after_command'} ne '');
- return $self->txi_markup_open_element($cmdname)
- .$self->txi_markup_close_element($cmdname).$spaces;
} elsif ($type eq 'special') {
if ($cmdname eq 'clear' or $cmdname eq 'set') {
my $attribute = [];
@@ -912,11 +910,11 @@ sub _convert($$;$)
.$self->txi_markup_close_element($cmdname)."\n";
}
} else {
- print STDERR "BUG: unknown misc_command style $type\n"
+ print STDERR "BUG: unknown line_command style $type\n"
if ($type ne 'specific');
my $args_attributes;
- if ($misc_command_numbered_arguments_attributes{$cmdname}) {
- $args_attributes =
$misc_command_numbered_arguments_attributes{$cmdname};
+ if ($line_command_numbered_arguments_attributes{$cmdname}) {
+ $args_attributes =
$line_command_numbered_arguments_attributes{$cmdname};
} else {
$args_attributes = ['value'];
}
@@ -939,6 +937,16 @@ sub _convert($$;$)
return $self->txi_markup_open_element($cmdname, $attribute)
.$self->txi_markup_close_element($cmdname).$end_line;
}
+ } elsif (exists($nobrace_commands{$element->{'cmdname'}})) {
+ # other or skipspace, symbol commands should be selected above
+ # as being in no_arg_commands_formatting
+ my $cmdname = $element->{'cmdname'};
+ my $spaces = '';
+ $spaces = $element->{'extra'}->{'spaces_after_command'}
+ if ($element->{'extra'} and
$element->{'extra'}->{'spaces_after_command'}
+ and $element->{'extra'}->{'spaces_after_command'} ne '');
+ return $self->txi_markup_open_element($cmdname)
+ .$self->txi_markup_close_element($cmdname).$spaces;
} elsif ($element->{'type'}
and $element->{'type'} eq 'definfoenclose_command') {
my $in_monospace_not_normal;
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 896c93c14d..55c5c4d578 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -143,12 +143,12 @@ foreach my $accent_letter ('o','O','l','L') {
my %accent_commands = %Texinfo::Common::accent_commands;
my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
-my %formatted_misc_commands = %Texinfo::Common::formatted_misc_commands;
-# 'page' is a formatted_misc_commands and therefore is replaced by an empty
line.
+my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
+# 'page' is a formatted_line_commands and therefore is replaced by an empty
line.
-my %formattable_misc_commands;
+my %converted_formattable_line_commands;
foreach my $command ('verbatiminclude', 'sp') {
- $formattable_misc_commands{$command} = 1;
+ $converted_formattable_line_commands{$command} = 1;
}
my %ignored_types;
@@ -394,13 +394,13 @@ sub _convert($;$)
or
!$options->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
or
(!$Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
and
!defined($element->{'extra'}->{'expand_index'}))))
- # here ignore most of the misc commands
+ # here ignore most of the line commands
or ($element->{'args'} and $element->{'args'}->[0]
and $element->{'args'}->[0]->{'type'}
and ($element->{'args'}->[0]->{'type'} eq 'line_arg'
or $element->{'args'}->[0]->{'type'} eq 'misc_arg')
- and !$formatted_misc_commands{$element->{'cmdname'}}
- and
!$formattable_misc_commands{$element->{'cmdname'}})))));
+ and !$formatted_line_commands{$element->{'cmdname'}}
+ and
!$converted_formattable_line_commands{$element->{'cmdname'}})))));
my $result = '';
if (defined($element->{'text'})) {
if ($element->{'type'} and $element->{'type'} eq 'untranslated'
@@ -543,7 +543,8 @@ sub _convert($;$)
}
} elsif ($options->{'expanded_formats_hash'}->{$element->{'cmdname'}}) {
$options->{'raw'} = 1;
- } elsif ($formatted_misc_commands{$element->{'cmdname'}} and
$element->{'args'}) {
+ } elsif ($formatted_line_commands{$element->{'cmdname'}}
+ and $element->{'args'}) {
if ($element->{'cmdname'} ne 'node') {
if ($element->{'cmdname'} eq 'page') {
$result = '';
@@ -559,7 +560,8 @@ sub _convert($;$)
$result .= "\n";
}
}
- } elsif ($formattable_misc_commands{$element->{'cmdname'}} and
$element->{'args'}) {
+ } elsif ($converted_formattable_line_commands{$element->{'cmdname'}}
+ and $element->{'args'}) {
if ($element->{'cmdname'} eq 'sp') {
if ($element->{'extra'} and $element->{'extra'}->{'misc_args'}
and $element->{'extra'}->{'misc_args'}->[0]) {
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 0061fe6f0f..5697a1785a 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -66,11 +66,11 @@ sub converter_initialize($)
{
my $self = shift;
- %{$self->{'formatted_misc_commands'}}
- = %Texinfo::Common::formatted_misc_commands;
+ %{$self->{'formatted_line_commands'}}
+ = %Texinfo::Common::formatted_line_commands;
if ($self->get_conf('TEXTCONTENT_COMMENT')) {
- $self->{'formatted_misc_commands'}->{'c'} = 1;
- $self->{'formatted_misc_commands'}->{'comment'} = 1;
+ $self->{'formatted_line_commands'}->{'c'} = 1;
+ $self->{'formatted_line_commands'}->{'comment'} = 1;
}
}
@@ -108,12 +108,12 @@ sub _convert($$)
and (!$element->{'extra'}->{'format'}
or
!$self->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
or ($element->{'cmdname'} eq 'menu' and
$self->get_conf('FORMAT_MENU') eq 'nomenu')
- # here ignore most of the misc commands
+ # here ignore most of the line commands
or ($element->{'args'} and $element->{'args'}->[0]
and $element->{'args'}->[0]->{'type'}
and ($element->{'args'}->[0]->{'type'} eq 'line_arg'
or $element->{'args'}->[0]->{'type'} eq 'misc_arg')
- and
!$self->{'formatted_misc_commands'}->{$element->{'cmdname'}})))));
+ and
!$self->{'formatted_line_commands'}->{$element->{'cmdname'}})))));
if (defined($element->{'text'})) {
return $element->{'text'};
}
diff --git a/util/txixml2texi.pl b/util/txixml2texi.pl
index e4fe049dc4..1908fb63cd 100755
--- a/util/txixml2texi.pl
+++ b/util/txixml2texi.pl
@@ -16,6 +16,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# FIXME space missing for comands like printindex. Space before subentry
+# missing.
#
# Original author: Patrice Dumas <pertusus@free.fr>
@@ -113,7 +116,15 @@ my %elements_end_attributes = (
'menutitle' => 1,
);
+# keys are markup elements. If the element is associated to one @-command
+# only, the value is a string, the corresponding @-command formatted.
+# If the element is associated to more than one element, the value is a
+# hash to select the command based on an attribute value. They key of the
+# hash attribute is an attribute name and the value is another hash
+# reference which associates an attribute value to the formatted @-command
+# string.
my %element_at_commands;
+# entities not associated to @-commands
my %entity_texts = (
'textldquo' => '``',
'textrdquo' => "''",
@@ -127,6 +138,7 @@ my %entity_texts = (
'attrformfeed' => "\f",
);
+# contains nobrace symbol and brace noarg commands
my %no_arg_commands_formatting
= %Texinfo::Convert::TexinfoMarkup::no_arg_commands_formatting;
@@ -138,8 +150,8 @@ foreach my $command (keys(%no_arg_commands_formatting)) {
my $spec = $no_arg_commands_formatting{$command};
my $element = $spec->[0];
if ($element eq 'spacecmd') {
- if ($spec->[1] eq 'type') {
- $element_at_commands{$element}->{"type"}->{$spec->[2]}
+ if ($spec->[1]->[0] eq 'type') {
+ $element_at_commands{$element}->{"type"}->{$spec->[1]->[1]}
= command_with_braces($command);
} else {
die "BUG, bad spacecmd specification";
@@ -150,6 +162,7 @@ foreach my $command (keys(%no_arg_commands_formatting)) {
}
}
+# FIXME select based on element name
$element_at_commands{'accent'} = 0;
my %arg_elements;
@@ -295,7 +308,8 @@ while ($reader->read) {
}
print "\n";
}
- } elsif (defined($Texinfo::Common::misc_commands{$name})) {
+ } elsif (defined($Texinfo::Common::line_commands{$name})
+ or defined($Texinfo::Common::nobrace_commands{$name})) {
if ($reader->hasAttributes()
and defined($reader->getAttribute('originalcommand'))) {
$name = $reader->getAttribute('originalcommand');
@@ -412,7 +426,8 @@ while ($reader->read) {
}
$end_spaces = ' ' if (!defined($end_spaces) or $end_spaces eq '');
print "\@end".$end_spaces."$name";
- } elsif (defined($Texinfo::Common::misc_commands{$name})) {
+ } elsif (defined($Texinfo::Common::line_commands{$name})
+ or defined($Texinfo::Common::nobrace_commands{$name})) {
if ($Texinfo::Common::root_commands{$name} and $name ne 'node') {
$eat_space = 1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%formatted_line_commands) (%formatted_nobrace_commands, %formattable_line_commands) (_informative_command_value), tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/IXIN.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, util/txixml2texi.pl: remove %other_commands and %misc_commands. Split %formatted_misc_commands as %formatted_line_commands and [...],
Patrice Dumas <=