aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2012-01-14 02:08:03 +0100
committerMartin Vilcans <martin@librador.com>2012-01-14 02:08:03 +0100
commit670f863d6823686a81becd5d5f858223ab35bb22 (patch)
tree3de9638693aef00b4c8ee7439460f604b733dd37
parent6466690e597a27597fa6dcf93f7b9d7035479471 (diff)
downloadscreenplain-670f863d6823686a81becd5d5f858223ab35bb22.tar.gz
Use &nbsp; to avoid empty paragraphs in HTML.
Otherwise empty paragraphs won't be seen.
-rw-r--r--screenplain/export/html.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/screenplain/export/html.py b/screenplain/export/html.py
index 3d04106..d1f3820 100644
--- a/screenplain/export/html.py
+++ b/screenplain/export/html.py
@@ -12,15 +12,6 @@ import os.path
from screenplain.types import *
-types = {
- Slug: 'slug',
- Dialog: 'dialog',
- DualDialog: 'dual',
- Action: 'action',
- Transition: 'transition',
-}
-
-
class tags(object):
"""Handler for automatically opening and closing tags.
@@ -56,7 +47,10 @@ class tags(object):
def to_html(text):
- return re.sub(' ', '&nbsp; ', text.to_html())
+ html = text.to_html()
+ if html == '':
+ return '&nbsp;'
+ return re.sub(' ', '&nbsp; ', html)
def format_dialog(dialog, out):
@@ -161,7 +155,6 @@ def convert_bare(screenplay, out):
"""
for para in screenplay:
if isinstance(para, Slug):
- # Slugs are h2 tags not inside a div
format_slug(para, out)
elif isinstance(para, Action):
format_action(para, out)