Split travel and product-test via explicit report-type templates.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-21 14:31:22 +03:30
parent 89fa657df8
commit c188a6387a
10 changed files with 55 additions and 10 deletions

View File

@@ -22,6 +22,8 @@ uv pip install --python .venv-pdf/bin/python weasyprint
## Quick start
Always render from this project root so `_quarto.yml` applies (RTL CSS, filters, PDF post-render):
```bash
quarto render examples/travel-report.qmd
quarto render examples/product-test.qmd
@@ -29,12 +31,32 @@ quarto render examples/product-test.qmd
Outputs land in `_output/` (HTML + PDF). PDF is produced by `scripts/html-to-pdf.py` in `project.post-render`.
## Report types
## Templates
| Type | Example | Notes |
| --- | --- | --- |
| Travel / mission | `examples/travel-report.qmd` | Set `purpose` (and usually `destinations`, `report-date`) so the PDF title block shows travel meta (مقصد، هدف مأموریت، تیم، تاریخ). |
| Product / raw-material test | `examples/product-test.qmd` | Omit `purpose`. Put general info, samples, formula, and results in the body as Markdown tables (ported from Typst helpers in `typst-templates`). `destinations` is optional sidebar text. |
Two named metadata templates (Typst-style explicit choice). Pick one via `metadata-files` in the `.qmd` frontmatter — that sets `report-type` and controls whether the travel meta block is injected. Document type is **not** inferred from `purpose`.
| Template | File | `report-type` | Example |
| --- | --- | --- | --- |
| Travel / mission | `templates/travel.yml` | `travel` | `examples/travel-report.qmd` |
| Product / raw-material test | `templates/product-test.yml` | `product-test` | `examples/product-test.qmd` |
### Start a new report
1. Copy the matching example `.qmd` (keep its `metadata-files` line pointing at `templates/travel.yml` or `templates/product-test.yml`).
2. Fill frontmatter and body.
3. Render with `quarto render` from this repo root.
### Travel fields
Content for the PDF «اطلاعات کلی» block (only when using the travel template):
- `purpose` — هدف مأموریت
- `destinations` — مقصد (also used on the sidebar)
- `report-date` — تاریخ
### Product-test body
Put general info, samples, formula, and results in the body as Markdown tables. `destinations` is optional sidebar text. No `purpose` field is needed.
## Project layout
@@ -42,10 +64,12 @@ Outputs land in `_output/` (HTML + PDF). PDF is produced by `scripts/html-to-pdf
_quarto.yml
styles/report.css # HTML screen theme
styles/print.css # PDF / print (typst-templates match)
filters/print-chrome.lua # title block + sidebar injection
filters/print-chrome.lua # title block + sidebar + travel meta
scripts/html-to-pdf.py # WeasyPrint post-render
assets/fonts/
assets/logo.png
templates/travel.yml
templates/product-test.yml
examples/travel-report.qmd
examples/product-test.qmd
```