feat: add xhtmlmp renderer
This commit is contained in:
parent
3ed0b5807c
commit
3af44fb0ac
14 changed files with 524 additions and 7 deletions
|
|
@ -25,11 +25,11 @@ def render_source(text: str, **options: Any) -> str:
|
|||
return convert(body, config=config, base_path=EXAMPLES).text
|
||||
|
||||
|
||||
def render_file(path: Path, **options: Any) -> DeckOutput:
|
||||
def render_file(path: Path, *, renderer_name: str = "wml", **options: Any):
|
||||
lines = read_lines(path)
|
||||
frontmatter, body = strip_frontmatter(lines)
|
||||
config = DeckConfig.resolve(frontmatter, options)
|
||||
return convert(body, config=config, base_path=path.parent)
|
||||
return convert(body, config=config, base_path=path.parent, renderer_name=renderer_name)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -37,6 +37,19 @@ def render():
|
|||
return render_source
|
||||
|
||||
|
||||
def render_xhtmlmp_source(text: str, **options: Any) -> str:
|
||||
"""Like `render_source`, but through the XHTML-MP renderer."""
|
||||
lines = text.splitlines(keepends=True)
|
||||
frontmatter, body = strip_frontmatter(lines)
|
||||
config = DeckConfig.resolve(frontmatter, options)
|
||||
return convert(body, config=config, base_path=EXAMPLES, renderer_name="xhtmlmp")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def render_xhtmlmp():
|
||||
return render_xhtmlmp_source
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def render_output():
|
||||
"""Like `render`, but exposes every output file (deck-per-card mode)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue