[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp Texinfo/Convert/Plaintext.pm t/plain...
From: |
Patrice Dumas |
Subject: |
texinfo/tp Texinfo/Convert/Plaintext.pm t/plain... |
Date: |
Sat, 28 Jul 2012 17:55:26 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 12/07/28 17:55:26
Modified files:
tp/Texinfo/Convert: Plaintext.pm
tp/t : plaintext_tests.t
tp/t/results/converters_tests:
documentencoding_utf8_and_insertions.pl
image_formatting.pl
no_documentencoding_and_insertions.pl
tp/t/results/coverage_braces: kbd.pl
tp/t/results/misc_commands:
codequoteundirected_codequotebacktick.pl
test_allowcodebreaks.pl
tp/t/results/plaintext_tests: at_commands_glued_in_example.pl
tp/tests/coverage/res_parser_info/formatting: formatting.info
tp/tests/coverage/res_parser_info/formatting_fr: formatting.info
tp/tests/coverage/res_parser_info/formatting_utf8_enable_encoding:
formatting_utf8.info
tp/tests/layout/res_parser/formatting_plaintext: formatting.1
Added files:
tp/t/results/plaintext_tests: nested_code_commands.pl
Log message:
Do not use quotes for code environments if already in a code
environment.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.215&r2=1.216
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/plaintext_tests.t?cvsroot=texinfo&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/converters_tests/documentencoding_utf8_and_insertions.pl?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/converters_tests/image_formatting.pl?cvsroot=texinfo&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/converters_tests/no_documentencoding_and_insertions.pl?cvsroot=texinfo&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/coverage_braces/kbd.pl?cvsroot=texinfo&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/test_allowcodebreaks.pl?cvsroot=texinfo&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/plaintext_tests/at_commands_glued_in_example.pl?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/plaintext_tests/nested_code_commands.pl?cvsroot=texinfo&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/coverage/res_parser_info/formatting/formatting.info?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/coverage/res_parser_info/formatting_fr/formatting.info?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/coverage/res_parser_info/formatting_utf8_enable_encoding/formatting_utf8.info?cvsroot=texinfo&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/tests/layout/res_parser/formatting_plaintext/formatting.1?cvsroot=texinfo&r1=1.3&r2=1.4
Patches:
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -b -r1.215 -r1.216
--- Texinfo/Convert/Plaintext.pm 14 Jul 2012 23:20:09 -0000 1.215
+++ Texinfo/Convert/Plaintext.pm 28 Jul 2012 17:55:24 -0000 1.216
@@ -261,13 +261,20 @@
my @quoted_commands = ('cite', 'code', 'command', 'env', 'file', 'kbd',
'option', 'samp');
+# %quoted_code_commands have no quote when in code command contexts
+my %quoted_code_commands;
+
# Quotes are reset in converter_initialize and unicode quotes are used
# if @documentencoding utf-8 is used.
foreach my $quoted_command (@quoted_commands) {
#$style_map{$quoted_command} = ['`', "'"];
$style_map{$quoted_command} = ["'", "'"];
+ $quoted_code_commands{$quoted_command} = 1;
}
+delete $quoted_code_commands{'cite'};
+delete $quoted_code_commands{'samp'};
+
$style_map{'key'} = ['<', '>'];
$style_map{'indicateurl'} = ['<', '>'];
@@ -562,7 +569,7 @@
}
my $formatter = {'container' => $container, 'upper_case' => 0,
- 'code' => 0, 'w' => 0, 'type' => $type,
+ 'code' => 0, 'code_command'=> 0, 'w' => 0, 'type' => $type,
'frenchspacing_stack' =>
[$self->get_conf('frenchspacing')]};
if ($type eq 'unfilled') {
@@ -572,6 +579,7 @@
} elsif ($preformatted_code_commands{$context}
or $format_raw_commands{$context}) {
$formatter->{'code'} = 1;
+ $formatter->{'code_command'} = 1 if
($preformatted_code_commands{$context});
last;
}
}
@@ -1527,8 +1535,9 @@
return $result;
} elsif ($self->{'style_map'}->{$command}
or ($root->{'type'} and $root->{'type'} eq 'definfoenclose_command'))
{
- $formatter->{'code'}++
- if ($code_style_commands{$command});
+ if ($code_style_commands{$command}) {
+ $formatter->{'code'}++;
+ }
if ($no_punctation_munging_commands{$command}) {
push @{$formatter->{'frenchspacing_stack'}}, 'on';
$formatter->{'container'}->set_space_protection(undef,
@@ -1549,9 +1558,19 @@
$text_before = $root->{'extra'}->{'begin'};
$text_after = $root->{'extra'}->{'end'};
} else {
+ if ($quoted_code_commands{$command} and $formatter->{'code_command'}) {
+ $text_before = '';
+ $text_after = '';
+ } else {
$text_before = $self->{'style_map'}->{$command}->[0];
$text_after = $self->{'style_map'}->{$command}->[1];
}
+ }
+ # do this after determining $text_before/$text_after such that it
+ # doesn't impact the current command, but only commands nested within
+ if ($quoted_code_commands{$command}) {
+ $formatter->{'code_command'}++;
+ }
$result .= $self->_count_added($formatter->{'container'},
$formatter->{'container'}->add_next($text_before,
undef, undef, 1))
@@ -1580,6 +1599,9 @@
if ($code_style_commands{$command}) {
$formatter->{'code'}--;
}
+ if ($quoted_code_commands{$command}) {
+ $formatter->{'code_command'}--;
+ }
if ($no_punctation_munging_commands{$command}) {
pop @{$formatter->{'frenchspacing_stack'}};
my $frenchspacing = 0;
Index: t/plaintext_tests.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/plaintext_tests.t,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- t/plaintext_tests.t 9 Mar 2012 00:14:11 -0000 1.31
+++ t/plaintext_tests.t 28 Jul 2012 17:55:24 -0000 1.32
@@ -493,6 +493,39 @@
Para indented.
'],
+['nested_code_commands',
+'@code{aA @kbd{fg}}.
address@hidden @code{gg}}.
address@hidden command @kbd{fg}}
address@hidden code @command{in command}}
address@hidden samp @code{in code}}
address@hidden code @samp{in samp}}
address@hidden var @code{in code}}
address@hidden code @var{in var}}
+
address@hidden
address@hidden code}
address@hidden @kbd{fg}}
address@hidden
address@hidden command @kbd{fg}}
address@hidden code @command{in command}}
address@hidden samp @code{in code}}
address@hidden code @samp{in samp}}
address@hidden var @code{in code}}
address@hidden code @var{in var}}
address@hidden example
+
address@hidden
address@hidden disp}
address@hidden @kbd{fg}}
address@hidden command @kbd{fg}}
address@hidden code @command{in command}}
address@hidden samp @code{in code}}
address@hidden code @samp{in samp}}
address@hidden var @code{in code}}
address@hidden code @var{in var}}
address@hidden display
+'],
);
my $insert_copying_and_paragraph =
Index: t/results/converters_tests/documentencoding_utf8_and_insertions.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/converters_tests/documentencoding_utf8_and_insertions.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/results/converters_tests/documentencoding_utf8_and_insertions.pl 25 Jan
2012 07:37:43 -0000 1.3
+++ t/results/converters_tests/documentencoding_utf8_and_insertions.pl 28 Jul
2012 17:55:24 -0000 1.4
@@ -301,7 +301,7 @@
$result_converted{'plaintext'}->{'documentencoding_utf8_and_insertions'} =
'â â â â â â âin codeâ. ẽ.
- -- --- \'\' `` ` \' âin codeâ. ẽ.
+ -- --- \'\' `` ` \' in code. ẽ.
';
Index: t/results/converters_tests/image_formatting.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/converters_tests/image_formatting.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- t/results/converters_tests/image_formatting.pl 14 Feb 2012 22:27:43
-0000 1.3
+++ t/results/converters_tests/image_formatting.pl 28 Jul 2012 17:55:24
-0000 1.4
@@ -2784,14 +2784,14 @@
bbb
ccc]
- \'@image{f--ile}\' [Image description""\\.]
- \'@image{f--ile,l--i}\' [Image description""\\.]
- \'@image{f--ile,,l--e}\' [Image description""\\.]
- \'@image{f--ile,,,alt}\' [Image description""\\.]
- \'@image{f--ile,,,,e-d-xt}\' [Image description""\\.]
- \'@image{f--ile,aze,az,alt,e--xt}\' [Image description""\\.]
- \'@image{f-ile,aze,,a--lt}\' [a-lt]
- \'@address@hidden@@@.,aze,az,alt,@file{file ext} address@hidden' [alt]
+ @image{f--ile} [Image description""\\.]
+ @image{f--ile,l--i} [Image description""\\.]
+ @image{f--ile,,l--e} [Image description""\\.]
+ @image{f--ile,,,alt} [Image description""\\.]
+ @image{f--ile,,,,e-d-xt} [Image description""\\.]
+ @image{f--ile,aze,az,alt,e--xt} [Image description""\\.]
+ @image{f-ile,aze,,a--lt} [a-lt]
+ @address@hidden@@@.,aze,az,alt,@file{file ext} address@hidden [alt]
[aaa
bbb
ccc] [aaa
@@ -3034,14 +3034,14 @@
bbb
ccc]
- \'@image{f--ile}\' [image src="f--ile.png" text="[Image
description\\"\\"\\\\.]"