Skip to content

Commit

Permalink
fix translation of carets; closes [cpan #50794]
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz authored and chromatic committed Apr 16, 2010
1 parent 317b8b0 commit f5e60f6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ Revision history for Pod-PseudoPod-LaTeX

{{$NEXT}}
- migrated build system to Dist::Zilla
- corrected escaping of the caret (^) character; closes [CPAN #50794]

1.000 Fri Aug 14 02:07:38 UTC 2009
- added modifications from the Parrot PIR book
Expand Down
2 changes: 1 addition & 1 deletion lib/Pod/PseudoPod/LaTeX.pm
Expand Up @@ -52,8 +52,8 @@ sub encode_text

# Escape LaTeX-specific characters
$text =~ s/\\/\\backslash/g; # backslashes are special
$text =~ s/(\^)/\\char94\{\}/g; # carets are special
$text =~ s/([#\$&%_{}])/\\$1/g;
$text =~ s/(\^)/\\char94{}/g; # carets are special

$text =~ s/(\\backslash)/\$$1\$/g; # add unescaped dollars

Expand Down
3 changes: 2 additions & 1 deletion t/escapes.t
Expand Up @@ -6,7 +6,7 @@ use warnings;
use IO::String;
use File::Spec::Functions;

use Test::More tests => 20;
use Test::More tests => 21;

use_ok( 'Pod::PseudoPod::LaTeX' ) or exit;

Expand All @@ -31,6 +31,7 @@ like( $text, qr/\\%/, '% should get quoted' );
like( $text, qr/ \\_\./, '_ should get quoted' );
like( $text, qr/\\{\\},/, '{ and } should get quoted' );
like( $text, qr/ \$\\sim\$/, '~ should get quoted' );
like( $text, qr/caret \\char94\{\}/, '^ should get quoted' );

like( $text, qr/``The interesting/,
'starting double quotes should turn into double opening single quotes' );
Expand Down
2 changes: 2 additions & 0 deletions t/test_file.pod
Expand Up @@ -28,6 +28,8 @@ lots of other escapable characters, including $ & % and _. The curly braces,
"The interesting thing is that when you use double quotes," he said, "they turn
into double single quotes going in the correct direction."

The caret ^ is interesting too.

=head3 c heading

When you leave out words, add an ellipsis... and get out an escaped version.
Expand Down

0 comments on commit f5e60f6

Please sign in to comment.