From e991ce4bb9d39d96bcf7984522e8340326d93f48 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Fri, 24 Feb 2023 10:24:31 +0100 Subject: Possible to force action by starting line with ! Closes #63 --- screenplain/parsers/fountain.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py index 7f367aa..587eadc 100644 --- a/screenplain/parsers/fountain.py +++ b/screenplain/parsers/fountain.py @@ -57,6 +57,7 @@ class InputParagraph(object): Modifies the `previous_paragraphs` list. """ ( + self.append_forced_action(previous_paragraphs) or self.append_page_break(previous_paragraphs) or self.append_synopsis(previous_paragraphs) or self.append_sections_and_synopsises(previous_paragraphs) or @@ -170,9 +171,18 @@ class InputParagraph(object): return False + def append_forced_action(self, paragraphs): + if self.lines[0].startswith('!'): + return self.append_action(paragraphs) + else: + return False + def append_action(self, paragraphs): paragraphs.append( - Action(_sequence_to_rich(line.rstrip() for line in self.lines)) + Action(_sequence_to_rich( + line[1:].rstrip() if line.startswith('!') else line.rstrip() + for line in self.lines + )) ) return True -- cgit