diff options
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | screenplain/parsers/fountain.py | 2 | ||||
-rw-r--r-- | tests/fountain_test.py | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/requirements.txt b/requirements.txt index dd42aec..321e747 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ reportlab unittest2 +nose +pep8 diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py index f7093cb..15b0755 100644 --- a/screenplain/parsers/fountain.py +++ b/screenplain/parsers/fountain.py @@ -28,7 +28,7 @@ title_page_value_re = re.compile(r'(?:\s{3,}|\t)(.+)') centered_re = re.compile(r'\s*>\s*(.*?)\s*<\s*$') dual_dialog_re = re.compile(r'^(.+?)(\s*\^)$') -slug_re = re.compile(r'(?:(\.)\s*)?(\S.*?)\s*$') +slug_re = re.compile(r'(?:(\.)(?=[^.])\s*)?(\S.*?)\s*$') scene_number_re = re.compile(r'(.*?)\s*(?:#([\w\-.]+)#)\s*$') section_re = re.compile(r'^(#{1,6})\s*([^#].*)$') transition_re = re.compile(r'(>?)\s*(.+?)(TO:)?$') diff --git a/tests/fountain_test.py b/tests/fountain_test.py index 47bd270..02bb6be 100644 --- a/tests/fountain_test.py +++ b/tests/fountain_test.py @@ -64,6 +64,15 @@ class SlugTests(unittest2.TestCase): self.assertEquals(Slug, type(paras[0])) self.assertEquals(plain('SNIPER SCOPE POV'), paras[0].line) + def test_more_than_one_period_does_not_create_slug(self): + paras = parse([ + '..AND THEN...', + '', + ]) + self.assertEquals(1, len(paras)) + self.assertEquals(Action, type(paras[0])) + self.assertEquals(plain('..AND THEN...'), paras[0].lines[0]) + def test_scene_number_is_parsed(self): paras = parse(['EXT SOMEWHERE - DAY #42#']) self.assertEquals(plain('EXT SOMEWHERE - DAY'), paras[0].line) |