Add Quarto HTML+Typst business report templates.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
136
templates/typst/typst-template.typ
Normal file
136
templates/typst/typst-template.typ
Normal file
@@ -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,
|
||||
)
|
||||
Reference in New Issue
Block a user