diff options
author | Martin Vilcans <martin@librador.com> | 2023-02-24 10:24:31 +0100 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2023-02-24 10:24:31 +0100 |
commit | e991ce4bb9d39d96bcf7984522e8340326d93f48 (patch) | |
tree | 7e0259c8f3648f362b758e66af7d2d944662fbf8 | |
parent | 7507fa2c44e1373b7b14c86eb52dd4321e671c65 (diff) | |
download | screenplain-e991ce4bb9d39d96bcf7984522e8340326d93f48.tar.gz |
Possible to force action by starting line with !
Closes #63
-rw-r--r-- | screenplain/parsers/fountain.py | 12 |
1 files changed, 11 insertions, 1 deletions
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 |