Refactor templates for consistency and clarity.

This commit is contained in:
2026-06-30 14:01:02 +03:30
parent 46a1d1255c
commit 0cc8781f49
6 changed files with 364 additions and 291 deletions

View File

@@ -15,81 +15,103 @@
company: "کیمیا رازی",
title: "گزارش تست مواد اولیه",
subtitle: "دپارتمان جوهر",
destinations: (none),
destinations: none,
purpose: none,
authors: ("دیاکو سلطانپور"),
authors: "دیاکو سلطانپور",
date: "",
doc,
) = {
set math.equation(numbering: "(1)", supplement: auto)
set math.equation(numbering: "(1)", supplement: auto)
set par(leading: 1em)
// Set and show rules from before.
set par(leading: 1em)
// Set and show rules from before.
set text(
font: font,
size: fontsize
)
set page(
paper: "a4",
header:
context {if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (4.2%,25%,3%,20%),
grid.cell(align: right, stroke: 1pt, image(height: 19pt,"kimia razi logo bw.png")),
align: top+right,
title,
"|",
subtitle,
grid.hline(start: 0),)]},
background: place(
dx: -54%,
dy: 63.5%,
rotate(
-90deg,
text(13pt,font: "IRZar",
// TODO: do not use grid. use #text and fr if possible
grid(
columns: (15%,25%, 40% ,5%),
rows: 20pt,
align: top,
context[
#h(1fr) #company #h(2fr)|],
[#h(2fr) #title #h(4fr)|],
[#h(2fr)#destinations.map(destination => destination.name).join("\n") #h(2fr)],
grid.cell(fill: black,
align: center,
stroke: 1pt,
text(fill: white,
context(counter(page).display("۱/۱", both: true,)))),
grid.hline(start: 0),
)
)
)
)
)
set document(
title: title,
author: authors.map(author => author.name),
)
set align(right)
if subtitle != none {
text(align(center,{strong(company)}))
set text(
font: font,
size: fontsize,
)
set page(
paper: "a4",
header: context {
if counter(page).get().first() > 1 [
#grid(
gutter: 5pt,
columns: (4.2%, 25%, 3%, 20%),
grid.cell(align: right, stroke: 1pt, image(
height: 19pt,
"kimia razi logo bw.png",
)),
align: top + right,
title,
"|",
subtitle,
grid.hline(start: 0),
)]
},
background: place(
dx: -54%,
dy: 63.5%,
rotate(
-90deg,
text(
13pt,
font: "IRZar",
// TODO: do not use grid. use #text and fr if possible
grid(
columns: (15%, 25%, 40%, 5%),
rows: 20pt,
align: top,
context [
#h(1fr) #company #h(2fr)|],
[#h(2fr) #title #h(4fr)|],
[#h(2fr)#(
destinations.map(destination => destination.name).join("\n")
) #h(2fr)],
grid.cell(fill: black, align: center, stroke: 1pt, text(
fill: white,
context (counter(page).display("۱/۱", both: true)),
)),
grid.hline(start: 0),
),
),
),
),
)
set document(
title: title,
author: authors.map(author => author.name),
)
// ===== TITLE SECTION =====
block(width: 100%)[
#grid(
columns: (auto, auto, 1fr),
align: top,
[
#align(right)[
#set par(leading: 0.9em, spacing: 0em)
#text(21pt, font: font, weight: "bold", strong(company))
#if subtitle != none and subtitle != "" {
text(14pt, " | " + subtitle)
}
text(18pt, align(center,{strong(title)}))
set text(13pt, font: "IRLotus")
if subtitle != none {
text(align(center,{subtitle}))
}
align(center, line(length: 100%))
// set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
#linebreak()
#text(14pt, strong(title))
]
],
[],
[#align(left, image(
"template_files/kimia razi logo bw.png",
height: 1.8cm,
))],
)
]
line(length: 100%)
// set heading(numbering: "۱.۱- ")
set math.equation(numbering: "(1)")
set footnote(numbering: "۱.")
set footnote.entry(separator: line(length: 100%, stroke: 0.5pt))
set footnote.entry(indent: 0em)
set align(right)
show heading: it => [
#set align(right)
@@ -104,7 +126,7 @@
justify: true,
)
columns(1, doc)
columns(1, doc)
}
// Renders a centered, non-breakable result table.
@@ -118,15 +140,13 @@
#let test_result_table(cols) = {
block(
breakable: false,
align(center,
table(
columns: (auto,) * (cols.first().len()),
inset: 8pt,
stroke: 0.5pt,
fill: (x, y) => if y == 0 { luma(230) },
..cols.flatten(),
)
)
align(center, table(
columns: (auto,) * (cols.first().len()),
inset: 8pt,
stroke: 0.5pt,
fill: (x, y) => if y == 0 { luma(230) },
..cols.flatten(),
)),
)
}
@@ -179,7 +199,13 @@
// "۹",
// "Esmaltes",
// )
#let general_info_table(received_date, report_date, sample_type, sample_count, supplier) = {
#let general_info_table(
received_date,
report_date,
sample_type,
sample_count,
supplier,
) = {
grid(
columns: (auto, auto),
inset: 10pt,
@@ -197,20 +223,18 @@
#let received_samples_table(rows) = {
block(
breakable: false,
align(center,
table(
columns: (auto, auto, auto, auto),
align: right,
stroke: 0.5pt,
inset: 7pt,
fill: (x, y) => if y == 0 { luma(235) },
[*نوع پیگمنت*],
[*کد تأمین کننده*],
[*کد داخلی*],
[*شماره سند*],
..rows.flatten(),
)
)
align(center, table(
columns: (auto, auto, auto, auto),
align: right,
stroke: 0.5pt,
inset: 7pt,
fill: (x, y) => if y == 0 { luma(235) },
[*نوع پیگمنت*],
[*کد تأمین کننده*],
[*کد داخلی*],
[*شماره سند*],
..rows.flatten(),
)),
)
}