[med-svn] r1438 - trunk/community/infrastructure/scripts

tille at alioth.debian.org tille at alioth.debian.org
Mon Feb 18 17:12:57 UTC 2008


Author: tille
Date: 2008-02-18 17:12:56 +0000 (Mon, 18 Feb 2008)
New Revision: 1438

Modified:
   trunk/community/infrastructure/scripts/cddtasktools.py
Log:
Make sure pre-wrapped spaces will not be removed by strip()


Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py	2008-02-18 16:21:26 UTC (rev 1437)
+++ trunk/community/infrastructure/scripts/cddtasktools.py	2008-02-18 17:12:56 UTC (rev 1438)
@@ -53,8 +53,6 @@
     LongDesc  = ''
     pre       = 0
     for line in lines[1:]:
-        ## Do not strip here - wee need the leading blanks to detect <pre> lines
-        # line = line.strip()
         # Replace paragraph separators by <br />
         if re.compile("^\s?\.\s*$").search(line):
             LongDesc += "<br />\n"
@@ -67,7 +65,9 @@
                 pre = 1
                 LongDesc += "<pre>\n"
             # This is to sanitize output for XHTML pages. --David
-            line = line.strip().replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") + ' \n'
+            # Leave out the first space (line[1:]) instead of strip() because strip
+            # removes wanted indentation of pre statements
+            line = line[1:].replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") + ' \n'
             LongDesc += re.sub('([fh]t?tp://[-./\w?=~]+)', '<a href="\\1">\\1</a>', line)
     if pre == 1:
         LongDesc += "</pre>\n"




More information about the debian-med-commit mailing list