compile_document#

Import

from scenet import compile_document

Defined in

scenet.pipeline (source)

Install

pip install scenet

Since

0.1

Stability

Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how.

scenet.pipeline.compile_document(path, *, library=None, metrics=None)[source]#

Compile any supported file’s panels, choosing the frontend by extension.

The panels of compile_book_file, without its pages: what to reach for when the syntax is the user’s choice and the panels are what you draw.

Parameters:
  • path (Path) – A *.panel.yaml, *.scene.yaml or *.script file.

  • library (PuppetLibrary | None) – Characters to draw from. Defaults to the two shipped puppets.

  • metrics (FontMetrics | None) – Font to measure lettering against. Defaults to the shipped one.

Return type:

dict[str, CompileResult]

Returns:

Panel name to its compiled result. A single panel is named panel.

Raises:

Note

Pages are compiled and dropped. Call compile_book_file to keep them.

Example

>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from scenet import compile_document
>>> with TemporaryDirectory() as folder:
...     path = Path(folder) / "hello.panel.yaml"
...     _ = path.write_text("cast: {a: {reference: alice}}", encoding="utf-8")
...     panels = compile_document(path)
>>> list(panels)
['panel']

See also

compile_book_file, for the pages too.