feat: pandoc/print.css – Druck-Layout für PDFs mit weasyprint
- A4, Seitenzahlen, jedes Kapitel auf neuer Seite, Inhaltsverzeichnis auf eigener Seite, Silbentrennung (nicht in Code), umbrechende Codezeilen; bringt Grundschrift und Titelkopf mit, da --css Pandocs Standard-CSS ersetzt - Buch-README: zusätzlicher weasyprint-Befehl mit Filter und print.css - Doku: Bedienungsanleitung und README um den weasyprint-Weg ergänzt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c761a53728
commit
13617c8d3e
1 changed files with 52 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ from .references import LinkResolver
|
|||
from .utils import rel_link, to_yaml, url_path
|
||||
|
||||
CALLOUT_FILTER = Path(__file__).resolve().parent.parent / "pandoc" / "callouts.lua"
|
||||
PRINT_CSS = Path(__file__).resolve().parent.parent / "pandoc" / "print.css"
|
||||
|
||||
SPECIAL_LABELS = {
|
||||
"glossary": "Glossar",
|
||||
|
|
@ -146,6 +147,12 @@ def readme(md: BookMetadata, chapters: list[Chapter], endnotes: Chapter | None,
|
|||
f"pandoc {shlex.quote(stem + '.md')} -s{math}{lua} -o {shlex.quote(stem + '.html')} && "
|
||||
f"pandoc {shlex.quote(stem + '.html')} --toc{lua} --pdf-engine=xelatex -o {shlex.quote(stem + '.pdf')}",
|
||||
]
|
||||
if PRINT_CSS.is_file():
|
||||
commands += [
|
||||
"# PDF ohne LaTeX mit weasyprint: Farben, Kästen und HTML-Stile bleiben erhalten",
|
||||
f"pandoc {shlex.quote(stem + '.md')} -s --toc{math}{lua} --css {shlex.quote(str(PRINT_CSS))} "
|
||||
f"--pdf-engine=weasyprint -o {shlex.quote(stem + '.pdf')}",
|
||||
]
|
||||
out.append("## Weiterverarbeitung")
|
||||
out.append("```bash\n" + "\n".join(commands) + "\n```")
|
||||
if callouts:
|
||||
|
|
|
|||
Loading…
Reference in a new issue