[Rt-commit] rt branch, 4.2/wrap-text-with-pre-in-txn-html-content, created. rt-4.2.3-172-g2a2198b

? sunnavy sunnavy at bestpractical.com
Wed Apr 30 08:25:02 EDT 2014


The branch, 4.2/wrap-text-with-pre-in-txn-html-content has been created
        at  2a2198bcda1f04cf172f24b1dfb37715bed15413 (commit)

- Log -----------------------------------------------------------------
commit 2a2198bcda1f04cf172f24b1dfb37715bed15413
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 30 19:43:24 2014 +0800

    wrap with <pre> so HTML::FormatText::WithLinks::AndTables can recognize it
    
    in 6b117af, we replaced <pre> with "<div style='white-space: pre-wrap; font-family: monospace;'>
    so long lines can wrap when converting plain text to html.
    
    this brings another problem when downgrading html to text back(this happens
    when the email template is html): HTML::FormatText::WithLinks::AndTables
    doesn't recognize the div, so the whitespaces in the plain text are not
    preserved.
    
    this commit wraps the "<div>" with "<pre>" so long lines can wrap and also
    HTML::FormatText::WithLinks::AndTables can recognize and make the right
    conversion.  (thanks to trs++)
    
    see also #29185

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 025de94..9891792 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -368,7 +368,7 @@ sub Content {
                 $content =~ s/&/&/g;
                 $content =~ s/</</g;
                 $content =~ s/>/>/g;
-                $content = "<div style='white-space: pre-wrap; font-family: monospace;'>$content</div>";
+                $content = "<pre><div style='white-space: pre-wrap; font-family: monospace;'>$content</div></pre>";
             }
         }
     }

-----------------------------------------------------------------------


More information about the rt-commit mailing list