[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (%nobrace_commands), tp/Te
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (%nobrace_commands), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/NodeNameNormalization.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename %no_brace_commands as %nobrace_commands to be more in line with XS parser. |
Date: |
Mon, 26 Sep 2022 15:49:31 -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 8abe964b48 * tp/Texinfo/Common.pm (%nobrace_commands),
tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/Convert/NodeNameNormalization.pm, tp/Texinfo/Convert/Text.pm,
tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename
%no_brace_commands as %nobrace_commands to be more in line with XS parser.
8abe964b48 is described below
commit 8abe964b484b4218528c0be580f472765da7ac12
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 26 21:47:25 2022 +0200
* tp/Texinfo/Common.pm (%nobrace_commands),
tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/Convert/NodeNameNormalization.pm,
tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm,
tp/Texinfo/ParserNonXS.pm: rename %no_brace_commands as
%nobrace_commands to be more in line with XS parser.
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm
(@all_style_commands, _convert), tp/Texinfo/Convert/HTML.pm
(@all_style_commands, _convert), tp/Texinfo/Convert/Plaintext.pm
(_convert), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): remove
%style_commands and %regular_font_style_commands, use %brace_commands
values instead.
* tp/Texinfo/Common.pm (%brace_code_commands),
tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/Convert/Text.pm: rename %code_style_commands as
%brace_code_commands.
* tp/Texinfo/Convert/NodeNameNormalization.pm: change in spacing.
---
ChangeLog | 25 +++++++++++++++
tp/TODO | 3 ++
tp/Texinfo/Common.pm | 49 +++++++++--------------------
tp/Texinfo/Convert/Converter.pm | 6 ++--
tp/Texinfo/Convert/DocBook.pm | 24 ++++++++------
tp/Texinfo/Convert/HTML.pm | 45 ++++++++++++++------------
tp/Texinfo/Convert/LaTeX.pm | 15 +++++----
tp/Texinfo/Convert/NodeNameNormalization.pm | 26 +++++++--------
tp/Texinfo/Convert/Plaintext.pm | 34 ++++++++++----------
tp/Texinfo/Convert/TexinfoMarkup.pm | 14 ++++++---
tp/Texinfo/Convert/Text.pm | 8 ++---
tp/Texinfo/Convert/TextContent.pm | 4 +--
tp/Texinfo/ParserNonXS.pm | 9 +++---
13 files changed, 142 insertions(+), 120 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7a64db615e..782fb2cdcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,31 @@
(\microtypeON, \microtypeOFF): Switch on or off character
protrusion.
+2022-09-26 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (%nobrace_commands),
+ tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/Convert/NodeNameNormalization.pm,
+ tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm,
+ tp/Texinfo/ParserNonXS.pm: rename %no_brace_commands as
+ %nobrace_commands to be more in line with XS parser.
+
+ * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm
+ (@all_style_commands, _convert), tp/Texinfo/Convert/HTML.pm
+ (@all_style_commands, _convert), tp/Texinfo/Convert/Plaintext.pm
+ (_convert), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): remove
+ %style_commands and %regular_font_style_commands, use %brace_commands
+ values instead.
+
+ * tp/Texinfo/Common.pm (%brace_code_commands),
+ tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/Convert/Text.pm: rename %code_style_commands as
+ %brace_code_commands.
+
+ * tp/Texinfo/Convert/NodeNameNormalization.pm: change in spacing.
+
2022-09-26 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm (%blockitem_commands),
diff --git a/tp/TODO b/tp/TODO
index 61bdd0d981..453fd0a938 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,6 +10,9 @@ This is the todo list for texi2any
Before next release
===================
+global_unique document_settable_unique_at_commands
+global document_settable_multiple_at_commands
+
Bugs
====
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index fdbbe144cc..d5c60a6182 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -474,8 +474,8 @@ sub valid_tree_transformation ($)
# @-commands classifications and other information on @-commands
-our %no_brace_commands; # commands never taking braces
-%no_brace_commands = (
+our %nobrace_commands; # commands never taking braces
+%nobrace_commands = (
'*', "\n",
' ', ' ',
"\t", ' ',
@@ -715,31 +715,21 @@ foreach my $accent_command ('"','~','^','`',"'",',','=',
$brace_commands{$accent_command} = 'accent';
}
-# FIXME There are some redundant informations in $brace_commands and being
-# in %style_commands and %regular_font_style_commands.
-# NOTE The distinction between 'style_other', 'style_no_code' and 'style_code'
-# is currently not used anywhere, but could be used in the parser if needed.
-our %style_commands;
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';
- $style_commands{$style_command} = 1;
}
-our %regular_font_style_commands;
foreach my $command ('r') {
- $regular_font_style_commands{$command} = 1;
$brace_commands{$command} = 'style_no_code';
- $style_commands{$command} = 1;
}
-our %code_style_commands; # contains also non style commands, see below
+our %brace_code_commands; # contains also non style commands, see below
foreach my $command ('code', 'command', 'env', 'file', 'kbd', 'option',
'samp', 't') {
- $code_style_commands{$command} = 1;
+ $brace_code_commands{$command} = 1;
$brace_commands{$command} = 'style_code';
- $style_commands{$command} = 1;
}
# FIXME this category contains commands with different constraints. Some
should
@@ -764,10 +754,10 @@ foreach my $other_arg_command ('w', 'verb') {
$brace_commands{$other_arg_command} = 'other';
}
-# code style command that are not style commands
-$code_style_commands{'key'} = 1;
-$code_style_commands{'verb'} = 1;
-$code_style_commands{'indicateurl'} = 1;
+# brace style command that are not style commands
+$brace_code_commands{'key'} = 1;
+$brace_code_commands{'verb'} = 1;
+$brace_code_commands{'indicateurl'} = 1;
# Commands that enclose full texts not in the main document context.
# They can contain multiple paragraphs.
@@ -1172,7 +1162,7 @@ foreach my $command (
keys(%Texinfo::Common::block_commands),
keys(%Texinfo::Common::brace_commands),
keys(%Texinfo::Common::misc_commands),
- keys(%Texinfo::Common::no_brace_commands),
+ keys(%Texinfo::Common::nobrace_commands),
qw(value),
) {
$all_commands{$command} = 1;
@@ -2975,10 +2965,10 @@ X<C<%brace_commands>>
The commands that take braces.
-=item %code_style_commands
-X<C<%code_style_commands>>
+=item %brace_code_commands
+X<C<%brace_code_commands>>
-I<style_commands> that have their argument in code style, like
+Brace commands that have their argument in code style, like
C<@code>.
=item %context_brace_commands
@@ -3065,8 +3055,8 @@ 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.
-=item %no_brace_commands
-X<C<%no_brace_commands>>
+=item %nobrace_commands
+X<C<%nobrace_commands>>
Commands without brace with a single character as name, like C<*>
or C<:>. The value is an ASCII representation of the command. It
@@ -3098,11 +3088,6 @@ X<C<%region_commands>>
Block @-commands that enclose full text regions, like C<@titlepage>.
-=item %regular_font_style_commands
-X<C<%regular_font_style_commands>>
-
-I<style_commands> that have their argument in regular font, C<@r>.
-
=item %root_commands
X<C<%root_commands>>
@@ -3121,12 +3106,6 @@ X<C<%small_block_associated_command>>
Associate small command like C<smallexample> to the regular command
C<example>.
-=item %style_commands
-X<C<%style_commands>>
-
-Commands that mark a fragment of texinfo, like C<@strong>,
-C<@cite>, C<@code> or C<@asis>.
-
=back
=head1 METHODS
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index f43ae36e83..2be74f4912 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -136,7 +136,7 @@ our %default_args_code_style = (
'float' => [1],
);
-foreach my $code_style_command (keys(%Texinfo::Common::code_style_commands)) {
+foreach my $code_style_command (keys(%Texinfo::Common::brace_code_commands)) {
$default_args_code_style{$code_style_command} = [1];
}
foreach my $ref_cmd ('pxref', 'xref', 'ref') {
@@ -1488,9 +1488,9 @@ our %xml_text_entity_no_arg_commands_formatting = (
'guilsinglright' => '›',
);
-foreach my $no_brace_command (keys(%Texinfo::Common::no_brace_commands)) {
+foreach my $no_brace_command (keys(%Texinfo::Common::nobrace_commands)) {
$xml_text_entity_no_arg_commands_formatting{$no_brace_command}
- = $Texinfo::Common::no_brace_commands{$no_brace_command};
+ = $Texinfo::Common::nobrace_commands{$no_brace_command};
}
$xml_text_entity_no_arg_commands_formatting{'&'} = '&';
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 78db9c767c..1b6614c1be 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -41,6 +41,7 @@ use vars qw($VERSION @ISA);
$VERSION = '6.8dev';
+my %brace_commands = %Texinfo::Common::brace_commands;
my $nbsp = '&#'.hex('00A0').';';
@@ -118,13 +119,13 @@ my %style_attribute_commands;
'emph' => 'emphasis',
'env' => 'envar',
'file' => 'filename',
- 'footnote' => 'footnote', # not in %style_commands
+ 'footnote' => 'footnote', # brace context command
'headitemfont' => 'emphasis role="bold"', # actually <th> instead of <td>
'i' => 'emphasis',
'indicateurl' => 'literal',
'kbd' => 'userinput',
'key' => 'keycap',
- 'math' => 'mathphrase', # not in %style_commands
+ 'math' => 'mathphrase', # brace context command
'option' => 'option',
'r' => '',
'samp' => 'literal',
@@ -134,14 +135,19 @@ my %style_attribute_commands;
'sup' => 'superscript',
't' => 'literal',
'var' => 'replaceable',
- 'verb' => 'literal', # not in %style_commands
+ 'verb' => 'literal', # brace other command
);
-# this weird construct does like uniq, it avoids duplicates.
-# it may be required since some commands are not in %style_commands.
+my %style_brace_types = map {$_ => 1} ('style_other', 'style_code',
'style_no_code');
+# @all_style_commands is the union of style brace commands, commands
+# in %style_attribute_commands and a few other, some not style brace commands.
+# Using keys of a map generated hash does like uniq, it avoids duplicates.
+# The first grep selects style brace commands, ie commands with %brace_commands
+# type in %style_brace_types.
my @all_style_commands = keys %{{ map { $_ => 1 }
- (keys(%Texinfo::Common::style_commands), keys(%style_attribute_commands),
- 'w', 'dmn', 'titlefont') }};
+ ((grep {$style_brace_types{$brace_commands{$_}}} keys(%brace_commands)),
+ keys(%style_attribute_commands), 'w', 'dmn', 'titlefont') }};
+
# special string for 'w'.
my $w_command_mark = '<!-- /@w -->';
@@ -178,7 +184,6 @@ my %docbook_global_commands = (
my %default_args_code_style
= %Texinfo::Convert::Converter::default_args_code_style;
-my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_commands;
my %defcommand_name_type = (
'defcv' => 'property',
@@ -990,7 +995,8 @@ sub _convert($$;$)
if (defined($default_args_code_style{$element->{'cmdname'}})
and $default_args_code_style{$element->{'cmdname'}}->[0]) {
$in_monospace_not_normal = 1;
- } elsif ($regular_font_style_commands{$element->{'cmdname'}}) {
+ } elsif ($brace_commands{$element->{'cmdname'}}
+ and $brace_commands{$element->{'cmdname'}} eq
'style_no_code') {
$in_monospace_not_normal = 0;
}
if ($formatting->{'upper_case'}) {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 497c114184..9fb9676045 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -96,7 +96,7 @@ 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 %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
my %accent_commands = %Texinfo::Common::accent_commands;
my %misc_commands = %Texinfo::Common::misc_commands;
my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_commands;
@@ -112,11 +112,9 @@ my %raw_commands = %Texinfo::Common::raw_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
-my %code_style_commands = %Texinfo::Common::code_style_commands;
-my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_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 %style_commands = %Texinfo::Common::style_commands;
my %align_commands = %Texinfo::Common::align_commands;
my %region_commands = %Texinfo::Common::region_commands;
my %context_brace_commands = %Texinfo::Common::context_brace_commands;
@@ -2283,9 +2281,9 @@
$default_no_arg_commands_formatting{'preformatted'}->{'*'}->{'text'} = "\n";
# is protected as CSS as a\'b", and " is escaped in an HTML style
# attribute: style="list-style-type: 'a\'b"'"
-foreach my $no_brace_command (keys(%no_brace_commands)) {
+foreach my $no_brace_command (keys(%nobrace_commands)) {
$default_no_arg_commands_formatting{'css_string'}->{$no_brace_command}->{'text'}
- = $no_brace_commands{$no_brace_command};
+ = $nobrace_commands{$no_brace_command};
}
foreach my $command (keys(%{$default_no_arg_commands_formatting{'normal'}})) {
@@ -2305,8 +2303,8 @@ foreach my $command
(keys(%{$default_no_arg_commands_formatting{'normal'}})) {
} elsif
($default_no_arg_commands_formatting{'normal'}->{$command}->{'text'}) {
$default_no_arg_commands_formatting{'css_string'}->{$command}->{'text'} =
$default_no_arg_commands_formatting{'normal'}->{$command}->{'text'};
- } elsif (exists($no_brace_commands{$command})
- and $no_brace_commands{$command} eq '') {
+ } elsif (exists($nobrace_commands{$command})
+ and $nobrace_commands{$command} eq '') {
# @- @/ @/ @|
$default_no_arg_commands_formatting{'css_string'}->{$command}->{'text'} =
'';
} else {
@@ -2499,15 +2497,20 @@ $style_commands_element{'normal'} = {
'sup' => 'sup',
't' => 'code',
'var' => 'var',
- 'verb' => 'code', # not in %style_commands
+ 'verb' => 'code', # other brace command
};
my %style_commands_formatting;
-# this weird construct does like uniq, it avoids duplicates.
-# it may be required since some commands are not in %style_commands.
+my %style_brace_types = map {$_ => 1} ('style_other', 'style_code',
'style_no_code');
+# @all_style_commands is the union of style brace commands and commands
+# in $style_commands_element{'normal'}, a few not being style brace commands.
+# Using keys of a map generated hash does like uniq, it avoids duplicates.
+# The first grep selects style brace commands, ie commands with %brace_commands
+# type in %style_brace_types.
my @all_style_commands = keys %{{ map { $_ => 1 }
- (keys(%style_commands), keys(%{$style_commands_element{'normal'}})) }};
+ ((grep {$style_brace_types{$brace_commands{$_}}} keys(%brace_commands)),
+ keys(%{$style_commands_element{'normal'}})) }};
foreach my $command(@all_style_commands) {
# default is no attribute.
@@ -3014,7 +3017,7 @@ foreach my $command (keys(%accent_commands)) {
$default_css_string_commands_conversion{$command} =
\&_css_string_convert_accent_command;
}
-# argument is formatted as code since indicateurl is in code_style_commands
+# argument is formatted as code since indicateurl is in brace_code_commands
sub _convert_indicateurl_command($$$$)
{
my $self = shift;
@@ -6977,7 +6980,7 @@ sub converter_initialize($)
my $customized_commands_conversion
= Texinfo::Config::GNUT_get_commands_conversion();
foreach my $command (keys(%misc_commands), keys(%brace_commands),
- keys (%block_commands), keys(%no_brace_commands), 'value') {
+ keys (%block_commands), keys(%nobrace_commands), 'value') {
if (exists($customized_commands_conversion->{$command})) {
$self->{'commands_conversion'}->{$command}
= $customized_commands_conversion->{$command};
@@ -6997,7 +7000,7 @@ sub converter_initialize($)
my $customized_commands_open
= Texinfo::Config::GNUT_get_commands_open();
foreach my $command (keys(%misc_commands), keys(%brace_commands),
- keys (%block_commands), keys(%no_brace_commands), 'value') {
+ keys (%block_commands), keys(%nobrace_commands), 'value') {
if (exists($customized_commands_open->{$command})) {
$self->{'commands_open'}->{$command}
= $customized_commands_open->{$command};
@@ -10141,10 +10144,11 @@ sub _convert($$;$)
} elsif ($command_name eq 'verb' or $command_name eq 'verbatim') {
$self->{'document_context'}->[-1]->{'verbatim'}++;
}
- if ($code_style_commands{$command_name} or
+ if ($brace_code_commands{$command_name} or
$preformatted_code_commands{$command_name}) {
push @{$self->{'document_context'}->[-1]->{'monospace'}}, 1;
- } elsif ($regular_font_style_commands{$command_name}) {
+ } elsif ($brace_commands{$command_name}
+ and $brace_commands{$command_name} eq 'style_no_code') {
push @{$self->{'document_context'}->[-1]->{'monospace'}}, 0;
} elsif ($upper_case_commands{$command_name}) {
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'upper_case'}++;
@@ -10250,9 +10254,10 @@ sub _convert($$;$)
if ($pre_class_commands{$command_name}) {
pop @{$self->{'document_context'}->[-1]->{'preformatted_classes'}};
}
- if ($code_style_commands{$command_name}
- or $preformatted_code_commands{$command_name}
- or $regular_font_style_commands{$command_name}) {
+ if ($preformatted_code_commands{$command_name}
+ or ($brace_commands{$command_name}
+ and $brace_commands{$command_name} eq 'style_no_code')
+ or $brace_code_commands{$command_name}) {
pop @{$self->{'document_context'}->[-1]->{'monospace'}};
} elsif ($upper_case_commands{$command_name}) {
$self->{'document_context'}->[-1]->{'formatting_context'}->[-1]->{'upper_case'}--;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index f261947b5c..61a5de5d8a 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -211,7 +211,7 @@ foreach my $informative_command (keys
(%Texinfo::Common::document_settable_at_co
$informative_commands{$informative_command} = 1;
}
-my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
my %brace_no_arg_commands;
foreach my $command (keys (%Texinfo::Common::brace_commands)) {
$brace_no_arg_commands{$command} = 1
@@ -230,8 +230,7 @@ my %explained_commands =
%Texinfo::Common::explained_commands;
my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
-my %code_style_commands = %Texinfo::Common::code_style_commands;
-my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_commands;
+my %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;
@@ -2284,7 +2283,7 @@ sub _convert($$)
$command_format_context = 'cmd_math';
}
my $did_stop_embrac;
- if (defined($no_brace_commands{$cmdname})) {
+ if (defined($nobrace_commands{$cmdname})) {
if ($cmdname eq ':') {
if ($command_format_context ne 'cmd_math') {
$result .= "\\\@";
@@ -2344,7 +2343,7 @@ sub _convert($$)
$result .= "\\$cmdname";
}
} else {
- $result .= _protect_text($self, $no_brace_commands{$cmdname});
+ $result .= _protect_text($self, $nobrace_commands{$cmdname});
}
return $result;
} elsif (exists($brace_no_arg_commands{$cmdname})) {
@@ -2455,7 +2454,7 @@ sub _convert($$)
} else {
$formatted_cmdname = $cmdname;
}
- if ($code_style_commands{$cmdname}) {
+ if ($brace_code_commands{$cmdname}) {
push @{$self->{'formatting_context'}->[-1]->{'code'}}, 1;
} elsif ($roman_style_commands{$cmdname}) {
push @{$self->{'formatting_context'}->[-1]->{'code'}}, 0;
@@ -2495,7 +2494,7 @@ sub _convert($$)
if ($self->{'quotes_map'}->{$formatted_cmdname}) {
$result .= $self->{'quotes_map'}->{$formatted_cmdname}->[1];
}
- if ($code_style_commands{$cmdname}) {
+ if ($brace_code_commands{$cmdname}) {
pop @{$self->{'formatting_context'}->[-1]->{'code'}};
} elsif ($roman_style_commands{$cmdname}) {
pop @{$self->{'formatting_context'}->[-1]->{'code'}};
@@ -3250,7 +3249,7 @@ sub _convert($$)
and $table_command->{'extra'}->{'command_as_argument'}) {
my $command_as_argument
= $table_command->{'extra'}->{'command_as_argument'}->{'cmdname'};
- if ($code_style_commands{$command_as_argument}) {
+ if ($brace_code_commands{$command_as_argument}) {
$code_style = 1;
}
}
diff --git a/tp/Texinfo/Convert/NodeNameNormalization.pm
b/tp/Texinfo/Convert/NodeNameNormalization.pm
index 936b70ed23..dd7fe328e9 100644
--- a/tp/Texinfo/Convert/NodeNameNormalization.pm
+++ b/tp/Texinfo/Convert/NodeNameNormalization.pm
@@ -54,16 +54,16 @@ use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS);
$VERSION = '6.8dev';
-my %normalize_node_brace_no_arg_commands
+my %normalize_node_brace_no_arg_commands
= %Texinfo::Convert::Text::text_brace_no_arg_commands;
foreach my $command
(keys(%Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands)) {
$normalize_node_brace_no_arg_commands{$command} =
$Texinfo::Convert::Unicode::unicode_character_brace_no_arg_commands{$command};
}
-my %normalize_node_no_brace_commands
- = %Texinfo::Common::no_brace_commands;
-$normalize_node_no_brace_commands{'*'} = ' ';
+my %normalize_node_nobrace_commands
+ = %Texinfo::Common::nobrace_commands;
+$normalize_node_nobrace_commands{'*'} = ' ';
my %accent_commands = %Texinfo::Common::accent_commands;
@@ -195,7 +195,7 @@ sub _unicode_to_transliterate($;$)
} elsif (ord($char) <= hex(0xFFFF)
and
exists($Texinfo::Convert::Unicode::transliterate_map{uc(sprintf("%04x",ord($char)))}))
{
$result .=
$Texinfo::Convert::Unicode::transliterate_map{uc(sprintf("%04x",ord($char)))};
- } elsif (ord($char) <= hex(0xFFFF)
+ } elsif (ord($char) <= hex(0xFFFF)
and
exists($Texinfo::Convert::Unicode::diacritics_accent_commands{uc(sprintf("%04x",ord($char)))}))
{
$result .= '';
# in this case, we want to avoid calling unidecode, as we are sure
@@ -204,7 +204,7 @@ sub _unicode_to_transliterate($;$)
# This is the case, for example, for @exclamdown, is corresponds
# with x00a1, but unidecode transliterates it to a !, we want
# to avoid that and keep x00a1.
- } elsif (ord($char) <= hex(0xFFFF)
+ } elsif (ord($char) <= hex(0xFFFF)
and
exists($Texinfo::Convert::Unicode::no_transliterate_map{uc(sprintf("%04x",ord($char)))}))
{
$result .= $char;
} else {
@@ -253,8 +253,8 @@ sub _convert($;$)
}
if ($element->{'cmdname'}) {
my $command = $element->{'cmdname'};
- if (defined($normalize_node_no_brace_commands{$element->{'cmdname'}})) {
- return $normalize_node_no_brace_commands{$element->{'cmdname'}};
+ if (defined($normalize_node_nobrace_commands{$element->{'cmdname'}})) {
+ return $normalize_node_nobrace_commands{$element->{'cmdname'}};
} elsif
(defined($normalize_node_brace_no_arg_commands{$element->{'cmdname'}})) {
$command = $element->{'extra'}->{'clickstyle'}
if ($element->{'extra'}
@@ -269,8 +269,8 @@ sub _convert($;$)
} elsif ($accent_commands{$element->{'cmdname'}}) {
return '' if (!$element->{'args'});
my $accent_text = _convert($element->{'args'}->[0]);
- my $accented_char
- = Texinfo::Convert::Unicode::unicode_accent($accent_text,
+ my $accented_char
+ = Texinfo::Convert::Unicode::unicode_accent($accent_text,
$element);
if (!defined($accented_char)) {
# In this case, the node normalization do not follow the specification,
@@ -314,7 +314,7 @@ sub _convert($;$)
$result .= _convert($content, $in_sc);
}
}
- $result = '{'.$result.'}'
+ $result = '{'.$result.'}'
if ($element->{'type'} and $element->{'type'} eq 'bracketed');
return $result;
}
@@ -360,8 +360,8 @@ sub set_nodes_list_labels($$$)
} else {
if (defined $labels{$normalized}) {
$registrar->line_error($configuration_information,
- sprintf(__("\@%s `%s' previously defined"),
- $target->{'cmdname'},
+ sprintf(__("\@%s `%s' previously defined"),
+ $target->{'cmdname'},
Texinfo::Convert::Texinfo::convert_to_texinfo({'contents'
=> $target->{'extra'}->{'node_content'}})),
$target->{'source_info'});
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 306620f993..985cf45cc3 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -26,10 +26,10 @@ use 5.00405;
# See comment at start of HTML.pm
use if $] >= 5.012, feature => qw(unicode_strings);
-use strict;
-
use if $] >= 5.014, re => '/a';
+use strict;
+
use Texinfo::Common;
use Texinfo::Convert::Texinfo;
use Texinfo::Convert::Utils;
@@ -62,6 +62,7 @@ $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;
+my %brace_commands = %Texinfo::Common::brace_commands;
my $NO_NUMBER_FOOTNOTE_SYMBOL = '*';
@@ -82,11 +83,11 @@ sub get_informative_global_commands($)
return @informative_global_commands;
}
-my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
my %brace_no_arg_commands;
-foreach my $command (keys (%Texinfo::Common::brace_commands)) {
+foreach my $command (keys (%brace_commands)) {
$brace_no_arg_commands{$command} = 1
- if ($Texinfo::Common::brace_commands{$command} eq 'noarg');
+ if ($brace_commands{$command} eq 'noarg');
}
my %accent_commands = %Texinfo::Common::accent_commands;
my %misc_commands = %Texinfo::Common::misc_commands;
@@ -102,8 +103,7 @@ my %inline_format_commands =
%Texinfo::Common::inline_format_commands;
my %inline_commands = %Texinfo::Common::inline_commands;
my %raw_commands = %Texinfo::Common::raw_commands;
my %format_raw_commands = %Texinfo::Common::format_raw_commands;
-my %code_style_commands = %Texinfo::Common::code_style_commands;
-my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_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;
@@ -313,7 +313,7 @@ my %non_quoted_commands_when_nested;
# if @documentencoding utf-8 is used.
foreach my $quoted_command (@quoted_commands) {
$style_map{$quoted_command} = ["'", "'"];
- if ($code_style_commands{$quoted_command}) {
+ if ($brace_code_commands{$quoted_command}) {
$non_quoted_commands_when_nested{$quoted_command} = 1;
}
}
@@ -335,7 +335,7 @@ for my $index_style_command ('strong', 'emph', 'sub',
'sup', 'key') {
# in those commands, there is no addition of double space after a dot.
# math is special
my %no_punctation_munging_commands;
-foreach my $command ('var', 'cite', 'dmn', keys(%code_style_commands)) {
+foreach my $command ('var', 'cite', 'dmn', keys(%brace_code_commands)) {
$no_punctation_munging_commands{$command} = 1;
}
@@ -1708,7 +1708,7 @@ sub _convert($$)
my $preformatted;
if ($command) {
my $unknown_command;
- if (defined($no_brace_commands{$command})) {
+ if (defined($nobrace_commands{$command})) {
if ($command eq ':') {
remove_end_sentence($formatter->{'container'});
return '';
@@ -1731,10 +1731,10 @@ sub _convert($$)
add_end_sentence($formatter->{'container'}, 1);
} elsif ($command eq ' ' or $command eq "\n" or $command eq "\t") {
$result .= _count_added($self, $formatter->{'container'},
- add_next($formatter->{'container'}, $no_brace_commands{$command}));
+ add_next($formatter->{'container'}, $nobrace_commands{$command}));
} else {
$result .= _count_added($self, $formatter->{'container'},
- add_text($formatter->{'container'}, $no_brace_commands{$command}));
+ add_text($formatter->{'container'}, $nobrace_commands{$command}));
}
return $result;
} elsif ($command eq 'today') {
@@ -1826,13 +1826,14 @@ sub _convert($$)
return $result;
} elsif ($self->{'style_map'}->{$command}
or ($element->{'type'} and $element->{'type'} eq
'definfoenclose_command')) {
- if ($code_style_commands{$command}) {
+ if ($brace_code_commands{$command}) {
if (!$formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
push @{$formatter->{'font_type_stack'}}, {'monospace' => 1};
} else {
$formatter->{'font_type_stack'}->[-1]->{'monospace'}++;
}
- } elsif ($regular_font_style_commands{$command}) {
+ } elsif ($brace_commands{$command}
+ and $brace_commands{$command} eq 'style_no_code') {
if ($formatter->{'font_type_stack'}->[-1]->{'monospace'}) {
push @{$formatter->{'font_type_stack'}}, {'monospace' => 0,
'normal' => 1};
@@ -1899,12 +1900,13 @@ sub _convert($$)
set_space_protection($formatter->{'container'},0,undef)
if ($formatter->{'w'} == 0);
}
- if ($code_style_commands{$command}) {
+ if ($brace_code_commands{$command}) {
$formatter->{'font_type_stack'}->[-1]->{'monospace'}--;
allow_end_sentence($formatter->{'container'});
pop @{$formatter->{'font_type_stack'}}
if !$formatter->{'font_type_stack'}->[-1]->{'monospace'};
- } elsif ($regular_font_style_commands{$command}) {
+ } elsif ($brace_commands{$command}
+ and $brace_commands{$command} eq 'style_no_code') {
if ($formatter->{'font_type_stack'}->[-1]->{'normal'}) {
$formatter->{'font_type_stack'}->[-1]->{'normal'}--;
pop @{$formatter->{'font_type_stack'}}
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index f142efcecb..20fd6c9f21 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -99,6 +99,8 @@ our %no_arg_commands_formatting = (
'guillemotright' => 'guillemotright',
);
+my %brace_commands = %Texinfo::Common::brace_commands;
+
# use default XML formatting to complete the hash, removing XML
# specific formatting. This avoids some code duplication.
my %default_xml_no_arg_commands_formatting =
@@ -165,7 +167,6 @@ foreach my $command ('item', 'headitem', 'itemx', 'tab',
my %default_args_code_style
= %Texinfo::Convert::Converter::default_args_code_style;
-my %regular_font_style_commands =
%Texinfo::Common::regular_font_style_commands;
# our because it is used in the xml to texi translator
our %commands_args_elements = (
@@ -654,7 +655,8 @@ sub _convert($$;$)
if (defined($default_args_code_style{$format_item_command})
and $default_args_code_style{$format_item_command}->[0]) {
$in_monospace_not_normal = 1;
- } elsif ($regular_font_style_commands{$format_item_command}) {
+ } elsif ($brace_commands{$format_item_command}
+ and $brace_commands{$format_item_command} eq
'style_no_code') {
$in_monospace_not_normal = 0;
}
}
@@ -938,7 +940,8 @@ sub _convert($$;$)
if (defined($default_args_code_style{$element->{'cmdname'}})
and $default_args_code_style{$element->{'cmdname'}}->[0]) {
$in_monospace_not_normal = 1;
- } elsif ($regular_font_style_commands{$element->{'cmdname'}}) {
+ } elsif ($brace_commands{$element->{'cmdname'}}
+ and $brace_commands{$element->{'cmdname'}} eq 'style_no_code') {
$in_monospace_not_normal = 0;
}
push @{$self->{'document_context'}->[-1]->{'monospace'}},
@@ -953,7 +956,7 @@ sub _convert($$;$)
.$arg.$self->txi_markup_close_element('infoenclose');
return $command_result;
} elsif ($element->{'args'}
- and
exists($Texinfo::Common::brace_commands{$element->{'cmdname'}})) {
+ and exists($brace_commands{$element->{'cmdname'}})) {
if ($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
and $element->{'extra'} and $element->{'extra'}->{'format'}
@@ -1022,7 +1025,8 @@ sub _convert($$;$)
if (defined($default_args_code_style{$element->{'cmdname'}})
and
$default_args_code_style{$element->{'cmdname'}}->[$arg_index]) {
$in_monospace_not_normal = 1;
- } elsif ($regular_font_style_commands{$element->{'cmdname'}}) {
+ } elsif ($brace_commands{$element->{'cmdname'}}
+ and $brace_commands{$element->{'cmdname'}} eq
'style_no_code') {
$in_monospace_not_normal = 0;
}
push @{$self->{'document_context'}->[-1]->{'monospace'}},
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 358a4e58ba..e4bd87c3cf 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -142,7 +142,7 @@ foreach my $accent_letter ('o','O','l','L') {
}
my %accent_commands = %Texinfo::Common::accent_commands;
-my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
my %formatted_misc_commands = %Texinfo::Common::formatted_misc_commands;
# 'page' is a formatted_misc_commands and therefore is replaced by an empty
line.
@@ -432,8 +432,8 @@ sub _convert($;$)
}
if ($element->{'cmdname'}) {
my $command = $element->{'cmdname'};
- if (defined($no_brace_commands{$element->{'cmdname'}})) {
- return $no_brace_commands{$element->{'cmdname'}};
+ if (defined($nobrace_commands{$element->{'cmdname'}})) {
+ return $nobrace_commands{$element->{'cmdname'}};
} elsif ($element->{'cmdname'} eq 'today') {
if ($options->{'sort_string'}
and $sort_brace_no_arg_commands{$element->{'cmdname'}}) {
@@ -515,7 +515,7 @@ sub _convert($;$)
my $result;
my $in_code;
$options->{'sc'}++ if ($element->{'cmdname'} eq 'sc');
- if ($Texinfo::Common::code_style_commands{$element->{'cmdname'}}
+ if ($Texinfo::Common::brace_code_commands{$element->{'cmdname'}}
or $Texinfo::Common::math_commands{$element->{'cmdname'}}) {
$in_code = 1;
}
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 29e178941a..ef210fd6e4 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -118,8 +118,8 @@ sub _convert($$)
return $element->{'text'};
}
if (defined($element->{'cmdname'})) {
- if (exists($Texinfo::Common::no_brace_commands{$element->{'cmdname'}})) {
- return $Texinfo::Common::no_brace_commands{$element->{'cmdname'}};
+ if (exists($Texinfo::Common::nobrace_commands{$element->{'cmdname'}})) {
+ return $Texinfo::Common::nobrace_commands{$element->{'cmdname'}};
} elsif ($element->{'cmdname'} eq 'today') {
if ($self->get_conf('TEST')) {
return 'a sunny day';
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index b17fbc6db8..e4bbd78199 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -257,7 +257,7 @@ my %initialization_overrides = (
'documentlanguage' => 1,
);
-my %no_brace_commands = %Texinfo::Common::no_brace_commands;
+my %nobrace_commands = %Texinfo::Common::nobrace_commands;
my %line_commands = %Texinfo::Common::line_commands;
my %other_commands = %Texinfo::Common::other_commands;
my %brace_commands = %Texinfo::Common::brace_commands;
@@ -280,7 +280,6 @@ my %sectioning_heading_commands =
%Texinfo::Common::sectioning_heading_comma
my %command_index = %Texinfo::Common::command_index;
my %ref_commands = %Texinfo::Common::ref_commands;
my %region_commands = %Texinfo::Common::region_commands;
-my %code_style_commands = %Texinfo::Common::code_style_commands;
my %headings_specification_commands =
%Texinfo::Common::headings_specification_commands;
my %in_heading_commands = %Texinfo::Common::in_heading_commands;
my %in_index_commands = %Texinfo::Common::in_index_commands;
@@ -383,7 +382,7 @@ foreach my $brace_command(keys(%brace_commands)) {
$in_accent_commands{$brace_command} = 1
if ($brace_commands{$brace_command} eq 'noarg');
}
-foreach my $no_brace_command (keys(%no_brace_commands)) {
+foreach my $no_brace_command (keys(%nobrace_commands)) {
$in_accent_commands{$no_brace_command} = 1;
}
$in_accent_commands{'c'} = 1;
@@ -391,7 +390,7 @@ $in_accent_commands{'comment'} = 1;
# commands that may appear in text arguments
my %in_full_text_commands;
-foreach my $command (keys(%brace_commands), keys(%no_brace_commands)) {
+foreach my $command (keys(%brace_commands), keys(%nobrace_commands)) {
$in_full_text_commands{$command} = 1;
}
foreach my $in_full_text_command ('c', 'comment', 'refill', 'subentry',
@@ -5129,7 +5128,7 @@ sub _process_remaining_on_line($$$$)
$current->{'extra'}->{'end'}
= $self->{'definfoenclose'}->{$command}->[1];
}
- } elsif (exists ($no_brace_commands{$command})) {
+ } elsif (exists ($nobrace_commands{$command})) {
push @{$current->{'contents'}},
{ 'cmdname' => $command, 'parent' => $current };
# FIXME generalize?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (%nobrace_commands), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/NodeNameNormalization.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm, tp/Texinfo/ParserNonXS.pm: rename %no_brace_commands as %nobrace_commands to be more in line with XS parser.,
Patrice Dumas <=
- Prev by Date:
[no subject]
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm (converter_initialize, _convert), tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/ParserNonXS.pm (_close_current, _end_line) (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/close.c (close_current, close_commands), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.c (close_paragraph_command), tp [...]
- Previous by thread:
master updated (a0b406396d -> 9592a8e95b)
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm (converter_initialize, _convert), tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm (_convert), tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/ParserNonXS.pm (_close_current, _end_line) (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/close.c (close_current, close_commands), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.c (close_paragraph_command), tp [...]
- Index(es):