From 8f8f3d6f7820073a443da7f710cc46806c0d561b Mon Sep 17 00:00:00 2001 From: Tom Laithwaite Date: Tue, 7 Jun 2011 14:43:59 +0200 Subject: [PATCH] Fix bug 659312 - Use of PRE in html exporter produces undesired results. r=philipp --- calendar/import-export/calHtmlExport.js | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/calendar/import-export/calHtmlExport.js b/calendar/import-export/calHtmlExport.js index 9be229d6bc..8a3dea426b 100644 --- a/calendar/import-export/calHtmlExport.js +++ b/calendar/import-export/calHtmlExport.js @@ -105,6 +105,7 @@ calHtmlExporter.prototype = { html.head.style += "abbr {border: none;}\n"; html.head.style += ".summarykey {display: none;}\n"; html.head.style += "div.summary {background: white; font-weight: bold; margin: 0px; padding: 3px;}\n"; + html.head.style += "div.description { white-space: pre-wrap; }\n"; // Sort aItems function sortFunc(a, b) { @@ -168,35 +169,14 @@ calHtmlExporter.prototype = { ); } - // Description, inside a pre to preserve formating when needed. let desc = item.getProperty('DESCRIPTION'); if (desc && desc.length > 0) { - let usePre = false; - if (desc.indexOf("\n ") >= 0 || desc.indexOf("\n\t") >= 0 || - desc.indexOf(" ") == 0 || desc.indexOf("\t") == 0) - // (RegExp /^[ \t]/ doesn't work.) - // contains indented preformatted text after beginning or newline - // so preserve indentation with PRE. - usePre = true; - let descnode =
{prefixDescription}
-
+
{desc}
; - if (usePre) { - descnode.div[1] =
{desc}
; - } else { - let lines = desc.split('\n'); - for (let i in lines) { - descnode.div[1].appendChild(lines[i]); - // Add a new line, except after the last line - if (i != (lines.length-1)) { - descnode.div[1].appendChild(
); - } - } - } ev.appendChild(descnode); } html.body.appendChild(ev);