[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [2118] branches/1.2/LedgerSMB/Form.pm



Revision: 2118
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2118&view=rev
Author:   tetragon
Date:     2008-03-26 20:05:25 -0700 (Wed, 26 Mar 2008)

Log Message:
-----------
More progress on handling format_string and double-escaping in TeX

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Form.pm

Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm	2008-03-26 00:27:30 UTC (rev 2117)
+++ branches/1.2/LedgerSMB/Form.pm	2008-03-27 03:05:25 UTC (rev 2118)
@@ -1258,6 +1258,7 @@
 
 sub cleanup {
 
+	return;
     my $self = shift;
     chdir("$self->{tmpdir}");
 
@@ -1312,10 +1313,11 @@
             html => [ '<',  '>', '\n', '\r', '&' ],
             txt  => [ '\n', '\r' ],
             tex  => [
-                quotemeta('\\'), '&', '\n', '\r',
-                quotemeta('$'),  '%', '#',
+#                quotemeta('\\'), '&', '\n', '\r',
+                '&', '\n', '\r',
+                quotemeta('$'),  '%', '(?<!\\\\)_', '#',
                 quotemeta('^'),  '{', '}',  '<',
-                '>',             'Â'
+                '>',             'Â',
             ]
         },
         html => {
@@ -1334,17 +1336,23 @@
             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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.