Switch PDF generation from Typst to WeasyPrint to match typst-templates layout.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
32
README.md
32
README.md
@@ -4,13 +4,21 @@ Quarto templates for Kimia Razi Persian (RTL) business reports.
|
||||
|
||||
One `.qmd` source renders to:
|
||||
|
||||
- **HTML** — simple RTL reading layout (no PDF chrome)
|
||||
- **PDF** — via Typst (`format: typst`), with print-oriented layout
|
||||
- **HTML** — simple RTL reading layout (no print chrome on screen)
|
||||
- **PDF** — via WeasyPrint from the HTML, matching `typst-templates` page chrome (sidebar, header, title block, tables)
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Quarto](https://quarto.org/) 1.9+ (bundles Typst)
|
||||
- Fonts in `assets/fonts/` (`IRNazanin`, `IRZar`, `IRLotus`)
|
||||
- [Quarto](https://quarto.org/) 1.7+
|
||||
- [WeasyPrint](https://weasyprint.org/) (for PDF)
|
||||
- Fonts in `assets/fonts/` (`IRNazanin`, `IRZar`, …)
|
||||
|
||||
Install WeasyPrint once in this repo:
|
||||
|
||||
```bash
|
||||
uv venv .venv-pdf
|
||||
uv pip install --python .venv-pdf/bin/python weasyprint
|
||||
```
|
||||
|
||||
## Quick start
|
||||
|
||||
@@ -19,7 +27,7 @@ quarto render examples/travel-report.qmd
|
||||
quarto render examples/product-test.qmd
|
||||
```
|
||||
|
||||
Outputs land in `_output/` (HTML + PDF).
|
||||
Outputs land in `_output/` (HTML + PDF). PDF is produced by `scripts/html-to-pdf.py` in `project.post-render`.
|
||||
|
||||
## Report types
|
||||
|
||||
@@ -32,9 +40,11 @@ Outputs land in `_output/` (HTML + PDF).
|
||||
|
||||
```
|
||||
_quarto.yml
|
||||
styles/report.css # HTML RTL theme
|
||||
templates/typst/ # Typst PDF partials
|
||||
assets/fonts/ # Persian fonts
|
||||
styles/report.css # HTML screen theme
|
||||
styles/print.css # PDF / print (typst-templates match)
|
||||
filters/print-chrome.lua # title block + sidebar injection
|
||||
scripts/html-to-pdf.py # WeasyPrint post-render
|
||||
assets/fonts/
|
||||
assets/logo.png
|
||||
examples/travel-report.qmd
|
||||
examples/product-test.qmd
|
||||
@@ -42,6 +52,6 @@ examples/product-test.qmd
|
||||
|
||||
## Notes
|
||||
|
||||
- HTML does **not** visually match the PDF (no sidebar/header parity; tables may differ).
|
||||
- This repo rewrites `typst-templates` (pure Typst PDF library) for Quarto HTML + Typst PDF.
|
||||
- Typst helpers such as `general_info_table` / `pigment_result_block` become ordinary Markdown tables in `.qmd` sources.
|
||||
- PDF layout targets `typst-templates` (`product_test_template.typ` / `travel-report-template.typ`): A4, RTL, rotated left sidebar with page `n / N`, running header on page 2+, content-sized tables with grey header row.
|
||||
- HTML on screen stays a simple reading view; print chrome is `display: none` until print/PDF.
|
||||
- Typst is not used for PDF generation.
|
||||
|
||||
Reference in New Issue
Block a user