commit 3cdc5918a9a30f1b1ae8b88265e51cba4ec020c8 Author: Diaco Soltanpour Date: Wed Jul 15 00:43:08 2026 +0330 Add Quarto HTML+Typst business report templates. Co-authored-by: Cursor diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8fa8438 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +_output/ +*.pdf +*.html +!.gitignore +.DS_Store +*.typ +!templates/**/*.typ +/.quarto/ + +**/*.quarto_ipynb diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a93d520 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Rhino + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd58e82 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# Business Report Templates + +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 + +## Requirements + +- [Quarto](https://quarto.org/) 1.9+ (bundles Typst) +- Fonts in `assets/fonts/` (`IRNazanin`, `IRZar`, `IRLotus`) + +## Quick start + +```bash +quarto render examples/travel-report.qmd +``` + +Outputs land in `_output/` (HTML + PDF). + +## Project layout + +``` +_quarto.yml +styles/report.css # HTML RTL theme +templates/typst/ # Typst PDF partials +assets/fonts/ # Persian fonts +assets/logo.png +examples/travel-report.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). diff --git a/_quarto.yml b/_quarto.yml new file mode 100644 index 0000000..9e0ae91 --- /dev/null +++ b/_quarto.yml @@ -0,0 +1,29 @@ +project: + type: default + output-dir: _output + +format: + html: + lang: fa + dir: rtl + theme: none + css: styles/report.css + embed-resources: true + toc: false + typst: + lang: fa + mainfont: IRNazanin + fontsize: 13pt + 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 diff --git a/assets/fonts/IRLotus.ttf b/assets/fonts/IRLotus.ttf new file mode 100644 index 0000000..9d683e7 Binary files /dev/null and b/assets/fonts/IRLotus.ttf differ diff --git a/assets/fonts/IRNazanin-Bold.ttf b/assets/fonts/IRNazanin-Bold.ttf new file mode 100644 index 0000000..f681256 Binary files /dev/null and b/assets/fonts/IRNazanin-Bold.ttf differ diff --git a/assets/fonts/IRNazanin-Italic.ttf b/assets/fonts/IRNazanin-Italic.ttf new file mode 100644 index 0000000..bbc0e9a Binary files /dev/null and b/assets/fonts/IRNazanin-Italic.ttf differ diff --git a/assets/fonts/IRNazanin.ttf b/assets/fonts/IRNazanin.ttf new file mode 100644 index 0000000..cee69de Binary files /dev/null and b/assets/fonts/IRNazanin.ttf differ diff --git a/assets/fonts/IRTitr.ttf b/assets/fonts/IRTitr.ttf new file mode 100644 index 0000000..014c522 Binary files /dev/null and b/assets/fonts/IRTitr.ttf differ diff --git a/assets/fonts/IRZar-Bold.ttf b/assets/fonts/IRZar-Bold.ttf new file mode 100644 index 0000000..3a97f40 Binary files /dev/null and b/assets/fonts/IRZar-Bold.ttf differ diff --git a/assets/fonts/IRZar.ttf b/assets/fonts/IRZar.ttf new file mode 100644 index 0000000..5015b56 Binary files /dev/null and b/assets/fonts/IRZar.ttf differ diff --git a/assets/fonts/IRlotus-Bold.ttf b/assets/fonts/IRlotus-Bold.ttf new file mode 100644 index 0000000..d33fa63 Binary files /dev/null and b/assets/fonts/IRlotus-Bold.ttf differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..933bbab Binary files /dev/null and b/assets/logo.png differ diff --git a/examples/travel-report.qmd b/examples/travel-report.qmd new file mode 100644 index 0000000..9c218e9 --- /dev/null +++ b/examples/travel-report.qmd @@ -0,0 +1,101 @@ +--- +title: "گزارش مأموریت" +subtitle: "دپارتمان جوهر" +company: "کیمیا رازی" +logofile: "../assets/logo.png" +sidebarfont: IRZar +author: + - name: دیاکو سلطانپور + email: diaco@kimiarazi.com + affiliations: کیمیا رازی - واحد جوهر +report-date: "شروع: ۰۵/۰۲/۲۷ پایان: ۰۵/۰۲/۲۸" +destinations: + - کاشی آسیا +purpose: "تست آزمایشی جوهرهای کیمیا رازی برای خط پولیش/پرسلان" +format: + html: + include-before-body: + - text: | +
+
مقصد
کاشی آسیا
+
هدف مأموریت
تست آزمایشی جوهرهای کیمیا رازی برای خط پولیش/پرسلان
+
تیم اعزامی
دیاکو سلطانپور
+
تاریخ
شروع: ۰۵/۰۲/۲۷ — پایان: ۰۵/۰۲/۲۸
+
+ typst: default +--- + +# گزارش مأموریت + +این شرکت دو کوره برای کاشی کف و یک کوره برای پرسلان و پولیشی دارد و تولید روزانه آن حدود ۱۲ هزار متر مربع است. چهار ماشین چاپ دیجیتال دارد. دستگاه Tecnoferrari با هدهای ۱۰۰۲ و Xaar ۱۰۰۳ و دو دستگاه NKT با هدهای Xaar ۲۰۰۲. + +سه دستگاه خط ۱، ۲ و ۳ با جوهر کیمیا رازی کار می‌کند: + +- آبی: KRCY-1100T +- قهوه‌ای: KRBR-1200T +- عسلی: KRHN-1700T +- مشکی: KRBK-1300T + +و یک دستگاه (خط ۴) از اسفند سال گذشته با ترکیب کیمیا رازی و اینکرا: + +- آبی کیمیا رازی: KRCY-1100T +- قهوه‌ای اینکرا: IK-RB715 +- زرد طلایی اینکرا: IK-YE328 +- مشکی اینکرا: IK-BK913G + +در خط ۴ دمای کوره تا حدود ۱۲۲۰ درجه سانتیگراد بالا برده شده و به همین دلیل، شدت رنگ جوهرها کاهش یافته است. برای بهبود کیفیت چاپ، جوهرهای جدید با شدت رنگ و پایداری بیشتر در دمای بالا در نظر گرفته شده‌اند که در این گزارش، نتایج تست‌های اولیه آن‌ها ارائه شده است. + +## شرایط تست + +نمونه‌ها در شرایط زیر روی لعاب مات پرسلان در کوره خط ۴ تست شدند: + +| پارامتر | مقدار | +| --- | --- | +| دما | 1217 °C | +| سیکل | 75' | +| لعاب | مات پرسلان | +| غلظت نمونه | ۳٪ وزنی | +| مقدار اعمال شده | 400 µL | + +# نتایج + +## قهوه‌ای + +| کد نمونه | نتیجه | +| --- | --- | +| KRBR-1201T | شدت رنگ بیشتر | +| KRBR-1202T | شدت رنگ بیشتر | +| ICJ/408 | شدت رنگ بیشتر | + +بین نمونه‌های قهوه‌ای، ICJ/408 بیشترین شدت رنگ را دارد. کد KRBR-1202T به نمونه رفرنس نزدیک‌تر است. + +## زرد طلایی + +| کد نمونه | نتیجه | +| --- | --- | +| KRBG-1600T | تم رنگ تیره‌تر | +| KRHN-1700T | تم رنگ تیره‌تر | +| KRGY-1900T | تم رنگ تیره‌تر | +| KRGY-1901T | مشابه رفرنس (کمی تیره‌تر) | +| KRYL-1400T | زردی بیشتر | + +## مشکی + +| کد نمونه | نتیجه | +| --- | --- | +| ICJ/610 | تم سبز | +| ICJ/EH600 | تم قهوه‌ای | +| ICJ/EH630 | تم قهوه‌ای | +| ICJ/EH680 | کمترین شدت رنگ، تم قهوه‌ای | +| KRBL-1300T | تم سبز | +| KRBL-1314T | بیشترین شدت رنگ | + +با توجه به تست‌های انجام شده، نمونه‌های KRBR-1202T (قهوه‌ای)، KRGY-1901T (زرد طلایی) و KRBL-1314T (مشکی) به عنوان کاندید جایگزینی جوهرهای اینکرا در نظر گرفته شدند. + +نتایج تست‌ها به رویت آقای حسنی مدیر کارخانه، مهندس حری مدیر تولید و آقای مهندس عظیمی سرپرست خط رسید و صورتجلسه‌ای در این خصوص تنظیم شد. +با نظر آقای مهندس حری قرار شد نمونه‌هایی که شدت رنگ بیشتری دارند با پلاتر هم تست شوند. تست پلاتر در کیمیا رازی انجام و نمونه جهت پخت در کوره کاشی آسیا ارسال شد. +نتایج نمونه‌های تست پلاتر مشابه نمونه‌های تست سملر هستند. آقای مهندس حری در تماس تلفنی تأیید کردند که نمونه‌های تست شده از جوهرهای فعلی (اینکرا) شرایط بهتری دارند. + +# پیوست + +صورت جلسه در پیوست گزارش آمده است. diff --git a/styles/report.css b/styles/report.css new file mode 100644 index 0000000..8a1c52a --- /dev/null +++ b/styles/report.css @@ -0,0 +1,88 @@ +@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; +} + +html { + direction: rtl; + lang: fa; +} + +body { + font-family: "IRNazanin", "Tahoma", sans-serif; + font-size: 1.05rem; + line-height: 1.7; + max-width: 48rem; + margin: 2rem auto; + padding: 0 1.25rem; + color: #1a1a1a; + background: #fff; +} + +h1, h2, h3 { + font-weight: bold; + line-height: 1.4; +} + +h1.title { + font-size: 1.75rem; + margin-bottom: 0.25rem; +} + +.subtitle { + font-size: 1.1rem; + color: #444; + margin-top: 0; +} + +.quarto-title-meta, +.quarto-title-meta-contents { + text-align: right; +} + +.report-meta { + margin: 1.5rem 0; + padding: 1rem 1.25rem; + background: #f6f6f6; + border-radius: 6px; +} + +.report-meta dt { + font-weight: bold; + margin-top: 0.5rem; +} + +.report-meta dd { + margin: 0.15rem 0 0.5rem 0; +} + +table { + width: 100%; + border-collapse: collapse; + margin: 1rem 0; + font-size: 0.95rem; +} + +th, td { + border: 1px solid #ccc; + padding: 0.4rem 0.6rem; + text-align: center; +} + +th { + background: #eee; +} + +code { + direction: ltr; + unicode-bidi: embed; +} diff --git a/templates/typst/page.typ b/templates/typst/page.typ new file mode 100644 index 0000000..8edddf8 --- /dev/null +++ b/templates/typst/page.typ @@ -0,0 +1,53 @@ +#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), + ) + }, + ), + ), +) diff --git a/templates/typst/typst-show.typ b/templates/typst/typst-show.typ new file mode 100644 index 0000000..1daf4b7 --- /dev/null +++ b/templates/typst/typst-show.typ @@ -0,0 +1,61 @@ +#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, +) diff --git a/templates/typst/typst-template.typ b/templates/typst/typst-template.typ new file mode 100644 index 0000000..63dec02 --- /dev/null +++ b/templates/typst/typst-template.typ @@ -0,0 +1,136 @@ +#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, +)