Compare commits
13 Commits
3cdc5918a9
...
cursor/tra
| Author | SHA1 | Date | |
|---|---|---|---|
| 2db757877a | |||
| 46505eb3ee | |||
| 8f522bc09d | |||
| 570eb12e24 | |||
| 9d6a01f010 | |||
| 8ce14b37ac | |||
| c188a6387a | |||
| 89fa657df8 | |||
| e3980c5777 | |||
| 6159e46da8 | |||
| 727e038ca7 | |||
| f98054498d | |||
| 35cfad978b |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,7 +4,8 @@ _output/
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.typ
|
*.typ
|
||||||
!templates/**/*.typ
|
|
||||||
/.quarto/
|
/.quarto/
|
||||||
|
.venv-pdf/
|
||||||
|
report/
|
||||||
|
|
||||||
**/*.quarto_ipynb
|
**/*.quarto_ipynb
|
||||||
|
|||||||
72
README.md
72
README.md
@@ -4,34 +4,86 @@ Quarto templates for Kimia Razi Persian (RTL) business reports.
|
|||||||
|
|
||||||
One `.qmd` source renders to:
|
One `.qmd` source renders to:
|
||||||
|
|
||||||
- **HTML** — simple RTL reading layout (no PDF chrome)
|
- **HTML** — RTL reading layout with the same title block as PDF (company, logo, report title)
|
||||||
- **PDF** — via Typst (`format: typst`), with print-oriented layout
|
- **PDF** — via WeasyPrint from the HTML, matching `typst-templates` page chrome (sidebar, header, title block, tables)
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- [Quarto](https://quarto.org/) 1.9+ (bundles Typst)
|
- [Quarto](https://quarto.org/) 1.7+
|
||||||
- Fonts in `assets/fonts/` (`IRNazanin`, `IRZar`, `IRLotus`)
|
- [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
|
## Quick start
|
||||||
|
|
||||||
|
Always render from this project root so `_quarto.yml` applies (RTL CSS, filters, PDF post-render):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
quarto render examples/travel-report.qmd
|
quarto render examples/travel-report.qmd
|
||||||
|
quarto render examples/product-test.qmd
|
||||||
|
quarto render examples/travel-expense.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`.
|
||||||
|
|
||||||
|
## Templates
|
||||||
|
|
||||||
|
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`, `templates/product-test.yml`, or `templates/travel-expense.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.
|
||||||
|
|
||||||
|
### 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
|
## Project layout
|
||||||
|
|
||||||
```
|
```
|
||||||
_quarto.yml
|
_quarto.yml
|
||||||
styles/report.css # HTML RTL theme
|
styles/report.css # HTML screen theme
|
||||||
templates/typst/ # Typst PDF partials
|
styles/print.css # PDF / print (typst-templates match)
|
||||||
assets/fonts/ # Persian fonts
|
filters/print-chrome.lua # title block + sidebar + travel meta
|
||||||
|
scripts/html-to-pdf.py # WeasyPrint post-render
|
||||||
|
assets/fonts/
|
||||||
assets/logo.png
|
assets/logo.png
|
||||||
|
templates/travel.yml
|
||||||
|
templates/product-test.yml
|
||||||
|
templates/travel-expense.yml
|
||||||
examples/travel-report.qmd
|
examples/travel-report.qmd
|
||||||
|
examples/product-test.qmd
|
||||||
|
examples/travel-expense.qmd
|
||||||
```
|
```
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- HTML does **not** visually match the PDF (no sidebar/header parity; tables may differ).
|
- 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.
|
||||||
- This repo is separate from `typst-templates` (pure Typst PDF library).
|
- HTML on screen shows the shared title block (logo + company | subtitle + report title); running header and sidebar stay `display: none` until print/PDF.
|
||||||
|
- Typst is not used for PDF generation.
|
||||||
|
|||||||
27
_quarto.yml
27
_quarto.yml
@@ -1,29 +1,20 @@
|
|||||||
project:
|
project:
|
||||||
type: default
|
type: default
|
||||||
output-dir: _output
|
output-dir: _output
|
||||||
|
post-render:
|
||||||
|
- scripts/html-to-pdf.py
|
||||||
|
|
||||||
format:
|
format:
|
||||||
html:
|
html:
|
||||||
lang: fa
|
lang: fa
|
||||||
dir: rtl
|
dir: rtl
|
||||||
theme: none
|
theme: none
|
||||||
css: styles/report.css
|
css:
|
||||||
|
- styles/report.css
|
||||||
|
- styles/print.css
|
||||||
embed-resources: true
|
embed-resources: true
|
||||||
toc: false
|
toc: false
|
||||||
typst:
|
filters:
|
||||||
lang: fa
|
# print-chrome must run before html-no-extra-meta (needs author names)
|
||||||
mainfont: IRNazanin
|
- filters/print-chrome.lua
|
||||||
fontsize: 13pt
|
- filters/html-no-extra-meta.lua
|
||||||
papersize: a4
|
|
||||||
margin:
|
|
||||||
left: 2cm
|
|
||||||
right: 2cm
|
|
||||||
top: 2.5cm
|
|
||||||
bottom: 2.5cm
|
|
||||||
page-numbering: "۱"
|
|
||||||
font-paths:
|
|
||||||
- assets/fonts
|
|
||||||
template-partials:
|
|
||||||
- templates/typst/typst-template.typ
|
|
||||||
- templates/typst/typst-show.typ
|
|
||||||
- templates/typst/page.typ
|
|
||||||
|
|||||||
119
examples/product-test.qmd
Normal file
119
examples/product-test.qmd
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
---
|
||||||
|
metadata-files:
|
||||||
|
- ../templates/product-test.yml
|
||||||
|
title: "گزارش تست مواد اولیه"
|
||||||
|
subtitle: "دپارتمان جوهر"
|
||||||
|
company: "کیمیا رازی"
|
||||||
|
logofile: "../assets/logo.png"
|
||||||
|
sidebarfont: IRZar
|
||||||
|
author:
|
||||||
|
- name: دیاکو سلطانپور
|
||||||
|
email: diaco@kimiarazi.com
|
||||||
|
affiliations: کیمیا رازی - واحد جوهر
|
||||||
|
# Shown on the PDF sidebar (not the travel-report meta block).
|
||||||
|
destinations:
|
||||||
|
- نتایج تست پیگمنتهای شرکت اسمالتس
|
||||||
|
---
|
||||||
|
|
||||||
|
# اطلاعات کلی
|
||||||
|
|
||||||
|
| تاریخ دریافت نمونه | تاریخ گزارش | نوع نمونه | تعداد | تأمین کننده |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| ۱۴۰۵/۰۱/۱۷ | ۱۴۰۵/۰۱/۲۴ | پیگمنت | ۹ | Esmaltes |
|
||||||
|
|
||||||
|
## نمونههای دریافت شده
|
||||||
|
|
||||||
|
| نوع پیگمنت | کد تأمین کننده | کد داخلی | شماره سند |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| پیگمنت زرد | CLCE-539/1 | PI-Y36 | 2 |
|
||||||
|
| پیگمنت قهوهای | CLCE-539/2 | PI-DBR3 | 3 |
|
||||||
|
| پیگمنت بژ | CLCE-539/3 | PI-BG31 | 4 |
|
||||||
|
| پیگمنت بژ | CLCE-539/4 | PI-BG32 | 5 |
|
||||||
|
| پیگمنت آبی | CLCE-539/5 | PI-BL53 | 6 |
|
||||||
|
| پیگمنت آبی | CLCE-539/6 | PI-BL54 | 7 |
|
||||||
|
| پیگمنت مشکی | CLCE-539/7 | PI-BK38 | 8 |
|
||||||
|
| پیگمنت مشکی | CLCE-539/8 | PI-BK39 | 9 |
|
||||||
|
| پیگمنت صورتی | CLCE-539/9 | PI-P26 | 10 |
|
||||||
|
|
||||||
|
## تستهای انجام شده
|
||||||
|
|
||||||
|
با استفاده از این پیگمنتها نمونه جوهر ساخته و در کنار نمونه آزمایشگاهی ساخته شده با پیگمنت استاندارد کیمیا رازی با شرایط زیر تست شد.
|
||||||
|
|
||||||
|
- روش اعمال: قطرهای
|
||||||
|
- لعاب: سه لعاب مختلف (براق و مات)
|
||||||
|
- دمای پخت: ۱۰۳۰، ۱۱۵۰ و ۱۱۸۰ °C
|
||||||
|
- مرجع مقایسه: پیگمنت استاندارد کیمیا رازی
|
||||||
|
|
||||||
|
فرمول نمونه جوهر بر اساس درصد وزنی:
|
||||||
|
|
||||||
|
| پیگمنت | حلال | دیسپرسانت | جمع |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 30 | 60 | 10 | 100 |
|
||||||
|
|
||||||
|
تستها شامل:
|
||||||
|
|
||||||
|
- بررسی کیفیت سطح
|
||||||
|
- شدت رنگ
|
||||||
|
- تم رنگ
|
||||||
|
|
||||||
|
## نتایج تستها
|
||||||
|
|
||||||
|
### پیگمنت زرد
|
||||||
|
|
||||||
|
| معیار | CLCE-539/1 |
|
||||||
|
| --- | --- |
|
||||||
|
| کیفیت سطح | خوب |
|
||||||
|
| تم رنگ | چرک |
|
||||||
|
| شدت رنگ | خوب |
|
||||||
|
| نتیجه نهایی | نامناسب (تم چرک) |
|
||||||
|
|
||||||
|
### پیگمنت قهوهای
|
||||||
|
|
||||||
|
| معیار | CLCE-539/2 |
|
||||||
|
| --- | --- |
|
||||||
|
| کیفیت سطح | خوب |
|
||||||
|
| تم رنگ | خوب |
|
||||||
|
| شدت رنگ | کمتر |
|
||||||
|
| نتیجه نهایی | نامناسب (شدت رنگ کمتر) |
|
||||||
|
|
||||||
|
### پیگمنت بژ
|
||||||
|
|
||||||
|
| معیار | CLCE-539/3 | CLCE-539/4 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| کیفیت سطح | خوب | خوب |
|
||||||
|
| تم رنگ | خوب | خوب |
|
||||||
|
| شدت رنگ | خوب | خوب |
|
||||||
|
| نتیجه نهایی | متفاوت از رفرنس | متفاوت از رفرنس |
|
||||||
|
|
||||||
|
### پیگمنت آبی
|
||||||
|
|
||||||
|
| معیار | CLCE-539/5 | CLCE-539/6 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| کیفیت سطح | خوب | خوب |
|
||||||
|
| تم رنگ | خوب | تم سایان |
|
||||||
|
| شدت رنگ | کمتر | خوب |
|
||||||
|
| نتیجه نهایی | نامناسب (شدت رنگ کمتر) | مناسب برای سایان |
|
||||||
|
|
||||||
|
### پیگمنت مشکی
|
||||||
|
|
||||||
|
| معیار | CLCE-539/7 | CLCE-539/8 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| کیفیت سطح | خوب | خوب |
|
||||||
|
| تم رنگ | قهوهای | خوب |
|
||||||
|
| شدت رنگ | کمتر | کمتر |
|
||||||
|
| نتیجه نهایی | نامناسب (شدت رنگ کمتر) | نامناسب (شدت رنگ کمتر) |
|
||||||
|
|
||||||
|
### پیگمنت صورتی
|
||||||
|
|
||||||
|
به دلیل موجود کافی در انبار تست این پیگمنت به زمان دیگری موکول شد.
|
||||||
|
|
||||||
|
## جمع بندی نتایج
|
||||||
|
|
||||||
|
- بین پیگمنتهای بژ، نمونه CLCE-539/3 مشابه پیگمنت OC860A و نمونه CLCE-539/4 زردتر از آن است.
|
||||||
|
- در پیگمنتهای آبی، نمونه CLCE539/5 مشابه کد ICK12/K315 و نمونه CLCE539/6 دارای تم سایان است.
|
||||||
|
|
||||||
|
## پیشنهادات
|
||||||
|
|
||||||
|
هیچ کدام از پیگمنتها برای انجام تست صنعتی در نظر گرفته نشد ولی در صورت بروز مشکل در تأمین پیگمنتهای مصرفی کنونی، میتوان این نمونهها را به عنوان کاندید جایگزینی در نظر گرفت.
|
||||||
|
|
||||||
|
## نظر مدیر کارخانه
|
||||||
44
examples/travel-expense.qmd
Normal file
44
examples/travel-expense.qmd
Normal file
@@ -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}
|
||||||
|
دیاکو سلطانپور
|
||||||
|
:::
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
metadata-files:
|
||||||
|
- ../templates/travel.yml
|
||||||
title: "گزارش مأموریت"
|
title: "گزارش مأموریت"
|
||||||
subtitle: "دپارتمان جوهر"
|
subtitle: "دپارتمان جوهر"
|
||||||
company: "کیمیا رازی"
|
company: "کیمیا رازی"
|
||||||
@@ -22,7 +24,6 @@ format:
|
|||||||
<dt>تیم اعزامی</dt><dd>دیاکو سلطانپور</dd>
|
<dt>تیم اعزامی</dt><dd>دیاکو سلطانپور</dd>
|
||||||
<dt>تاریخ</dt><dd>شروع: ۰۵/۰۲/۲۷ — پایان: ۰۵/۰۲/۲۸</dd>
|
<dt>تاریخ</dt><dd>شروع: ۰۵/۰۲/۲۷ — پایان: ۰۵/۰۲/۲۸</dd>
|
||||||
</dl>
|
</dl>
|
||||||
typst: default
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# گزارش مأموریت
|
# گزارش مأموریت
|
||||||
|
|||||||
32
filters/html-no-extra-meta.lua
Normal file
32
filters/html-no-extra-meta.lua
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- Keep YAML author/title for print-chrome.lua injection,
|
||||||
|
-- but strip Quarto's visible title block (we render our own for PDF;
|
||||||
|
-- screen readers still get the document <title>).
|
||||||
|
function Meta(meta)
|
||||||
|
if quarto.doc.is_format("html") then
|
||||||
|
meta.author = nil
|
||||||
|
meta["by-author"] = nil
|
||||||
|
end
|
||||||
|
return meta
|
||||||
|
end
|
||||||
|
|
||||||
|
function Pandoc(doc)
|
||||||
|
if not quarto.doc.is_format("html") then
|
||||||
|
return doc
|
||||||
|
end
|
||||||
|
-- Drop Pandoc title-block header nodes if present in blocks
|
||||||
|
local out = {}
|
||||||
|
for _, block in ipairs(doc.blocks) do
|
||||||
|
local skip = false
|
||||||
|
if block.t == "Header" and block.level == 1 and doc.meta.title ~= nil then
|
||||||
|
local title = pandoc.utils.stringify(doc.meta.title)
|
||||||
|
if pandoc.utils.stringify(block.content) == title then
|
||||||
|
skip = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not skip then
|
||||||
|
table.insert(out, block)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
doc.blocks = out
|
||||||
|
return doc
|
||||||
|
end
|
||||||
15
filters/ltr-spans.lua
Normal file
15
filters/ltr-spans.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-- Preserve [text]{dir="ltr"} in Typst PDF (Pandoc HTML keeps the attribute;
|
||||||
|
-- Typst needs an explicit text(dir: ltr) wrapper).
|
||||||
|
function Span(el)
|
||||||
|
if not el.attributes or el.attributes.dir ~= "ltr" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if not quarto.doc.is_format("typst") then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local text = pandoc.utils.stringify(el.content)
|
||||||
|
:gsub("\\", "\\\\")
|
||||||
|
:gsub("%]", "\\]")
|
||||||
|
:gsub("@", "\\@")
|
||||||
|
return pandoc.RawInline("typst", "#text(dir: ltr)[" .. text .. "]")
|
||||||
|
end
|
||||||
214
filters/print-chrome.lua
Normal file
214
filters/print-chrome.lua
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
-- Inject typst-templates-style title block + sidebar into HTML for WeasyPrint PDF.
|
||||||
|
-- Title block is shared with screen HTML; .print-only (running header, sidebar) is screen-hidden.
|
||||||
|
|
||||||
|
local function stringify(v)
|
||||||
|
if v == nil then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
if type(v) == "string" then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
return pandoc.utils.stringify(v)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function escape_html(s)
|
||||||
|
s = stringify(s)
|
||||||
|
s = s:gsub("&", "&")
|
||||||
|
s = s:gsub("<", "<")
|
||||||
|
s = s:gsub(">", ">")
|
||||||
|
s = s:gsub('"', """)
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
local function meta_list_join(meta_val, sep)
|
||||||
|
if meta_val == nil then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
if pandoc.utils.type(meta_val) == "List" then
|
||||||
|
local parts = {}
|
||||||
|
for _, item in ipairs(meta_val) do
|
||||||
|
local t = stringify(item)
|
||||||
|
if t ~= "" then
|
||||||
|
table.insert(parts, t)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return table.concat(parts, sep or " - ")
|
||||||
|
end
|
||||||
|
return stringify(meta_val)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function author_names(meta)
|
||||||
|
if meta.author == nil then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local authors = meta.author
|
||||||
|
if pandoc.utils.type(authors) ~= "List" then
|
||||||
|
authors = { authors }
|
||||||
|
end
|
||||||
|
local names = {}
|
||||||
|
for _, a in ipairs(authors) do
|
||||||
|
if type(a) == "table" and a.name ~= nil then
|
||||||
|
table.insert(names, stringify(a.name))
|
||||||
|
else
|
||||||
|
local n = stringify(a)
|
||||||
|
if n ~= "" then
|
||||||
|
table.insert(names, n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return table.concat(names, " - ")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function path_exists(path)
|
||||||
|
if path == nil or path == "" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local f = io.open(path, "rb")
|
||||||
|
if f then
|
||||||
|
f:close()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function resolve_logo_path(logo)
|
||||||
|
if logo == nil or logo == "" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if path_exists(logo) then
|
||||||
|
return logo
|
||||||
|
end
|
||||||
|
local candidates = {}
|
||||||
|
if quarto.project ~= nil and quarto.project.directory ~= nil then
|
||||||
|
table.insert(candidates, pandoc.path.join({ quarto.project.directory, logo }))
|
||||||
|
end
|
||||||
|
if quarto.doc ~= nil and quarto.doc.input_file ~= nil then
|
||||||
|
local input_dir = pandoc.path.directory(quarto.doc.input_file)
|
||||||
|
table.insert(candidates, pandoc.path.join({ input_dir, logo }))
|
||||||
|
end
|
||||||
|
local cwd = pandoc.system.get_working_directory()
|
||||||
|
if cwd ~= nil then
|
||||||
|
table.insert(candidates, pandoc.path.join({ cwd, logo }))
|
||||||
|
end
|
||||||
|
for _, candidate in ipairs(candidates) do
|
||||||
|
if path_exists(candidate) then
|
||||||
|
return candidate
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return logo
|
||||||
|
end
|
||||||
|
|
||||||
|
local function file_to_data_uri(path)
|
||||||
|
if path == nil or path == "" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local f = io.open(path, "rb")
|
||||||
|
if not f then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local data = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
if data == nil or data == "" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local ok, encoded = pcall(pandoc.pipe, "base64", { "-w0" }, data)
|
||||||
|
if not ok or encoded == nil or encoded == "" then
|
||||||
|
ok, encoded = pcall(pandoc.pipe, "base64", {}, data)
|
||||||
|
if ok and encoded then
|
||||||
|
encoded = encoded:gsub("%s+", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not ok or encoded == nil or encoded == "" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local mime = "image/png"
|
||||||
|
if path:match("%.jpe?g$") then
|
||||||
|
mime = "image/jpeg"
|
||||||
|
elseif path:match("%.svg$") then
|
||||||
|
mime = "image/svg+xml"
|
||||||
|
end
|
||||||
|
return "data:" .. mime .. ";base64," .. encoded
|
||||||
|
end
|
||||||
|
|
||||||
|
function Meta(meta)
|
||||||
|
if not quarto.doc.is_format("html") then
|
||||||
|
return meta
|
||||||
|
end
|
||||||
|
|
||||||
|
local company = escape_html(meta.company or "کیمیا رازی")
|
||||||
|
local title = escape_html(meta.title or "")
|
||||||
|
local subtitle = escape_html(meta.subtitle or "")
|
||||||
|
local logo_path = resolve_logo_path(stringify(meta.logofile or "assets/logo.png"))
|
||||||
|
local logo_uri = file_to_data_uri(logo_path)
|
||||||
|
local destinations = escape_html(meta_list_join(meta.destinations, " - "))
|
||||||
|
local report_type = stringify(meta["report-type"])
|
||||||
|
local purpose = stringify(meta.purpose)
|
||||||
|
local report_date = escape_html(meta["report-date"] or meta.date or "")
|
||||||
|
local authors = escape_html(author_names(meta))
|
||||||
|
|
||||||
|
local subtitle_html = ""
|
||||||
|
if subtitle ~= "" then
|
||||||
|
subtitle_html = ' <span class="subtitle">| ' .. subtitle .. "</span>"
|
||||||
|
end
|
||||||
|
|
||||||
|
local logo_html = ""
|
||||||
|
local running_logo = ""
|
||||||
|
if logo_uri ~= nil then
|
||||||
|
logo_html = '<img class="logo" src="' .. logo_uri .. '" alt="" />'
|
||||||
|
running_logo = '<img src="' .. logo_uri .. '" alt="" />'
|
||||||
|
elseif logo_path ~= nil and logo_path ~= "" then
|
||||||
|
local src = escape_html(logo_path)
|
||||||
|
logo_html = '<img class="logo" src="' .. src .. '" alt="" />'
|
||||||
|
running_logo = '<img src="' .. src .. '" alt="" />'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Logo first (left), title text second (right) — matches product_test_template.typ
|
||||||
|
-- Visible on screen and in PDF (no print-only); Quarto default title is hidden in CSS.
|
||||||
|
local title_block = string.format([[
|
||||||
|
<div class="print-title-block">
|
||||||
|
%s
|
||||||
|
<div class="title-text">
|
||||||
|
<p class="company-line">%s%s</p>
|
||||||
|
<p class="report-title">%s</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
]], logo_html, company, subtitle_html, title)
|
||||||
|
|
||||||
|
-- Rotated sidebar labels (title then destinations, matching typst grid columns).
|
||||||
|
-- .chip-gap extends the rule to the @bottom-left page chip (persian ۱/N).
|
||||||
|
local sidebar = string.format([[
|
||||||
|
<div class="print-sidebar print-only" aria-hidden="true">
|
||||||
|
<div class="seg">%s</div>
|
||||||
|
<div class="seg">%s</div>
|
||||||
|
<div class="chip-gap" aria-hidden="true"></div>
|
||||||
|
</div>
|
||||||
|
]], title, destinations)
|
||||||
|
|
||||||
|
local running = string.format([[
|
||||||
|
<div class="print-running-header print-only" aria-hidden="true">
|
||||||
|
%s
|
||||||
|
<span>%s</span>
|
||||||
|
<span class="pipe">|</span>
|
||||||
|
<span>%s</span>
|
||||||
|
</div>
|
||||||
|
]], running_logo, company, subtitle)
|
||||||
|
|
||||||
|
-- Travel meta is gated on report-type (from templates/travel.yml), not on purpose.
|
||||||
|
local travel = ""
|
||||||
|
if report_type == "travel" then
|
||||||
|
travel = string.format([[
|
||||||
|
<div class="print-travel-meta print-only">
|
||||||
|
<hr class="rule" />
|
||||||
|
<h2>اطلاعات کلی</h2>
|
||||||
|
<div class="meta-row"><div class="meta-label">مقصد:</div><div class="meta-value">%s</div></div>
|
||||||
|
<div class="meta-row"><div class="meta-label">هدف مأموریت:</div><div class="meta-value">%s</div></div>
|
||||||
|
<div class="meta-row"><div class="meta-label">تیم اعزامی:</div><div class="meta-value">%s</div></div>
|
||||||
|
<div class="meta-row"><div class="meta-label">تاریخ:</div><div class="meta-value">%s</div></div>
|
||||||
|
<hr class="rule" />
|
||||||
|
</div>
|
||||||
|
]], destinations, escape_html(purpose), authors, report_date)
|
||||||
|
end
|
||||||
|
|
||||||
|
quarto.doc.include_text("before-body", running .. sidebar .. title_block .. travel)
|
||||||
|
return meta
|
||||||
|
end
|
||||||
5
filters/summary-box.lua
Normal file
5
filters/summary-box.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-- ::: {.summary-box} is styled by CSS for HTML/PDF (WeasyPrint).
|
||||||
|
-- No AST rewrite needed.
|
||||||
|
function Div(el)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
20
filters/typst-linebreaks.lua
Normal file
20
filters/typst-linebreaks.lua
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
-- Turn HTML <br> / LineBreak into Typst #linebreak() so two-line table
|
||||||
|
-- headers work in PDF as well as HTML.
|
||||||
|
local function typst_break()
|
||||||
|
return pandoc.RawInline("typst", "#linebreak()")
|
||||||
|
end
|
||||||
|
|
||||||
|
function RawInline(el)
|
||||||
|
if not quarto.doc.is_format("typst") then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
if el.format == "html" and el.text:match("^<br%s*/?>$") then
|
||||||
|
return typst_break()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function LineBreak()
|
||||||
|
if quarto.doc.is_format("typst") then
|
||||||
|
return typst_break()
|
||||||
|
end
|
||||||
|
end
|
||||||
4
ink_formula_for_solvent_testing.csv
Normal file
4
ink_formula_for_solvent_testing.csv
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Material, Qty
|
||||||
|
Pigment, 38.5
|
||||||
|
Solvent, 60
|
||||||
|
Dispersant, 5
|
||||||
|
74
scripts/html-to-pdf.py
Executable file
74
scripts/html-to-pdf.py
Executable file
@@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Convert Quarto HTML outputs to PDF with WeasyPrint (typst-templates layout)."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def venv_python() -> Path | None:
|
||||||
|
here = Path(__file__).resolve()
|
||||||
|
for root in (here.parents[1], here.parents[2]):
|
||||||
|
py = root / ".venv-pdf" / "bin" / "python"
|
||||||
|
if py.is_file() and os.access(py, os.X_OK):
|
||||||
|
return py
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_weasyprint():
|
||||||
|
try:
|
||||||
|
import weasyprint # noqa: F401
|
||||||
|
return
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
py = venv_python()
|
||||||
|
if py is None:
|
||||||
|
print(
|
||||||
|
"html-to-pdf: WeasyPrint not found. Install with:\n"
|
||||||
|
" uv venv .venv-pdf && uv pip install --python .venv-pdf/bin/python weasyprint",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
raise SystemExit(1)
|
||||||
|
os.execv(str(py), [str(py), str(Path(__file__).resolve()), *sys.argv[1:]])
|
||||||
|
|
||||||
|
|
||||||
|
def collect_html_files(project_dir: Path, output_dir: Path) -> list[Path]:
|
||||||
|
# Quarto passes rendered output paths as argv after the script name.
|
||||||
|
from_args = []
|
||||||
|
for arg in sys.argv[1:]:
|
||||||
|
p = Path(arg)
|
||||||
|
if not p.is_absolute():
|
||||||
|
p = (project_dir / p).resolve()
|
||||||
|
if p.suffix.lower() == ".html" and p.is_file() and "files" not in p.parts:
|
||||||
|
from_args.append(p)
|
||||||
|
if from_args:
|
||||||
|
return sorted(set(from_args))
|
||||||
|
|
||||||
|
html_files = sorted(output_dir.rglob("*.html"))
|
||||||
|
return [p for p in html_files if "files" not in p.parts]
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
ensure_weasyprint()
|
||||||
|
from weasyprint import HTML
|
||||||
|
|
||||||
|
project_dir = Path(os.environ.get("QUARTO_PROJECT_DIR", Path.cwd()))
|
||||||
|
output_dir = Path(os.environ.get("QUARTO_PROJECT_OUTPUT_DIR", project_dir / "_output"))
|
||||||
|
|
||||||
|
html_files = collect_html_files(project_dir, output_dir)
|
||||||
|
if not html_files:
|
||||||
|
print("html-to-pdf: no HTML files found to convert", file=sys.stderr)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
for html_path in html_files:
|
||||||
|
pdf_path = html_path.with_suffix(".pdf")
|
||||||
|
print(f"html-to-pdf: {html_path} -> {pdf_path}")
|
||||||
|
HTML(filename=str(html_path), base_url=str(html_path.parent)).write_pdf(str(pdf_path))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
471
styles/print.css
Normal file
471
styles/print.css
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
/* Print / PDF styles (WeasyPrint); table chrome matches HTML report.css */
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRNazanin";
|
||||||
|
src: url("../assets/fonts/IRNazanin.ttf") format("truetype");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRNazanin";
|
||||||
|
src: url("../assets/fonts/IRNazanin-Bold.ttf") format("truetype");
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRZar";
|
||||||
|
src: url("../assets/fonts/IRZar.ttf") format("truetype");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "IRZar";
|
||||||
|
src: url("../assets/fonts/IRZar-Bold.ttf") format("truetype");
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--text: #000000;
|
||||||
|
--text2: #57606a;
|
||||||
|
--stroke: #000000;
|
||||||
|
--fill: #f6f8fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
size: A4;
|
||||||
|
/* Match typst-templates: 2cm sides, 2.5cm top/bottom */
|
||||||
|
margin: 2.5cm 2cm 2.5cm 2cm;
|
||||||
|
@bottom-center {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
@top-center {
|
||||||
|
content: element(report-header);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
/* Page chip: counters only update in @page margin boxes (not position:fixed).
|
||||||
|
Rotate the whole ۱/N string like typst's -90deg sidebar grid.cell
|
||||||
|
(writing-mode: sideways-lr leaves numerals horizontal in WeasyPrint). */
|
||||||
|
@bottom-left {
|
||||||
|
content: counter(page, persian) "/" counter(pages, persian);
|
||||||
|
font-family: "IRZar", "IRNazanin", sans-serif;
|
||||||
|
font-size: 11pt;
|
||||||
|
color: #fff;
|
||||||
|
background: #000;
|
||||||
|
border: 1pt solid #000;
|
||||||
|
width: 28pt;
|
||||||
|
height: 20pt;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
/* Align chip's content-facing (right) edge with the sidebar rule. */
|
||||||
|
margin-left: -1.66cm;
|
||||||
|
margin-bottom: 0.35cm;
|
||||||
|
direction: ltr;
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@page :first {
|
||||||
|
@top-center {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
/* Keep html LTR so position:fixed + left/translateX for the sidebar use a
|
||||||
|
sane containing block. WeasyPrint with html{direction:rtl} shifts fixed
|
||||||
|
boxes far right and they clip before reaching the typst left-edge band.
|
||||||
|
Document content stays RTL on body. */
|
||||||
|
html {
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
direction: rtl;
|
||||||
|
font-family: "IRNazanin", sans-serif;
|
||||||
|
font-size: 13pt;
|
||||||
|
/* typst-templates use par(leading: 1.2em) — additive space, not CSS 1.2× */
|
||||||
|
line-height: 1.65;
|
||||||
|
color: var(--text);
|
||||||
|
background: #ffffff;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
text-align: justify;
|
||||||
|
hyphens: auto;
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide Quarto / screen chrome in PDF */
|
||||||
|
#title-block-header,
|
||||||
|
header#title-block-header,
|
||||||
|
.quarto-title-block,
|
||||||
|
.quarto-title,
|
||||||
|
.quarto-title-meta,
|
||||||
|
.quarto-title-meta-contents,
|
||||||
|
header.quarto-title-block,
|
||||||
|
h1.title,
|
||||||
|
p.subtitle,
|
||||||
|
nav.toc-active,
|
||||||
|
#TOC,
|
||||||
|
.sidebar.sidebar-navigation,
|
||||||
|
#quarto-sidebar,
|
||||||
|
#quarto-margin-sidebar,
|
||||||
|
#quarto-back-to-top,
|
||||||
|
.report-meta,
|
||||||
|
.screen-only {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Running header (page > 1) ===== */
|
||||||
|
/* RTL flex: first child (logo) packs to the right — matches typst header grid */
|
||||||
|
.print-running-header {
|
||||||
|
position: running(report-header);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 5pt;
|
||||||
|
width: 100%;
|
||||||
|
font-family: "IRNazanin", sans-serif;
|
||||||
|
font-size: 11pt;
|
||||||
|
padding-bottom: 4pt;
|
||||||
|
border-bottom: 0.5pt solid black;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-running-header img {
|
||||||
|
height: 19pt;
|
||||||
|
width: auto;
|
||||||
|
border: 1pt solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-running-header .pipe {
|
||||||
|
margin: 0 2pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Left rotated sidebar (every page) ===== */
|
||||||
|
/* Mirrors typst product_test_template / travel-report-template:
|
||||||
|
rotate(-90deg) grid with columns ~(30%, 30%) + page chip in @bottom-left.
|
||||||
|
Negative `left` is clipped by WeasyPrint; use translateX into the margin instead. */
|
||||||
|
.print-sidebar {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
/* Keep >= 0 — negative bottom clips the rotated sidebar in WeasyPrint */
|
||||||
|
bottom: 0.05cm;
|
||||||
|
|
||||||
|
/* Labels + chip-gap (~typst place dy:73% band through page chip) */
|
||||||
|
width: 11.5cm;
|
||||||
|
height: 20pt;
|
||||||
|
transform-origin: left bottom;
|
||||||
|
/* Pull into left margin (negative left is clipped by WeasyPrint) */
|
||||||
|
transform: translateX(-0.75cm) rotate(-90deg);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
align-items: stretch;
|
||||||
|
font-family: "IRZar", "IRNazanin", sans-serif;
|
||||||
|
font-size: 13pt;
|
||||||
|
border-bottom: 1pt solid black;
|
||||||
|
direction: ltr;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extends the sidebar rule toward the @bottom-left page chip */
|
||||||
|
.print-sidebar .chip-gap {
|
||||||
|
flex: 0 0 28pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-sidebar .seg {
|
||||||
|
/* typst columns: 30% / 30% of the label band */
|
||||||
|
flex: 1 1 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
/* typst: #h(1fr) text #h(5fr) — bias text toward the rule */
|
||||||
|
justify-content: flex-start;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
padding: 0 1pt 0 4pt;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Page chip is drawn via @page @bottom-left (counters don't update in fixed) */
|
||||||
|
.print-sidebar .pagebox {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Title block (first page) ===== */
|
||||||
|
/* LTR flex: logo (first) on left, title text (second) on right — typst grid */
|
||||||
|
.print-title-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 16pt 0;
|
||||||
|
padding-bottom: 64pt;
|
||||||
|
border-bottom: 0.75pt solid #999999;
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .title-text {
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
line-height: 1.15;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .company-line {
|
||||||
|
font-size: 22.1pt;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .company-line .subtitle {
|
||||||
|
font-size: 15.6pt;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .report-title {
|
||||||
|
font-size: 15.6pt;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 6pt 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .logo {
|
||||||
|
height: 1.8cm;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Travel-report meta block (injected when report-type is travel) */
|
||||||
|
.print-travel-meta {
|
||||||
|
margin: 12pt 0 24pt 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-travel-meta .rule {
|
||||||
|
border: none;
|
||||||
|
border-top: 1pt solid black;
|
||||||
|
margin: 10pt 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-travel-meta h2 {
|
||||||
|
font-size: 1.4em;
|
||||||
|
text-align: center;
|
||||||
|
margin: 8pt 0;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-travel-meta .meta-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 2em;
|
||||||
|
margin: 10pt 0;
|
||||||
|
justify-content: flex-start;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-travel-meta .meta-label {
|
||||||
|
flex: 0 0 8em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-travel-meta .meta-value {
|
||||||
|
flex: 1;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Headings ===== */
|
||||||
|
h1, h2, h3, h4 {
|
||||||
|
font-family: "IRNazanin", sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: right;
|
||||||
|
line-height: 1.35;
|
||||||
|
page-break-after: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2 {
|
||||||
|
font-size: 14pt;
|
||||||
|
margin: 16pt 0 10pt 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block + h1,
|
||||||
|
.print-travel-meta + h1 {
|
||||||
|
margin-top: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 13pt;
|
||||||
|
margin: 12pt 0 8pt 0;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0.5em 0 0.85em 0;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul, ol {
|
||||||
|
margin: 0.5em 0 0.9em 0;
|
||||||
|
padding-right: 1.4em;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0.35em 0;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== Tables (rounded chrome like HTML; black stroke) ===== */
|
||||||
|
table {
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
width: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 10pt auto;
|
||||||
|
border: 1pt solid var(--stroke);
|
||||||
|
border-radius: 8pt;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 12.5pt;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
border: none;
|
||||||
|
padding: 7pt 8pt;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead th,
|
||||||
|
tr:first-child th {
|
||||||
|
background: var(--fill);
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--text2);
|
||||||
|
border-bottom: 1pt solid var(--stroke);
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
unicode-bidi: isolate;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Summary box — same chrome as HTML (soft stroke) */
|
||||||
|
.summary-box {
|
||||||
|
border: 1pt solid #d0d7de;
|
||||||
|
border-radius: 8pt;
|
||||||
|
background: var(--fill);
|
||||||
|
padding: 10pt 12pt;
|
||||||
|
margin: 10pt 0;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box > :first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box > :last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box [dir="ltr"],
|
||||||
|
.summary-box .ltr {
|
||||||
|
direction: ltr;
|
||||||
|
unicode-bidi: isolate;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
direction: ltr;
|
||||||
|
unicode-bidi: embed;
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
main, .content, #quarto-content, .page-columns, .page-body {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
max-width: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* @media print */
|
||||||
@@ -12,6 +12,14 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--text: #1f2328;
|
||||||
|
--text2: #57606a;
|
||||||
|
--stroke: #d0d7de;
|
||||||
|
--bg: #ffffff;
|
||||||
|
--fill: #f6f8fa;
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
direction: rtl;
|
direction: rtl;
|
||||||
lang: fa;
|
lang: fa;
|
||||||
@@ -24,8 +32,8 @@ body {
|
|||||||
max-width: 48rem;
|
max-width: 48rem;
|
||||||
margin: 2rem auto;
|
margin: 2rem auto;
|
||||||
padding: 0 1.25rem;
|
padding: 0 1.25rem;
|
||||||
color: #1a1a1a;
|
color: var(--text);
|
||||||
background: #fff;
|
background: var(--bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3 {
|
h1, h2, h3 {
|
||||||
@@ -33,20 +41,79 @@ h1, h2, h3 {
|
|||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1.title {
|
p {
|
||||||
font-size: 1.75rem;
|
margin: 0.5em 0 0.85em 0;
|
||||||
margin-bottom: 0.25rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.subtitle {
|
ul, ol {
|
||||||
font-size: 1.1rem;
|
margin: 0.5em 0 0.9em 0;
|
||||||
color: #444;
|
padding-right: 1.4em;
|
||||||
margin-top: 0;
|
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,
|
||||||
|
.quarto-title-block,
|
||||||
|
.quarto-title,
|
||||||
.quarto-title-meta,
|
.quarto-title-meta,
|
||||||
.quarto-title-meta-contents {
|
.quarto-title-meta-contents,
|
||||||
|
header.quarto-title-block,
|
||||||
|
h1.title,
|
||||||
|
p.subtitle,
|
||||||
|
p.author,
|
||||||
|
.quarto-title-meta-author {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Screen header — same markup/layout as PDF .print-title-block */
|
||||||
|
.print-title-block {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 1.5rem 0;
|
||||||
|
padding-bottom: 3.4rem;
|
||||||
|
border-bottom: 1px solid #999999;
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .title-text {
|
||||||
|
direction: rtl;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
line-height: 1.15;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .company-line {
|
||||||
|
font-size: 2.15rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .company-line .subtitle {
|
||||||
|
display: inline;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: normal;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .report-title {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0.2rem 0 0 0;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.print-title-block .logo {
|
||||||
|
height: 3.4rem;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.report-meta {
|
.report-meta {
|
||||||
@@ -65,24 +132,148 @@ h1.title {
|
|||||||
margin: 0.15rem 0 0.5rem 0;
|
margin: 0.15rem 0 0.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Match Inco Mixed ICJ108 HTML table chrome */
|
||||||
table {
|
table {
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
font-size: 0.95rem;
|
border: 1px solid var(--stroke);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
border: 1px solid #ccc;
|
padding: 0.55rem 0.75rem;
|
||||||
padding: 0.4rem 0.6rem;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
thead th {
|
||||||
background: #eee;
|
background: var(--fill);
|
||||||
|
font-size: 1rem;
|
||||||
|
color: var(--text2);
|
||||||
|
border-bottom: 1px solid var(--stroke);
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
direction: ltr;
|
||||||
|
unicode-bidi: isolate;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Summary / callout box — same chrome as tables */
|
||||||
|
.summary-box {
|
||||||
|
border: 1px solid var(--stroke);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--fill);
|
||||||
|
padding: 0.85rem 1.1rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box > :first-child {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box > :last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-box [dir="ltr"],
|
||||||
|
.summary-box .ltr {
|
||||||
|
direction: ltr;
|
||||||
|
unicode-bidi: isolate;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
unicode-bidi: embed;
|
unicode-bidi: embed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Running header / sidebar are PDF-only; title block stays visible on screen */
|
||||||
|
@media screen {
|
||||||
|
.print-running-header,
|
||||||
|
.print-sidebar,
|
||||||
|
.print-only {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
5
templates/product-test.yml
Normal file
5
templates/product-test.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Product / raw-material test report template.
|
||||||
|
# Include from a .qmd with:
|
||||||
|
# metadata-files:
|
||||||
|
# - ../templates/product-test.yml
|
||||||
|
report-type: product-test
|
||||||
5
templates/travel-expense.yml
Normal file
5
templates/travel-expense.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Travel / mission expense letter template.
|
||||||
|
# Include from a .qmd with:
|
||||||
|
# metadata-files:
|
||||||
|
# - ../templates/travel-expense.yml
|
||||||
|
report-type: travel-expense
|
||||||
5
templates/travel.yml
Normal file
5
templates/travel.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Travel / mission report template.
|
||||||
|
# Include from a .qmd with:
|
||||||
|
# metadata-files:
|
||||||
|
# - ../templates/travel.yml
|
||||||
|
report-type: travel
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#set page(
|
|
||||||
paper: $if(papersize)$"$papersize$"$else$"a4"$endif$,
|
|
||||||
$if(margin)$
|
|
||||||
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
|
|
||||||
$else$
|
|
||||||
margin: (left: 2cm, right: 2cm, top: 2.5cm, bottom: 2.5cm),
|
|
||||||
$endif$
|
|
||||||
numbering: $if(page-numbering)$"$page-numbering$"$else$"۱"$endif$,
|
|
||||||
header: context {
|
|
||||||
if counter(page).get().first() > 1 [
|
|
||||||
#set text(size: 11pt)
|
|
||||||
#grid(
|
|
||||||
columns: (auto, 1fr, auto),
|
|
||||||
gutter: 8pt,
|
|
||||||
align: (right, right, left),
|
|
||||||
$if(logofile)$
|
|
||||||
image("$logofile$", height: 16pt),
|
|
||||||
$endif$
|
|
||||||
$if(company)$
|
|
||||||
[#h(6pt)$company$$if(subtitle)$ | $subtitle$$endif$],
|
|
||||||
$else$
|
|
||||||
[],
|
|
||||||
$endif$
|
|
||||||
[],
|
|
||||||
)
|
|
||||||
#line(length: 100%, stroke: 0.5pt)
|
|
||||||
]
|
|
||||||
},
|
|
||||||
background: place(
|
|
||||||
dx: -64%,
|
|
||||||
dy: 73%,
|
|
||||||
rotate(
|
|
||||||
-90deg,
|
|
||||||
{
|
|
||||||
set text(size: 13pt$if(sidebarfont)$, font: ("$sidebarfont$",)$endif$)
|
|
||||||
grid(
|
|
||||||
columns: (30%, 30%, 5%),
|
|
||||||
rows: 20pt,
|
|
||||||
align: top,
|
|
||||||
[#h(1fr) $if(title)$$title$$endif$ $if(destinations)$$for(destinations)$$destinations$$sep$ - $endfor$$endif$ #h(5fr)],
|
|
||||||
[#h(1fr) $if(by-author)$$for(by-author)$$it.name.literal$$sep$ - $endfor$$endif$ #h(4fr)],
|
|
||||||
grid.cell(
|
|
||||||
fill: black,
|
|
||||||
align: center,
|
|
||||||
stroke: 1pt,
|
|
||||||
text(fill: white, context counter(page).display("۱/۱", both: true)),
|
|
||||||
),
|
|
||||||
grid.hline(start: 0),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#show: doc => article(
|
|
||||||
$if(title)$
|
|
||||||
title: [$title$],
|
|
||||||
$endif$
|
|
||||||
$if(subtitle)$
|
|
||||||
subtitle: [$subtitle$],
|
|
||||||
$endif$
|
|
||||||
$if(company)$
|
|
||||||
company: [$company$],
|
|
||||||
$endif$
|
|
||||||
$if(destinations)$
|
|
||||||
destinations: (
|
|
||||||
$for(destinations)$
|
|
||||||
[$destinations$],
|
|
||||||
$endfor$
|
|
||||||
),
|
|
||||||
$endif$
|
|
||||||
$if(purpose)$
|
|
||||||
purpose: [$purpose$],
|
|
||||||
$endif$
|
|
||||||
$if(logofile)$
|
|
||||||
logo: "$logofile$",
|
|
||||||
$endif$
|
|
||||||
$if(by-author)$
|
|
||||||
authors: (
|
|
||||||
$for(by-author)$
|
|
||||||
$if(it.name.literal)$
|
|
||||||
( name: [$it.name.literal$],
|
|
||||||
affiliation: [$for(it.affiliations)$$it.name$$sep$, $endfor$],
|
|
||||||
email: [$it.email$] ),
|
|
||||||
$endif$
|
|
||||||
$endfor$
|
|
||||||
),
|
|
||||||
$endif$
|
|
||||||
$if(report-date)$
|
|
||||||
date: [$report-date$],
|
|
||||||
$endif$
|
|
||||||
$if(lang)$
|
|
||||||
lang: "$lang$",
|
|
||||||
$endif$
|
|
||||||
$if(region)$
|
|
||||||
region: "$region$",
|
|
||||||
$endif$
|
|
||||||
$if(mainfont)$
|
|
||||||
font: ("$mainfont$",),
|
|
||||||
$endif$
|
|
||||||
$if(fontsize)$
|
|
||||||
fontsize: $fontsize$,
|
|
||||||
$endif$
|
|
||||||
$if(section-numbering)$
|
|
||||||
sectionnumbering: "$section-numbering$",
|
|
||||||
$endif$
|
|
||||||
$if(toc)$
|
|
||||||
toc: $toc$,
|
|
||||||
$endif$
|
|
||||||
$if(toc-title)$
|
|
||||||
toc_title: [$toc-title$],
|
|
||||||
$endif$
|
|
||||||
toc_depth: $toc-depth$,
|
|
||||||
doc,
|
|
||||||
)
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
#let article(
|
|
||||||
title: none,
|
|
||||||
subtitle: none,
|
|
||||||
authors: none,
|
|
||||||
keywords: (),
|
|
||||||
date: none,
|
|
||||||
abstract-title: none,
|
|
||||||
abstract: none,
|
|
||||||
thanks: none,
|
|
||||||
cols: 1,
|
|
||||||
lang: "fa",
|
|
||||||
region: none,
|
|
||||||
font: none,
|
|
||||||
fontsize: 13pt,
|
|
||||||
title-size: 1.5em,
|
|
||||||
subtitle-size: 1.25em,
|
|
||||||
heading-family: none,
|
|
||||||
heading-weight: "bold",
|
|
||||||
heading-style: "normal",
|
|
||||||
heading-color: black,
|
|
||||||
heading-line-height: 0.65em,
|
|
||||||
mathfont: none,
|
|
||||||
codefont: none,
|
|
||||||
linestretch: 1,
|
|
||||||
sectionnumbering: none,
|
|
||||||
linkcolor: none,
|
|
||||||
citecolor: none,
|
|
||||||
filecolor: none,
|
|
||||||
toc: false,
|
|
||||||
toc_title: none,
|
|
||||||
toc_depth: none,
|
|
||||||
toc_indent: 1.5em,
|
|
||||||
company: none,
|
|
||||||
destinations: none,
|
|
||||||
purpose: none,
|
|
||||||
logo: none,
|
|
||||||
doc,
|
|
||||||
) = {
|
|
||||||
set document(title: title, keywords: keywords)
|
|
||||||
set document(
|
|
||||||
author: authors.map(author => content-to-string(author.name)).join(", ", last: " و "),
|
|
||||||
) if authors != none and authors != ()
|
|
||||||
|
|
||||||
set text(lang: lang, dir: rtl, size: fontsize)
|
|
||||||
set text(font: font) if font != none
|
|
||||||
set par(justify: true, leading: linestretch * 0.65em)
|
|
||||||
set align(right)
|
|
||||||
set heading(numbering: sectionnumbering)
|
|
||||||
|
|
||||||
show math.equation: set text(font: mathfont) if mathfont != none
|
|
||||||
show raw: set text(font: codefont) if codefont != none
|
|
||||||
show link: set text(fill: rgb(content-to-string(linkcolor))) if linkcolor != none
|
|
||||||
show ref: set text(fill: rgb(content-to-string(citecolor))) if citecolor != none
|
|
||||||
|
|
||||||
let dest-text = if destinations == none {
|
|
||||||
""
|
|
||||||
} else if type(destinations) == array {
|
|
||||||
destinations.join(" - ")
|
|
||||||
} else {
|
|
||||||
destinations
|
|
||||||
}
|
|
||||||
|
|
||||||
let author-names = if authors == none or authors == () {
|
|
||||||
""
|
|
||||||
} else {
|
|
||||||
authors.map(a => content-to-string(a.name)).join(" - ")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Title block
|
|
||||||
block(width: 100%)[
|
|
||||||
#grid(
|
|
||||||
columns: (1fr, auto),
|
|
||||||
align: (right, left),
|
|
||||||
[
|
|
||||||
#set par(leading: 0.9em, spacing: 0em)
|
|
||||||
#if company != none {
|
|
||||||
text(21pt, weight: "bold", company)
|
|
||||||
if subtitle != none {
|
|
||||||
text(14pt)[ | #subtitle]
|
|
||||||
}
|
|
||||||
linebreak()
|
|
||||||
}
|
|
||||||
#if title != none {
|
|
||||||
text(14pt, weight: "bold", title)
|
|
||||||
}
|
|
||||||
],
|
|
||||||
if logo != none {
|
|
||||||
image(logo, height: 1.8cm)
|
|
||||||
} else {
|
|
||||||
[]
|
|
||||||
},
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
v(12pt)
|
|
||||||
align(center, line(length: 100%))
|
|
||||||
text(1.4em, weight: "bold", [اطلاعات کلی])
|
|
||||||
v(8pt)
|
|
||||||
|
|
||||||
let meta-row(label, value) = if value != none and value != "" {
|
|
||||||
grid(
|
|
||||||
columns: (8em, 1fr),
|
|
||||||
gutter: 1em,
|
|
||||||
align: (right, right),
|
|
||||||
[#label],
|
|
||||||
[#strong(value)],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
stack(
|
|
||||||
spacing: 12pt,
|
|
||||||
meta-row([مقصد:], dest-text),
|
|
||||||
meta-row([هدف مأموریت:], purpose),
|
|
||||||
meta-row([تیم اعزامی:], author-names),
|
|
||||||
meta-row([تاریخ:], date),
|
|
||||||
)
|
|
||||||
|
|
||||||
v(24pt)
|
|
||||||
align(center, line(length: 100%))
|
|
||||||
v(12pt)
|
|
||||||
|
|
||||||
if toc {
|
|
||||||
let title = if toc_title == none { auto } else { toc_title }
|
|
||||||
block(above: 0em, below: 2em)[
|
|
||||||
#outline(title: title, depth: toc_depth, indent: toc_indent)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
doc
|
|
||||||
}
|
|
||||||
|
|
||||||
#set table(
|
|
||||||
inset: 6pt,
|
|
||||||
stroke: 0.5pt + gray,
|
|
||||||
align: center,
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user