Refactor templates for consistency and clarity.
This commit is contained in:
@@ -5,16 +5,16 @@
|
||||
)
|
||||
|
||||
#let destination-names(destinations) = {
|
||||
if destinations == none { "" }
|
||||
else { destinations.map(d => d.name).join(" - ") }
|
||||
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)],
|
||||
[#label], [#strong(value)],
|
||||
)
|
||||
|
||||
#let report-meta-label-width = 8em
|
||||
@@ -40,50 +40,52 @@
|
||||
) = {
|
||||
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),
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
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)
|
||||
@@ -97,14 +99,17 @@
|
||||
#set par(leading: 0.9em, spacing: 0em)
|
||||
#text(21pt, font: fonts.body, weight: "bold", strong(company))
|
||||
#if subtitle != none and subtitle != "" {
|
||||
text(14pt, " | "+subtitle)
|
||||
text(14pt, " | " + subtitle)
|
||||
}
|
||||
#linebreak()
|
||||
#text(14pt, strong(title))
|
||||
]
|
||||
],
|
||||
[],
|
||||
[#align(left, image("template_files/kimia razi logo bw.png", height: 1.8cm))],
|
||||
[#align(left, image(
|
||||
"template_files/kimia razi logo bw.png",
|
||||
height: 1.8cm,
|
||||
))],
|
||||
)
|
||||
]
|
||||
set align(right)
|
||||
@@ -115,9 +120,17 @@
|
||||
#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,
|
||||
[مقصد:],
|
||||
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,
|
||||
[تیم اعزامی:],
|
||||
authors.map(author => author.name).join(" - "),
|
||||
),
|
||||
report-meta-row(report-meta-label-width, [تاریخ:], date),
|
||||
)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user