Source code for jamb.publish.formats
"""Output formats supported by the publishing system."""
from __future__ import annotations
from enum import Enum
from pathlib import Path
#: File extensions mapped to the format they select during auto-detection.
_EXTENSIONS: dict[str, OutputFormat] = {
".html": OutputFormat.HTML,
".htm": OutputFormat.HTML,
".docx": OutputFormat.DOCX,
".pdf": OutputFormat.PDF,
".md": OutputFormat.MD,
".markdown": OutputFormat.MD,
".qmd": OutputFormat.QMD,
}
#: Formats that are produced by invoking Quarto, mapped to the Quarto
#: ``--to`` target. Formats absent from this mapping are written directly.
QUARTO_TARGET: dict[OutputFormat, str] = {
OutputFormat.HTML: "html",
OutputFormat.DOCX: "docx",
OutputFormat.PDF: "typst",
}
#: The file extension Quarto produces for each rendered format.
RENDERED_EXTENSION: dict[OutputFormat, str] = {
OutputFormat.HTML: ".html",
OutputFormat.DOCX: ".docx",
OutputFormat.PDF: ".pdf",
}