diff --git a/README.md b/README.md index 261dfdb..d3911a6 100644 --- a/README.md +++ b/README.md @@ -27,22 +27,24 @@ Always render from this project root so `_quarto.yml` applies (RTL CSS, filters, ```bash quarto render examples/travel-report.qmd quarto render examples/product-test.qmd +quarto render examples/travel-expense.qmd ``` Outputs land in `_output/` (HTML + PDF). PDF is produced by `scripts/html-to-pdf.py` in `project.post-render`. ## Templates -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`. +Three 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` | +| Travel / mission expense | `templates/travel-expense.yml` | `travel-expense` | `examples/travel-expense.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`). +1. Copy the matching example `.qmd` (keep its `metadata-files` line pointing at `templates/travel.yml`, `templates/product-test.yml`, or `templates/travel-expense.yml`). 2. Fill frontmatter and body. 3. Render with `quarto render` from this repo root. @@ -58,6 +60,10 @@ Content for the PDF «اطلاعات کلی» block (only when using the travel Put general info, samples, formula, and results in the body as Markdown tables. `destinations` is optional sidebar text. No `purpose` field is needed. +### Travel-expense body + +Write a short formal letter in the body (addressee, greeting, mission meta, aligned expense list, notes, signature). `destinations` is sidebar text. No travel «اطلاعات کلی» block is injected. + ## Project layout ``` @@ -70,8 +76,10 @@ assets/fonts/ assets/logo.png templates/travel.yml templates/product-test.yml +templates/travel-expense.yml examples/travel-report.qmd examples/product-test.qmd +examples/travel-expense.qmd ``` ## Notes diff --git a/examples/travel-expense.qmd b/examples/travel-expense.qmd new file mode 100644 index 0000000..57c2152 --- /dev/null +++ b/examples/travel-expense.qmd @@ -0,0 +1,44 @@ +--- +metadata-files: + - ../templates/travel-expense.yml +title: "هزینه‌های مأموریت" +subtitle: "دپارتمان جوهر" +company: "کیمیا رازی" +logofile: "../assets/logo.png" +sidebarfont: IRZar +author: + - name: دیاکو سلطانپور + email: diaco@kimiarazi.com + affiliations: کیمیا رازی - واحد جوهر +report-date: "۱۴۰۵/۰۳/۱۱" +destinations: + - کاشی آسیا + - اصفهان +--- + +::: {.letter-date} +تاریخ: ۱۴۰۵/۰۶/۱۶ +::: + +**مدیریت محترم کارخانه** + +با سلام + +احتراماً هزینه‌های مأموریت شهر اصفهان را به شرح زیر به اطلاع می‌رساند: + +- کارشناس اعزامی: دیاکو سلطانپور - مهراد موبدی +- کارخانه: کاشی آسیا +- تاریخ مأموریت: ۱۴۰۵/۵/۳۱ الی ۱۴۰۵/۶/۳ + +::: {.expense-amounts} +- [هزینه‌های بدون فاکتور:]{.desc} [۱،۸۰۰،۰۰۰]{.amount} [ریال]{.currency} +- [هزینه‌های با فاکتور:]{.desc} [۱۱۸،۹۴۹،۹۹۸]{.amount} [ریال]{.currency} +- [جمع کل:]{.desc} [۱۲۰،۷۴۹،۹۹۸]{.amount} [ریال]{.currency} +::: + +- هزینه‌های بدون فاکتور مربوط به خرید بین راه است. +- تاخیر در ارایه فاکتورها به دلیل تأخیر شرکت‌های ماکسیم و علی بابا در صدور فاکتور به دلیل قطعی اینترنت است. + +::: {.letter-signature} +دیاکو سلطانپور +::: diff --git a/styles/print.css b/styles/print.css index bbd2e8a..ae84374 100644 --- a/styles/print.css +++ b/styles/print.css @@ -87,7 +87,8 @@ body { direction: rtl; font-family: "IRNazanin", sans-serif; font-size: 13pt; - line-height: 1.2; + /* typst-templates use par(leading: 1.2em) — additive space, not CSS 1.2× */ + line-height: 1.65; color: var(--text); background: #ffffff; margin: 0; @@ -302,18 +303,18 @@ h3 { } p { - margin: 0.4em 0 0.7em 0; + margin: 0.5em 0 0.85em 0; text-align: justify; } ul, ol { - margin: 0.4em 0 0.8em 0; + margin: 0.5em 0 0.9em 0; padding-right: 1.4em; padding-left: 0; } li { - margin: 0.2em 0; + margin: 0.35em 0; text-align: justify; } @@ -351,6 +352,73 @@ tbody tr + tr td { border-top: 1pt solid var(--stroke); } +.table-body-right tbody td { + text-align: right; +} + +.letter-date { + margin: 0 0 12pt 0; +} + +.letter-date p, +.letter-signature p { + text-align: left !important; +} + +.letter-signature { + margin: 56pt 0 0 0; + padding-left: 2.5cm; +} + +.expense-amounts { + margin: 28pt 0 32pt 0; + padding-right: 24pt; + direction: rtl; +} + +.expense-amounts > ul { + list-style: circle; + margin: 0; + padding-right: 4em; + padding-left: 0; + direction: rtl; +} + +.expense-amounts li { + direction: rtl; + unicode-bidi: embed; + margin: 0.35em 0; + text-align: right; +} + +.expense-amounts .desc, +.expense-amounts .amount, +.expense-amounts .currency { + direction: rtl; + unicode-bidi: isolate; +} + +.expense-amounts .desc { + display: inline-block; + min-width: 12.5rem; + text-align: right; +} + +.expense-amounts .amount { + display: inline-block; + min-width: 8.5rem; + font-variant-numeric: tabular-nums; + text-align: right; + white-space: nowrap; +} + +.expense-amounts .currency { + display: inline-block; + min-width: 2.5rem; + text-align: right; + white-space: nowrap; +} + table [dir="ltr"], table .ltr { direction: ltr; diff --git a/styles/report.css b/styles/report.css index e3ce54e..07a00cb 100644 --- a/styles/report.css +++ b/styles/report.css @@ -41,6 +41,20 @@ h1, h2, h3 { line-height: 1.4; } +p { + margin: 0.5em 0 0.85em 0; +} + +ul, ol { + margin: 0.5em 0 0.9em 0; + padding-right: 1.4em; + padding-left: 0; +} + +li { + margin: 0.35em 0; +} + /* Quarto default title — replaced by .print-title-block (same as PDF) */ #title-block-header, header#title-block-header, @@ -149,6 +163,74 @@ tbody tr + tr td { border-top: 1px solid var(--stroke); } +.table-body-right tbody td { + text-align: right; +} + +/* Letter date / signature — left edge (Word jc=end / left block) */ +.letter-date { + margin: 0 0 1.25rem 0; +} + +.letter-date p, +.letter-signature p { + text-align: left; +} + +.letter-signature { + margin: 5rem 0 0 0; + padding-left: 2.5rem; +} + +/* Expense amounts: bullet | desc | : amount | currency (Word tab columns) */ +.expense-amounts { + margin: 2.7rem 0 3rem 0; + padding-right: 2.5rem; + direction: rtl; +} + +.expense-amounts > ul { + list-style: circle; + margin: 0; + padding-right: 4.2em; + padding-left: 0; + direction: rtl; +} + +.expense-amounts li { + direction: rtl; + unicode-bidi: embed; + margin: 0.45em 0; +} + +.expense-amounts .desc, +.expense-amounts .amount, +.expense-amounts .currency { + direction: rtl; + unicode-bidi: isolate; +} + +.expense-amounts .desc { + display: inline-block; + min-width: 12.5rem; + text-align: right; +} + +.expense-amounts .amount { + display: inline-block; + min-width: 8.5rem; + font-variant-numeric: tabular-nums; + text-align: right; + white-space: nowrap; +} + +.expense-amounts .currency { + display: inline-block; + min-width: 2.5rem; + text-align: right; + white-space: nowrap; +} + /* Keep compound LTR numerics (e.g. 0.850 ± 0.05) in visual LTR order inside RTL tables */ table [dir="ltr"], table .ltr { diff --git a/templates/travel-expense.yml b/templates/travel-expense.yml new file mode 100644 index 0000000..ecfed9c --- /dev/null +++ b/templates/travel-expense.yml @@ -0,0 +1,5 @@ +# Travel / mission expense letter template. +# Include from a .qmd with: +# metadata-files: +# - ../templates/travel-expense.yml +report-type: travel-expense