diff options
| author | Charlotte Koch <charlotte@magentastripe.com> | 2024-12-18 11:44:44 -0800 |
|---|---|---|
| committer | Charlotte Koch <dressupgeekout@gmail.com> | 2024-12-18 11:44:44 -0800 |
| commit | cba0ad3c769588c43649d8a715cbcafa2df2b14b (patch) | |
| tree | 5bc83e5120b2411c65e7ed87a9f467bd981f64b1 | |
| parent | 13b79f2dd0bf8f584965269137893dea50378b39 (diff) | |
WIP add option to include double-bracketed notes in PDF outputmsm_notes
| -rw-r--r-- | screenplain/export/pdf.py | 10 | ||||
| -rw-r--r-- | screenplain/main.py | 8 | ||||
| -rw-r--r-- | screenplain/types.py | 4 |
3 files changed, 21 insertions, 1 deletions
diff --git a/screenplain/export/pdf.py b/screenplain/export/pdf.py index 5c15de5..6bfb760 100644 --- a/screenplain/export/pdf.py +++ b/screenplain/export/pdf.py @@ -46,6 +46,7 @@ class Settings: centered_action_style: ParagraphStyle slug_style: ParagraphStyle transition_style: ParagraphStyle + note_style: ParagraphStyle # Title page styles title_style: ParagraphStyle @@ -151,7 +152,12 @@ class Settings: spaceAfter=line_height, alignment=TA_RIGHT, ) - + self.notes_style = ParagraphStyle( + 'note', default_style, + spaceBefore=line_height, + spaceAfter=line_height, + alignment=TA_LEFT, + ) self.title_style = ParagraphStyle( 'title', default_style, fontSize=font_size * 2, leading=font_size * 3, @@ -357,6 +363,8 @@ def to_pdf( add_slug(story, para, settings.slug_style, settings.strong_slugs) elif isinstance(para, Transition): add_paragraph(story, para, settings.transition_style) + elif isinstance(para, Note): + add_paragraph(story, para, settings.note_style) elif isinstance(para, types.PageBreak): story.append(platypus.PageBreak()) else: diff --git a/screenplain/main.py b/screenplain/main.py index 333eb5a..0a9646d 100644 --- a/screenplain/main.py +++ b/screenplain/main.py @@ -67,6 +67,13 @@ def main(args): ) ) parser.add_option( + '--pdf-notes', + action='store_true', + dest='notes', + help=( + 'Include notes (double-brackets) in PDF output.' + ) + parser.add_option( '--encoding', default='utf-8-sig', help="Text encoding of the input file. " + @@ -149,6 +156,7 @@ def main(args): from screenplain.export import pdf settings = pdf.create_default_settings() settings.strong_slugs = options.strong + settings.include_notes = options.pdf_notes pdf.to_pdf(screenplay, output, settings=settings) finally: if output_file: diff --git a/screenplain/types.py b/screenplain/types.py index 0325148..4bdb417 100644 --- a/screenplain/types.py +++ b/screenplain/types.py @@ -131,5 +131,9 @@ class Transition(object): return [self.line] +class Note(object): + def __init__(self, line): + self.line = line + class PageBreak(object): pass |
