Fix multi-line code blocks.
authorWayne Davison <wayne@opencoder.net>
Thu, 23 Jul 2020 23:20:07 +0000 (16:20 -0700)
committerWayne Davison <wayne@opencoder.net>
Thu, 23 Jul 2020 23:22:12 +0000 (16:22 -0700)
packaging/md2html

index 0ee7c405d5ea7fb9a202245b0bc5ebf3bdfa5486..fa8d8b9600d16f86d4e102f8ef087b040a9cf786 100755 (executable)
@@ -75,7 +75,7 @@ def main():
 
         html = md_parser(txt)
 
-        html = re.sub(r'(<code>)([\s\S]*?)(</code>)', lambda m: m[1] + re.sub(r'\s', '\xa0', m[2]) + m[3], html)
+        html = re.sub(r'(?<!<pre>)(<code>)([\s\S]*?)(</code>)', lambda m: m[1] + re.sub(r'\s', '\xa0', m[2]) + m[3], html)
         html = html.replace('--', '&#8209;&#8209;').replace("\xa0-", '&nbsp;&#8209;').replace("\xa0", '&nbsp;')
         html = re.sub(r'(\W)-', r'\1&#8209;', html)