147 lines
3.7 KiB
Typst
147 lines
3.7 KiB
Typst
// Families from template_files/; compile with --font-path template_files
|
||
#let fonts = (
|
||
body: "IRNazanin",
|
||
sidebar: "IRZar",
|
||
)
|
||
|
||
#let destination-names(destinations) = {
|
||
if destinations == none { "" } else {
|
||
destinations.map(d => d.name).join(" - ")
|
||
}
|
||
}
|
||
|
||
#let report-meta-row(label-width, label, value) = grid(
|
||
columns: (label-width, 1fr),
|
||
gutter: (2em, 0pt),
|
||
align: right + top,
|
||
[#label], [#strong(value)],
|
||
)
|
||
|
||
#let report-meta-label-width = 8em
|
||
|
||
#let report(
|
||
font: fonts.body,
|
||
fontsize: 13pt,
|
||
company: "کیمیا رازی",
|
||
title: "گزارش مأموریت",
|
||
subtitle: "دپارتمان جوهر",
|
||
destinations: (),
|
||
purpose: "",
|
||
authors: (
|
||
(
|
||
name: "دیاکو سلطانپور",
|
||
affiliation: "کیمیا رازی - واحد جوهر",
|
||
email: "diaco@kimiarazi.com",
|
||
note: "ink dept",
|
||
),
|
||
),
|
||
date: "",
|
||
body,
|
||
) = {
|
||
set page(
|
||
margin: (left: 2cm, right: 2cm, top: 2.5cm, bottom: 2.5cm),
|
||
paper: "a4",
|
||
header: context {
|
||
if counter(page).get().first() > 1 [
|
||
#grid(
|
||
gutter: 5pt,
|
||
columns: (auto, 1fr, auto, auto),
|
||
grid.cell(align: right, stroke: 1pt, image(
|
||
height: 19pt,
|
||
"template_files/kimia razi logo bw.png",
|
||
)),
|
||
align: top + right,
|
||
company,
|
||
"|",
|
||
subtitle,
|
||
grid.hline(start: 0),
|
||
)]
|
||
},
|
||
background: place(
|
||
dx: -64%,
|
||
dy: 73%,
|
||
rotate(
|
||
-90deg,
|
||
text(13pt, font: fonts.sidebar, grid(
|
||
columns: (30%, 30%, 5%),
|
||
rows: 20pt,
|
||
align: top,
|
||
[#h(1fr) گزارش ماموریت #destination-names(destinations) #h(5fr)],
|
||
context [
|
||
#let side_authors = if authors.len() == 0 {
|
||
""
|
||
} else {
|
||
authors.map(author => author.name).join(" - ")
|
||
}
|
||
#let textwidth = measure(side_authors).width
|
||
#if authors.len() > 0 and textwidth > page.width * 0.28 {
|
||
side_authors = authors.first().name + " و ..."
|
||
}
|
||
#h(1fr) #side_authors #h(4fr)],
|
||
grid.cell(fill: black, align: center, stroke: 1pt, text(
|
||
fill: white,
|
||
context (counter(page).display("۱/۱", both: true)),
|
||
)),
|
||
grid.hline(start: 0),
|
||
)),
|
||
),
|
||
),
|
||
numbering: "۱",
|
||
)
|
||
set text(lang: "fa", dir: rtl, font: font, size: fontsize)
|
||
// ===== TITLE SECTION =====
|
||
block(width: 100%)[
|
||
#grid(
|
||
columns: (auto, auto, 1fr),
|
||
align: top,
|
||
[
|
||
#align(right)[
|
||
#set par(leading: 0.9em, spacing: 0em)
|
||
#text(21pt, font: fonts.body, weight: "bold", strong(company))
|
||
#if subtitle != none and subtitle != "" {
|
||
text(14pt, " | " + subtitle)
|
||
}
|
||
#linebreak()
|
||
#text(14pt, strong(title))
|
||
]
|
||
],
|
||
[],
|
||
[#align(left, image(
|
||
"template_files/kimia razi logo bw.png",
|
||
height: 1.8cm,
|
||
))],
|
||
)
|
||
]
|
||
set align(right)
|
||
v(20pt)
|
||
align(center, line(length: 100%))
|
||
text(1.4em, strong([اطلاعات کلی]))
|
||
align(center, block(width: 100%)[
|
||
#set par(leading: 0.9em, spacing: 0em)
|
||
#stack(
|
||
spacing: 14pt,
|
||
report-meta-row(
|
||
report-meta-label-width,
|
||
[مقصد:],
|
||
destination-names(destinations),
|
||
),
|
||
report-meta-row(report-meta-label-width, [هدف مأموریت:], purpose),
|
||
report-meta-row(
|
||
report-meta-label-width,
|
||
[تیم اعزامی:],
|
||
authors.map(author => author.name).join(" - "),
|
||
),
|
||
report-meta-row(report-meta-label-width, [تاریخ:], date),
|
||
)
|
||
])
|
||
v(40pt)
|
||
align(center, line(length: 100%))
|
||
|
||
body
|
||
}
|
||
|
||
#let report-table(..args) = table(
|
||
align: center,
|
||
..args,
|
||
)
|