diff options
author | Martin Vilcans <martin@librador.com> | 2016-04-13 23:40:46 +0200 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2016-04-13 23:40:46 +0200 |
commit | 355b16004a57d5b23ef0e31adb818b5dabae3c86 (patch) | |
tree | ba354b1775708889859864191dea67d37502cd56 | |
parent | 99abd9ad27b1c80909bb37e7cb21dedfc5046f40 (diff) | |
download | screenplain-355b16004a57d5b23ef0e31adb818b5dabae3c86.tar.gz |
Replace two spaces with in PDF output too
-rw-r--r-- | screenplain/export/html.py | 6 | ||||
-rw-r--r-- | screenplain/richstring.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/screenplain/export/html.py b/screenplain/export/html.py index 625fcb4..1f88e64 100644 --- a/screenplain/export/html.py +++ b/screenplain/export/html.py @@ -3,9 +3,6 @@ # http://www.opensource.org/licenses/mit-license.php from __future__ import with_statement -import sys -import re -import cgi import os import os.path @@ -60,7 +57,8 @@ def to_html(text): html = text.to_html() if html == '': return ' ' - return re.sub(' ', ' ', html) + else: + return html class Formatter(object): diff --git a/screenplain/richstring.py b/screenplain/richstring.py index 06adf50..9470c7d 100644 --- a/screenplain/richstring.py +++ b/screenplain/richstring.py @@ -109,7 +109,11 @@ class Segment(object): ordered_styles = self.get_ordered_styles() return ( ''.join(style.start_html for style in ordered_styles) + - cgi.escape(self.text).encode('ascii', 'xmlcharrefreplace') + + re.sub( + ' ', # two spaces + ' ', + cgi.escape(self.text).encode('ascii', 'xmlcharrefreplace'), + ) + ''.join(style.end_html for style in reversed(ordered_styles)) ) |