[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp texi2any.pl Texinfo/Convert/Plaintex...
From: |
Patrice Dumas |
Subject: |
texinfo/tp texi2any.pl Texinfo/Convert/Plaintex... |
Date: |
Fri, 28 Jan 2011 22:33:31 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 11/01/28 22:33:31
Modified files:
tp : texi2any.pl
tp/Texinfo/Convert: Plaintext.pm
tp/t : 08misc_commands.t
tp/t/results/misc_commands: definfoenclose.pl
Log message:
Handle definfoenclose'd commands in plaintext and info.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/texi2any.pl?cvsroot=texinfo&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/08misc_commands.t?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/misc_commands/definfoenclose.pl?cvsroot=texinfo&r1=1.23&r2=1.24
Patches:
Index: texi2any.pl
===================================================================
RCS file: /sources/texinfo/texinfo/tp/texi2any.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- texi2any.pl 23 Jan 2011 23:46:16 -0000 1.9
+++ texi2any.pl 28 Jan 2011 22:33:30 -0000 1.10
@@ -128,7 +128,7 @@
}
require Unicode::EastAsianWidth;
-#Â This is done at runtime because the modules are also found at runtime.
+#Â This is done at runtime because the modules above are also found at runtime.
require Texinfo::Parser;
require Texinfo::Structuring;
require Texinfo::Convert::Info;
@@ -225,8 +225,9 @@
$valid_options{$var} = 1;
}
-
+#Â passed from main program
my $cmdline_options;
+#Â used in main program
our $options = {};
sub _load_config ($) {
@@ -280,6 +281,7 @@
}
}
+#Â back in main program namespace
# file: file name to locate. It can be a file path.
# directories: a reference on a array containing a list of directories to
@@ -566,7 +568,8 @@
my @prependended_include_directories = ('.');
push @prependended_include_directories, $input_directory
if ($input_directory ne '.');
- unshift @{$parser_options->{'include_directories'}},
@prependended_include_directories;
+ unshift @{$parser_options->{'include_directories'}},
+ @prependended_include_directories;
unshift @{$parser_options->{'include_directories'}}, @prepend_dirs;
$parser_options->{'gettext'} = \&__;
Index: Texinfo/Convert/Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- Texinfo/Convert/Plaintext.pm 23 Jan 2011 23:46:16 -0000 1.56
+++ Texinfo/Convert/Plaintext.pm 28 Jan 2011 22:33:30 -0000 1.57
@@ -1132,7 +1132,8 @@
$formatter->{'container'}->add_text(
Texinfo::Convert::Text::text_accents($root, $self->{'encoding'})));
return $result;
- } elsif ($style_map{$command}) {
+ } elsif ($style_map{$command}
+ or ($root->{'type'} and $root->{'type'} eq 'definfoenclose_command'))
{
if ($code_style_commands{$command}) {
$formatter->{'code'}++;
push @{$formatter->{'frenchspacing_stack'}}, 'on';
@@ -1145,14 +1146,22 @@
$formatter->{'container'}->set_space_protection(1,1)
if ($formatter->{'w'} == 1);
}
+ my ($text_before, $text_after);
+ if ($root->{'type'} and $root->{'type'} eq 'definfoenclose_command') {
+ $text_before = $root->{'extra'}->{'begin'};
+ $text_after = $root->{'extra'}->{'end'};
+ } else {
+ $text_before = $style_map{$command}->[0];
+ $text_after = $style_map{$command}->[1];
+ }
$result = $self->_count_added($formatter->{'container'},
- $formatter->{'container'}->add_text($style_map{$command}->[0]));
+ $formatter->{'container'}->add_text($text_before));
if ($root->{'args'}) {
$result .= $self->_convert($root->{'args'}->[0]);
}
$result .= $self->_count_added($formatter->{'container'},
- $formatter->{'container'}->add_text($style_map{$command}->[1]));
+ $formatter->{'container'}->add_text($text_after));
if ($command eq 'w') {
$formatter->{'w'}--;
$formatter->{'container'}->set_space_protection(0,0)
Index: t/08misc_commands.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/08misc_commands.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- t/08misc_commands.t 5 Dec 2010 20:11:35 -0000 1.8
+++ t/08misc_commands.t 28 Jan 2011 22:33:30 -0000 1.9
@@ -122,22 +122,6 @@
shortcontents @shortcontents eol
summarycontents @summarycontents line following summarycontents
'],
-['definfoenclose',
-'
-definfoenclose phoo,//,\\ @definfoenclose phoo,//,\\
-
address@hidden
-
-definfoenclose phi,:,: @definfoenclose phi,:,:
-
address@hidden
-
address@hidden strong}
-
address@hidden strong,(strong:,:)
-
address@hidden is it really strong? }
-'],
['invalid_kbdinputstyle',
'kbdinputstyle @kbdinputstyle wrong arg on line following kbdinputstyle
'],
@@ -198,8 +182,31 @@
']
);
+my @converted_test_cases = (
+['definfoenclose',
+'
+definfoenclose phoo,//,\\ @definfoenclose phoo,//,\\
+
address@hidden
+
+definfoenclose phi,:,: @definfoenclose phi,:,:
+
address@hidden
+
address@hidden strong}
+
address@hidden strong,(strong:,:)
+
address@hidden is it really strong? }
+'],
+);
+
+foreach my $test (@converted_test_cases) {
+ $test->[2]->{'test_formats'} = ['plaintext'];
+}
+
our ($arg_test_case, $arg_generate, $arg_debug);
-run_all ('misc_commands', address@hidden, $arg_test_case,
+run_all ('misc_commands', address@hidden, @converted_test_cases],
$arg_test_case,
$arg_generate, $arg_debug);
Index: t/results/misc_commands/definfoenclose.pl
===================================================================
RCS file:
/sources/texinfo/texinfo/tp/t/results/misc_commands/definfoenclose.pl,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- t/results/misc_commands/definfoenclose.pl 7 Dec 2010 20:34:30 -0000
1.23
+++ t/results/misc_commands/definfoenclose.pl 28 Jan 2011 22:33:30 -0000
1.24
@@ -412,4 +412,19 @@
];
+
+$result_converted{'plaintext'}->{'definfoenclose'} = '
+definfoenclose phoo,//,\\
+
+ //bar\\
+
+ definfoenclose phi,:,:
+
+ :bar:
+
+ *very strong*
+
+ (strong: is it really strong? :)
+';
+
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- texinfo/tp texi2any.pl Texinfo/Convert/Plaintex...,
Patrice Dumas <=