From 4d50fbdc2b58d9744e80b04518f22fb7a3da5699 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Mon, 28 Nov 2011 00:47:06 +0100 Subject: Slug and Transition support only one line. Show that in parameter to __init__. --- screenplain/parsers/spmd.py | 4 ++-- screenplain/types.py | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/screenplain/parsers/spmd.py b/screenplain/parsers/spmd.py index 6348d75..39e6b50 100644 --- a/screenplain/parsers/spmd.py +++ b/screenplain/parsers/spmd.py @@ -64,7 +64,7 @@ def _to_rich(line_list): def create_paragraph(blanks_before, line_list): if is_slug(blanks_before, line_list): - return Slug(_to_rich(line_list)) + return Slug(_to_rich(line_list)[0]) elif all(centered_re.match(line) for line in line_list): return Action(_to_rich( centered_re.match(line).group(1) for line in line_list @@ -81,7 +81,7 @@ def create_paragraph(blanks_before, line_list): ): # Assume this is a transition. It may be changed to Action # later if we find that it's not followed by a slug. - return Transition(_to_rich(line_list)) + return Transition(_to_rich(line_list)[0]) else: return Action(_to_rich(line_list)) diff --git a/screenplain/types.py b/screenplain/types.py index 1eb7c26..1a82f5a 100644 --- a/screenplain/types.py +++ b/screenplain/types.py @@ -5,8 +5,12 @@ class Slug(object): indent = '' top_margin = 1 - def __init__(self, lines): - self.line = lines[0] + def __init__(self, line): + self.line = line + + @property + def lines(self): + return [self.line] class Dialog(object): @@ -88,17 +92,17 @@ class Action(object): yield self.indent + line -class Centered(Action): - pass - - class Transition(object): indent = '' fill = 68 top_margin = 1 - def __init__(self, lines): - self.lines = lines + def __init__(self, line): + self.line = line + + @property + def lines(self): + return [self.line] def format(self): for logical_line in self.lines: -- cgit