[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
texinfo/tp/Texinfo/Convert Plaintext.pm
From: |
Patrice Dumas |
Subject: |
texinfo/tp/Texinfo/Convert Plaintext.pm |
Date: |
Sun, 21 Nov 2010 19:18:35 +0000 |
CVSROOT: /sources/texinfo
Module name: texinfo
Changes by: Patrice Dumas <pertusus> 10/11/21 19:18:35
Modified files:
tp/Texinfo/Convert: Plaintext.pm
Log message:
Don't munge with punctuation when in code style.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Convert/Plaintext.pm?cvsroot=texinfo&r1=1.12&r2=1.13
Patches:
Index: Plaintext.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Convert/Plaintext.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- Plaintext.pm 21 Nov 2010 18:33:40 -0000 1.12
+++ Plaintext.pm 21 Nov 2010 19:18:35 -0000 1.13
@@ -321,7 +321,8 @@
die "Unknown container type $type\n";
}
my $formatter = {'container' => $container, 'upper_case' => 0,
- 'code' => 0, 'w' => 0};
+ 'code' => 0, 'w' => 0,
+ 'frenchspacing_stack' => [$self->{'frenchspacing'}]};
if (defined($self->{'preformatted'})) {
$formatter->{'preformatted'} = $self->{'preformatted'};
}
@@ -432,7 +433,7 @@
#print STDERR " Special def_command: $root->{'extra'}->{'def_command'}\n"
# if (defined($root->{'extra'}) and $root->{'extra'}->{'def_command'});
if ($container_context) {
- print STDERR "
Container:($container_context->{'code'},$container_context->{'upper_case'},$container_context->{'preformatted'})
";
+ print STDERR "
Container:($container_context->{'code'},$container_context->{'upper_case'},$container_context->{'preformatted'},$container_context->{'frenchspacing_stack'}->[-1])
";
$container_context->{'container'}->dump();
}
}
@@ -522,7 +523,12 @@
Texinfo::Convert::Text::text_accents($root, $self->{'encoding'}));
return $result;
} elsif ($style_map{$command}) {
- $container_context->{'code'}++ if ($code_style_commands{$command});
+ if ($code_style_commands{$command}) {
+ $container_context->{'code'}++;
+ push @{$container_context->{'frenchspacing_stack'}}, 1;
+ $container_context->{'container'}->set_space_protection(undef,
+ undef,undef,1);
+ }
$container_context->{'upper_case'}++ if ($upper_case_commands{$command});
if ($command eq 'w') {
$container_context->{'w'}++;
@@ -537,7 +543,12 @@
$container_context->{'container'}->set_space_protection(0,0)
if ($container_context->{'w'} == 0);
}
- $container_context->{'code'}-- if ($code_style_commands{$command});
+ if ($code_style_commands{$command}) {
+ $container_context->{'code'}--;
+ pop @{$container_context->{'frenchspacing_stack'}};
+ $container_context->{'container'}->set_space_protection(undef,
+ undef, undef, $container_context->{'frenchspacing_stack'}->[-1]);
+ }
$container_context->{'upper_case'}-- if ($upper_case_commands{$command});
} elsif ($root->{'cmdname'} eq 'image') {
# FIXME
@@ -573,9 +584,8 @@
and defined($root->{'extra'}->{'brace_command_contents'}->[1])) {
@contents = (@{$root->{'extra'}->{'brace_command_contents'}->[1]},
{'text' => ' ('},
- {'type' => 'frenchspacing',
- 'contents' => [{'type' => 'code',
- 'contents' =>
address@hidden>{'extra'}->{'brace_command_contents'}->[0]}]}]
+ {'type' => 'code',
+ 'contents' =>
address@hidden>{'extra'}->{'brace_command_contents'}->[0]}]
},
{'text' => ')'});
} else {
@@ -815,15 +825,14 @@
$result .= $self->convert($arg);
}
} elsif ($root->{'type'} eq 'frenchspacing') {
- $container_context->{'frenchspacing'}++;
- if ($container_context->{'frenchspacing'} == 1) {
+ push @{$container_context->{'frenchspacing_stack'}}, 1;
$container_context->{'container'}->set_space_protection(undef,
- undef, undef, 1);
- $container_context->{'saved_frenchspacing'}
- = $self->{'frenchspacing'};
- }
+ undef,undef,1);
} elsif ($root->{'type'} eq 'code') {
$container_context->{'code'}++;
+ push @{$container_context->{'frenchspacing_stack'}}, 1;
+ $container_context->{'container'}->set_space_protection(undef,
+ undef,undef,1);
}
}
if ($root->{'contents'}) {
@@ -847,15 +856,14 @@
}
if ($root->{'type'}) {
if ($root->{'type'} eq 'frenchspacing') {
- $container_context->{'frenchspacing'}--;
- if ($container_context->{'frenchspacing'} == 0) {
+ pop @{$container_context->{'frenchspacing_stack'}};
$container_context->{'container'}->set_space_protection(undef,
- undef, undef, $container_context->{'saved_frenchspacing'});
- delete $container_context->{'saved_frenchspacing'};
- delete $container_context->{'frenchspacing'};
- }
+ undef, undef, $container_context->{'frenchspacing_stack'}->[-1]);
} elsif ($root->{'type'} eq 'code') {
$container_context->{'code'}--;
+ pop @{$container_context->{'frenchspacing_stack'}};
+ $container_context->{'container'}->set_space_protection(undef,
+ undef, undef, $container_context->{'frenchspacing_stack'}->[-1]);
} elsif ($root->{'type'} eq 'bracketed'
and $self->{'context'}->[-1] eq 'math') {
$result .= $container_context->{'container'}->add_text('}');