diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-03-27 03:05:25 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-03-27 03:05:25 +0000 |
commit | f034c250b63ca196d5887a8911bcebcc16c23220 (patch) | |
tree | dc29d267976b20146efca41936f2d0359bec7a48 | |
parent | f7e19a1aca9799830173db5a958922a8a48bfdb9 (diff) |
More progress on handling format_string and double-escaping in TeX
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2118 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-x | LedgerSMB/Form.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 0725005f..a7d8c6e9 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -1258,6 +1258,7 @@ sub format_line { sub cleanup { + return; my $self = shift; chdir("$self->{tmpdir}"); @@ -1312,10 +1313,11 @@ sub format_string { html => [ '<', '>', '\n', '\r', '&' ], txt => [ '\n', '\r' ], tex => [ - quotemeta('\\'), '&', '\n', '\r', - quotemeta('$'), '%', '#', +# quotemeta('\\'), '&', '\n', '\r', + '&', '\n', '\r', + quotemeta('$'), '%', '(?<!\\\\)_', '#', quotemeta('^'), '{', '}', '<', - '>', '£' + '>', '£', ] }, html => { @@ -1334,17 +1336,23 @@ sub format_string { quotemeta('^') => '\^\\', '{' => '\{', '}' => '\}', + '(?<!\\\\)_' => '\_', # SC: Double escaping is annoying '<' => '$<$', '>' => '$>$', '\n' => '\newline ', '\r' => '\newline ', '£' => '\pounds ', - quotemeta('\\') => '/' +# quotemeta('\\') => '/' } ); my $key; + if ($format eq 'tex') { + FIELD: for (@fields) { + $self->{$_} =~ s{\\(?!pounds\b|newline\b|\$|%|#|&|\{|\}|\^\\|_)}{/}g; + } + } CHAR: foreach $key ( @{ $replace{order}{$format} } ) { FIELD: for (@fields) { $self->{$_} =~ s/$key/$replace{$format}{$key}/g; |