Compare commits
8 Commits
e3980c5777
...
cursor/tra
| Author | SHA1 | Date | |
|---|---|---|---|
| 2db757877a | |||
| 46505eb3ee | |||
| 8f522bc09d | |||
| 570eb12e24 | |||
| 9d6a01f010 | |||
| 8ce14b37ac | |||
| c188a6387a | |||
| 89fa657df8 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,8 +4,8 @@ _output/
|
||||
!.gitignore
|
||||
.DS_Store
|
||||
*.typ
|
||||
!templates/**/*.typ
|
||||
/.quarto/
|
||||
.venv-pdf/
|
||||
report/
|
||||
|
||||
**/*.quarto_ipynb
|
||||
|
||||
48
README.md
48
README.md
@@ -4,7 +4,7 @@ Quarto templates for Kimia Razi Persian (RTL) business reports.
|
||||
|
||||
One `.qmd` source renders to:
|
||||
|
||||
- **HTML** — simple RTL reading layout (no print chrome on screen)
|
||||
- **HTML** — RTL reading layout with the same title block as PDF (company, logo, report title)
|
||||
- **PDF** — via WeasyPrint from the HTML, matching `typst-templates` page chrome (sidebar, header, title block, tables)
|
||||
|
||||
## Requirements
|
||||
@@ -22,19 +22,47 @@ 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
|
||||
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`.
|
||||
|
||||
## 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. |
|
||||
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
|
||||
|
||||
@@ -42,16 +70,20 @@ 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
|
||||
templates/travel-expense.yml
|
||||
examples/travel-report.qmd
|
||||
examples/product-test.qmd
|
||||
examples/travel-expense.qmd
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- 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.
|
||||
- HTML on screen stays a simple reading view; print chrome is `display: none` until print/PDF.
|
||||
- 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.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
---
|
||||
metadata-files:
|
||||
- ../templates/product-test.yml
|
||||
title: "گزارش تست مواد اولیه"
|
||||
subtitle: "دپارتمان جوهر"
|
||||
company: "کیمیا رازی"
|
||||
|
||||
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: "گزارش مأموریت"
|
||||
subtitle: "دپارتمان جوهر"
|
||||
company: "کیمیا رازی"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Inject typst-templates-style title block + sidebar into HTML for WeasyPrint PDF.
|
||||
-- Screen CSS hides .print-only; print.css shows them.
|
||||
-- Title block is shared with screen HTML; .print-only (running header, sidebar) is screen-hidden.
|
||||
|
||||
local function stringify(v)
|
||||
if v == nil then
|
||||
@@ -141,6 +141,7 @@ function Meta(meta)
|
||||
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))
|
||||
@@ -162,8 +163,9 @@ function Meta(meta)
|
||||
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 print-only">
|
||||
<div class="print-title-block">
|
||||
%s
|
||||
<div class="title-text">
|
||||
<p class="company-line">%s%s</p>
|
||||
@@ -172,13 +174,15 @@ function Meta(meta)
|
||||
</div>
|
||||
]], logo_html, company, subtitle_html, title)
|
||||
|
||||
-- Rotated sidebar labels; page chip comes from print.css @page @bottom-left.
|
||||
-- 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>
|
||||
]], destinations, title)
|
||||
]], title, destinations)
|
||||
|
||||
local running = string.format([[
|
||||
<div class="print-running-header print-only" aria-hidden="true">
|
||||
@@ -189,8 +193,9 @@ function Meta(meta)
|
||||
</div>
|
||||
]], running_logo, company, subtitle)
|
||||
|
||||
-- Travel meta is gated on report-type (from templates/travel.yml), not on purpose.
|
||||
local travel = ""
|
||||
if purpose ~= nil and purpose ~= "" then
|
||||
if report_type == "travel" then
|
||||
travel = string.format([[
|
||||
<div class="print-travel-meta print-only">
|
||||
<hr class="rule" />
|
||||
|
||||
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
|
||||
|
185
styles/print.css
185
styles/print.css
@@ -1,4 +1,4 @@
|
||||
/* Print / PDF styles matching typst-templates product_test_template.typ */
|
||||
/* Print / PDF styles (WeasyPrint); table chrome matches HTML report.css */
|
||||
|
||||
@font-face {
|
||||
font-family: "IRNazanin";
|
||||
@@ -30,27 +30,27 @@
|
||||
|
||||
:root {
|
||||
--text: #000000;
|
||||
--header-fill: #ebebeb; /* ~luma(235) */
|
||||
--text2: #57606a;
|
||||
--stroke: #000000;
|
||||
--fill: #f6f8fa;
|
||||
}
|
||||
|
||||
@page {
|
||||
size: A4;
|
||||
/* Extra left margin for rotated sidebar; bottom-left box = typst page chip */
|
||||
margin: 2.5cm 2cm 2.5cm 2.8cm;
|
||||
/* Match typst-templates: 2cm sides, 2.5cm top/bottom */
|
||||
margin: 2.5cm 2cm 2.5cm 2cm;
|
||||
@bottom-center {
|
||||
content: counter(page);
|
||||
font-family: "IRNazanin", sans-serif;
|
||||
font-size: 11pt;
|
||||
content: none;
|
||||
}
|
||||
@top-center {
|
||||
content: element(report-header);
|
||||
width: 100%;
|
||||
}
|
||||
/* WeasyPrint only updates counter(page) reliably in @page margin boxes
|
||||
(not inside position:fixed). Place the black n/N chip at bottom-left. */
|
||||
/* 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) " / " counter(pages);
|
||||
content: counter(page, persian) "/" counter(pages, persian);
|
||||
font-family: "IRZar", "IRNazanin", sans-serif;
|
||||
font-size: 11pt;
|
||||
color: #fff;
|
||||
@@ -60,8 +60,11 @@
|
||||
height: 20pt;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
margin-left: -1.6cm;
|
||||
/* Align chip's content-facing (right) edge with the sidebar rule. */
|
||||
margin-left: -1.66cm;
|
||||
margin-bottom: 0.35cm;
|
||||
direction: ltr;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,14 +75,20 @@
|
||||
}
|
||||
|
||||
@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: rtl;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -138,17 +147,23 @@ nav.toc-active,
|
||||
}
|
||||
|
||||
/* ===== 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.25cm;
|
||||
/* Leave room at the bottom for the @page bottom-left page chip */
|
||||
bottom: 3.4cm;
|
||||
width: 16.5cm;
|
||||
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;
|
||||
transform: rotate(-90deg);
|
||||
/* Pull into left margin (negative left is clipped by WeasyPrint) */
|
||||
transform: translateX(-0.75cm) rotate(-90deg);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-direction: row-reverse;
|
||||
align-items: stretch;
|
||||
font-family: "IRZar", "IRNazanin", sans-serif;
|
||||
font-size: 13pt;
|
||||
@@ -157,15 +172,22 @@ nav.toc-active,
|
||||
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;
|
||||
justify-content: 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 6pt;
|
||||
padding: 0 1pt 0 4pt;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
@@ -183,31 +205,33 @@ nav.toc-active,
|
||||
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: 0.95;
|
||||
line-height: 1.15;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.print-title-block .company-line {
|
||||
font-size: 21pt;
|
||||
font-size: 22.1pt;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.print-title-block .company-line .subtitle {
|
||||
font-size: 14pt;
|
||||
font-size: 15.6pt;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.print-title-block .report-title {
|
||||
font-size: 14pt;
|
||||
font-size: 15.6pt;
|
||||
font-weight: bold;
|
||||
margin: 2pt 0 0 0;
|
||||
margin: 6pt 0 0 0;
|
||||
}
|
||||
|
||||
.print-title-block .logo {
|
||||
@@ -215,7 +239,7 @@ nav.toc-active,
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* Travel-report meta block (only when purpose is set) */
|
||||
/* Travel-report meta block (injected when report-type is travel) */
|
||||
.print-travel-meta {
|
||||
margin: 12pt 0 24pt 0;
|
||||
}
|
||||
@@ -262,20 +286,13 @@ h1, h2, h3, h4 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
|
||||
/* Level-1/2 headings get a full-width rule above (typst show heading) */
|
||||
h1, h2 {
|
||||
font-size: 14pt;
|
||||
margin: 16pt 0 10pt 0;
|
||||
padding-top: 8pt;
|
||||
border-top: 1pt solid black;
|
||||
}
|
||||
|
||||
/* First body heading after Quarto title header: no rule (typst skips at top) */
|
||||
#title-block-header + h1,
|
||||
.print-title-block + h1,
|
||||
.print-travel-meta + h1 {
|
||||
border-top: none !important;
|
||||
padding-top: 0 !important;
|
||||
margin-top: 8pt;
|
||||
}
|
||||
|
||||
@@ -286,34 +303,37 @@ 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;
|
||||
}
|
||||
|
||||
/* ===== Tables (typst: 0.5pt stroke, header luma fill, content-sized) ===== */
|
||||
/* ===== Tables (rounded chrome like HTML; black stroke) ===== */
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
margin: 10pt auto;
|
||||
border: 0.5pt solid var(--stroke);
|
||||
border: 1pt solid var(--stroke);
|
||||
border-radius: 8pt;
|
||||
overflow: hidden;
|
||||
font-size: 12.5pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 0.5pt solid var(--stroke);
|
||||
border: none;
|
||||
padding: 7pt 8pt;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
@@ -321,9 +341,82 @@ th, td {
|
||||
|
||||
thead th,
|
||||
tr:first-child th {
|
||||
background: var(--header-fill);
|
||||
background: var(--fill);
|
||||
font-weight: bold;
|
||||
color: var(--text);
|
||||
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"],
|
||||
@@ -333,11 +426,11 @@ table .ltr {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Summary box */
|
||||
/* Summary box — same chrome as HTML (soft stroke) */
|
||||
.summary-box {
|
||||
border: 0.5pt solid #d0d7de;
|
||||
border: 1pt solid #d0d7de;
|
||||
border-radius: 8pt;
|
||||
background: #f6f8fa;
|
||||
background: var(--fill);
|
||||
padding: 10pt 12pt;
|
||||
margin: 10pt 0;
|
||||
page-break-inside: avoid;
|
||||
|
||||
@@ -41,24 +41,81 @@ h1, h2, h3 {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
h1.title {
|
||||
font-size: 1.75rem;
|
||||
margin-bottom: 0.25rem;
|
||||
p {
|
||||
margin: 0.5em 0 0.85em 0;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.1rem;
|
||||
color: #444;
|
||||
margin-top: 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,
|
||||
.quarto-title-block,
|
||||
.quarto-title,
|
||||
.quarto-title-meta,
|
||||
.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;
|
||||
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 {
|
||||
margin: 1.5rem 0;
|
||||
padding: 1rem 1.25rem;
|
||||
@@ -106,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 {
|
||||
@@ -144,8 +269,10 @@ code {
|
||||
unicode-bidi: embed;
|
||||
}
|
||||
|
||||
/* Print chrome is injected for WeasyPrint PDF; hide on screen */
|
||||
/* 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,161 +0,0 @@
|
||||
// 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,
|
||||
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 {
|
||||
[]
|
||||
},
|
||||
)
|
||||
]
|
||||
|
||||
// Travel reports pass `purpose`; product-test reports put general info in the body.
|
||||
let show-travel-meta = purpose != none and purpose != ""
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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