Add Quarto product-test example and fix Typst render.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-18 11:41:06 +03:30
parent 3cdc5918a9
commit 35cfad978b
3 changed files with 186 additions and 24 deletions

View File

@@ -16,10 +16,18 @@ One `.qmd` source renders to:
```bash
quarto render examples/travel-report.qmd
quarto render examples/product-test.qmd
```
Outputs land in `_output/` (HTML + PDF).
## Report types
| 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. |
## Project layout
```
@@ -29,9 +37,11 @@ templates/typst/ # Typst PDF partials
assets/fonts/ # Persian fonts
assets/logo.png
examples/travel-report.qmd
examples/product-test.qmd
```
## Notes
- HTML does **not** visually match the PDF (no sidebar/header parity; tables may differ).
- This repo is separate from `typst-templates` (pure Typst PDF library).
- 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.

127
examples/product-test.qmd Normal file
View File

@@ -0,0 +1,127 @@
---
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:
- نتایج تست پیگمنت‌های شرکت اسمالتس
format:
html:
include-before-body:
- text: |
<dl class="report-meta">
<dt>موضوع</dt><dd>نتایج تست پیگمنت‌های شرکت اسمالتس</dd>
<dt>نویسنده</dt><dd>دیاکو سلطانپور</dd>
<dt>تاریخ</dt><dd>۲۲ تا ۴/۶/۲۶</dd>
</dl>
typst: default
---
# اطلاعات کلی
| تاریخ دریافت نمونه | تاریخ گزارش | نوع نمونه | تعداد | تأمین کننده |
| --- | --- | --- | --- | --- |
| ۱۴۰۵/۰۱/۱۷ | ۱۴۰۵/۰۱/۲۴ | پیگمنت | ۹ | 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 دارای تم سایان است.
## پیشنهادات
هیچ کدام از پیگمنت‌ها برای انجام تست صنعتی در نظر گرفته نشد ولی در صورت بروز مشکل در تأمین پیگمنت‌های مصرفی کنونی، می‌توان این نمونه‌ها را به عنوان کاندید جایگزینی در نظر گرفت.
## نظر مدیر کارخانه

View File

@@ -1,3 +1,21 @@
// Quarto's default Pandoc Typst template defines this; custom template-partials
// replace that file, so we need the helper here.
#let content-to-string(content) = {
if type(content) == str {
content
} else if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(content-to-string).join("")
} else if content.has("body") {
content-to-string(content.body)
} else if content == [ ] {
" "
} else {
""
}
}
#let article(
title: none,
subtitle: none,
@@ -92,33 +110,40 @@
)
]
v(12pt)
align(center, line(length: 100%))
text(1.4em, weight: "bold", [اطلاعات کلی])
v(8pt)
// Travel reports pass `purpose`; product-test reports put general info in the body.
let show-travel-meta = purpose != none and purpose != ""
let meta-row(label, value) = if value != none and value != "" {
grid(
columns: (8em, 1fr),
gutter: 1em,
align: (right, right),
[#label],
[#strong(value)],
if show-travel-meta {
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)
} else {
v(16pt)
}
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)[