parse_script#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.frontends.script_front.parse_script(text, *, source=None)[source]#
Parse a comic script into validated IR, one scene graph per panel, without compiling it.
The comic-script format is the one writers already use:
PANELheadings, a description, then each speaker’s name in capitals over their line. Its front matter, between---lines, is YAML.- Parameters:
- Return type:
- Returns:
Panel name to scene graph, in the order the panels appear.
- Raises:
ScriptSyntaxError – The script cannot be parsed – no
PANELheading, or dialogue before the first – or a panel does not validate. Itslinesays where.
Note
A page heading groups panels for reading only; a script has no page layout.
Example
>>> from scenet import parse_script >>> panels = parse_script( ... "---\ncast: {ALICE: {reference: alice}}\n---\n" ... "PANEL 1\n\nALICE\nYou forgot your umbrella!\n" ... ) >>> [event.text for event in next(iter(panels.values())).script] ['You forgot your umbrella!']
See also
compile_script, to compile it.load_script, to read a file.