aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2011-11-28 00:52:52 +0100
committerMartin Vilcans <martin@librador.com>2011-11-28 00:52:52 +0100
commitbba2e3d43d1dfa268f68e4bba9173d14d4813bc2 (patch)
treed8207b81e1443e77656036b8a5c33b8a2876ac5f
parent4d50fbdc2b58d9744e80b04518f22fb7a3da5699 (diff)
downloadscreenplain-bba2e3d43d1dfa268f68e4bba9173d14d4813bc2.tar.gz
Support for centered action elements in HTML output.
-rw-r--r--screenplain/export/default.css3
-rw-r--r--screenplain/export/html.py32
2 files changed, 26 insertions, 9 deletions
diff --git a/screenplain/export/default.css b/screenplain/export/default.css
index e1403a0..d87162b 100644
--- a/screenplain/export/default.css
+++ b/screenplain/export/default.css
@@ -50,6 +50,9 @@ footer, header, hgroup, menu, nav, section {
margin-top: 1em;
width:36.14em;
}
+.screenplay .centered {
+ text-align: center;
+}
.screenplay div.dialog, .screenplay div.dual {
margin-top: 1em;
}
diff --git a/screenplain/export/html.py b/screenplain/export/html.py
index d0850c0..c5d08be 100644
--- a/screenplain/export/html.py
+++ b/screenplain/export/html.py
@@ -61,6 +61,24 @@ def format_slug(slug, out):
out.write('</h2>')
+def format_action(para, out):
+ if para.centered:
+ out.write('<div class="action centered">')
+ else:
+ out.write('<div class="action">')
+ for line in para.lines:
+ out.write('<p>')
+ out.write(to_html(line))
+ out.write('</p>')
+ out.write('</div>')
+
+
+def format_transition(para, out):
+ out.write('<div class="transition">')
+ out.write(to_html(para.line))
+ out.write('</div>')
+
+
def _read_file(filename):
path = os.path.join(os.path.dirname(__file__), filename)
with open(path) as stream:
@@ -117,6 +135,8 @@ def convert_bare(screenplay, out):
if isinstance(para, Slug):
# Slugs are h2 tags not inside a div
format_slug(para, out)
+ elif isinstance(para, Action):
+ format_action(para, out)
elif isinstance(para, Dialog):
out.write('<div class="dialog">')
format_dialog(para, out)
@@ -125,14 +145,8 @@ def convert_bare(screenplay, out):
out.write('<div class="dual">')
format_dual(para, out)
out.write('</div>')
+ elif isinstance(para, Transition):
+ format_transition(para, out)
else:
- classname = types.get(type(para))
- out.write('<div class="')
- out.write(classname)
- out.write('">')
- for line in para.lines:
- out.write('<p>')
- out.write(to_html(line))
- out.write('</p>')
- out.write('</div>')
+ assert False, 'Unknown type: %s' % type(para)
out.write('\n')