commit 204f0b6b34ab544bfdb0386bd6fabd4ba70706d1 Author: DustVoice Date: Fri Jul 14 09:36:43 2023 +0200 Initial commit with working version and partial german support diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..687e090 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/* +/*/ +!/.gitignore + +!/dustypst.typ +!/langs.typ +!/lang_de.typ + +!/fonts/ diff --git a/dustypst.typ b/dustypst.typ new file mode 100644 index 0000000..47b58cf --- /dev/null +++ b/dustypst.typ @@ -0,0 +1,417 @@ +#import "langs.typ": default_lang + +#let default_font = ( + name: "Inter", + name_raw: "JetBrains Mono", + size: 13pt, +) + +#let dustvoice_author = (name: "DustVoice", email: "info@dustvoice.de", affiliation: none, phone: none) + +#let dracula = ( + colors: ( + background: rgb("#282a36"), + selection: rgb("#44475a"), + foreground: rgb("#f8f8f2"), + comment: rgb("#6272a4"), + cyan: rgb("#8be9fd"), + green: rgb("#50fa7b"), + orange: rgb("#ffb86c"), + pink: rgb("#ff79c6"), + purple: rgb("#bd93f9"), + red: rgb("#ff5555"), + yellow: rgb("#f1fa8c"), + ), +) + +#let cont2str(content) = { + if type(content) == "content" and content.has("text") { + content.text + } else if type(content) == "string" { + content + } else { + "" + } +} + +#let str2color(color) = { + if type(color) == "string" { + rgb(color) + } else if type(color) == "color" { + color + } +} + +#let border-block(width: 100%, color, content) = block( + align(left, content), + stroke: .25em + str2color(color), + inset: 1em, + radius: .5em, + width: width +) +#let fill-block(width: 100%, color, content) = block( + align(left, content), + fill: str2color(color), + inset: 1em, + radius: .5em, + width: width, +) +#let border-box(width: auto, color, content) = box( + content, + stroke: scale * .25em + str2color(color), + outset: scale * .25em, + radius: scale * .25em, + inset: (x: lr_inset, y: tb_inset), + width: width, +) +#let fill-box(width: auto, color, content) = box( + content, + fill: str2color(color), + inset: (left: .25em, right: .25em, top: .25em), + outset: (bottom: .25em), + radius: .25em, + width: width, +) + +#let colorbox(title: "title", title_color: none, color: black, textcolor: white, content) = { + return box( + fill: none, + stroke: .25em + color, + radius: .5em, + width: 100%, + clip: false + )[ + #if title != "" { + [ + #box( + fill: if title_color != none { title_color } else { color }, + inset: (left: 1em, top: .5em, right: 1em, bottom: .5em), + radius: (top-left: .5em, bottom-right: .5em), + )[ + #text(fill: textcolor, weight: "bold")[#title] + ]\ + ] + } else { + rect( + fill: str2color(color), + width: 100%, + height: 2em, + ) + } + #box( + width: 100%, + inset: (x: 1em, bottom: 1em) + )[ + #content + ] + ] +} + +#let code(root: false, lang: "", content) = { + let text_content = [ + #if root { + emoji.key + h(.2em) + } + #raw( + lang: lang, + block: false, + cont2str(content) + ) + ] + + fill-box( + dracula.colors.yellow, + text_content + ) +} + +#let cmd(root: false, content) = code(root: root, lang: "fish", content) +#let cmd-root(content) = cmd(root: true, content) + +#let linkfn(plain: false, color: dracula.colors.green, dest, body) = { + let link_markup = [ + #link(dest, body)#footnote(link(dest, dest)) + ] + + if plain { + link_markup + } else { + fill-box(color, link_markup) + } +} + +#let filepath(content) = fill-box(dracula.colors.cyan, raw(cont2str(content))) + +#let filesrc(readonly: false, exec: false, perm: false, part: false, filename, content) = { + let title = [ + #let add_space = false + #if readonly { + emoji.lock + add_space = true + } + #if exec { + emoji.joystick + add_space = true + } + #if perm { + emoji.key + add_space = true + } + #if add_space { + h(.5em) + } + #raw(filename) + #if part { + h(.5em) + sym.dots + } + ] + + colorbox(title: text(weight: "regular", title), color: dracula.colors.cyan, textcolor: black, content) +} + +#let pkg-target(aur: false, name) = { + if aur { + return "https://aur.archlinux.org/packages/" + name + } else { + return "https://archlinux.org/packages/" + name + } +} + +#let pkg-link(target: "", plain: false, nofn: false, aur: false, name) = { + if target == "" { + target = pkg-target(aur: aur, name) + } + + let link_function(target, content) = if nofn { + link(target, content) + } else { + linkfn(color: dracula.colors.orange, target, content) + } + + if plain { + link_function(target, name) + } else { + if aur { + link_function(target)[#raw(name)#sub(raw("AUR"))] + } else { + link_function(target, raw(name)) + } + } +} + +#let pkg(name) = pkg-link(name) +#let pkg-aur(name) = pkg-link(aur: true, name) + +// IMPORTANT: The community repository was recently merged into extra! +#let pkgtable(lang: default_lang, core: "", extra: "", /*community: "",*/ aur: "", multilib: "", groups: "") = { + colorbox(title: lang.packages, color: dracula.colors.orange, + text(size: .75em, fill: dracula.colors.selection, + for repo in ( + ("Core", "https://archlinux.org/packages/?repo=Core", core), + ("Extra", "https://archlinux.org/packages/?repo=Extra", extra), + //("Community", "https://archlinux.org/packages/?repo=Community", community), + ("Multilib", "https://archlinux.org/packages/?repo=Multilib", multilib), + ("AUR", "https://aur.archlinux.org/packages", aur), + ("Groups", "https://archlinux.org/groups/", groups), + ) { + if repo.at(2).len() > 0 { + [ + / #repo.at(0): #link(repo.at(1), emoji.chain)\ #{ + repo.at(2).split(" ").map(pkg => { + pkg-link(plain: true, nofn: true, aur: repo.at(0) == "AUR", pkg) + }).join(" " + sym.hyph.point + " ") + } + ] + } + } + ) + ) +} + +#let note(lang: default_lang, content) = colorbox( + title: lang.note, + color: dracula.colors.comment, + content +) +#let tip(lang: default_lang, content) = colorbox( + title: lang.tip, + color: dracula.colors.purple, + content +) +#let important(lang: default_lang, content) = colorbox( + title: lang.important, + color: dracula.colors.pink, + content +) +#let warning(lang: default_lang, content) = colorbox( + title: lang.warning, + color: dracula.colors.red, + content +) +#let caution(lang: default_lang, content) = colorbox( + title: lang.caution, + color: dracula.colors.background, + content +) + +#let codeblock(content) = colorbox(title: "", color: dracula.colors.yellow, content) + +#let terminal(windows: false, lang: "fish", root: false, path, raw_content) = { + if windows { + lang = "cmd" + } + + let format(content) = { + raw(lang: lang, cont2str(content)) + } + + let content = { + let children = { + if raw_content.has("children") { + for child in raw_content.children { + format(child) + } + } else { + format(raw_content) + } + } + + children + } + + let title = [ + #if windows { + emoji.window + } + #if root { + emoji.key + h(1em) + } + #path + ] + + colorbox( + title: text( + weight: "regular", + size: .75em, + title + ), + color: dracula.colors.yellow, + textcolor: black, + content + ) +} +#let terminal-root(windows: false, lang: "fish", path, content) = terminal(windows: windows, lang: lang, root: true, path, content) + +#let admindoc_project( + title: none, + subtitle: none, + authors: (dustvoice_author,), + font: default_font, + lang: default_lang, + outlined: true, + body, +) = { + set text(font: font.name, size: font.size, lang: lang.lang) + + show raw: set text(font: font.name_raw) + + set document(author: authors.map(a => a.name), title: title) + + set page( + paper: "a5", + header: [ + #counter(footnote).update(0) + #align( + center, + block(spacing: 0pt)[ + #if (title != none) {[ + #text(1em, fill: dracula.colors.pink, title)\ + ]} + #if (subtitle != none) {[ + #text(0.5em, fill: dracula.colors.purple, subtitle) + ]} + ] + ) + ], + numbering: none + ) + + show outline.entry: it => {[ + #link(it.element.location(), it.body)#box(width: 1fr, repeat[#h(.25em)#sym.dot]) + ]} + + if outlined { + outline(title: lang.outline, indent: none) + } + + set par(justify: true) + + set figure(numbering: "1") + + set heading(numbering: "1.1") + + show heading: heading => { + pagebreak() + text(1.25em, heading) + } + + body +} + +#let userdoc_project( + title: none, + authors: (dustvoice_author,), + date: datetime.today().display("[day].[month].[year]"), + logo: none, + font: default_font, + lang: default_lang, + outlined: true, + body, +) = { + set document(author: authors.map(a => a.name), title: title) + + set page(numbering: "1", number-align: center) + + set text(font: font.name, size: font.size, lang: lang.lang) + + show raw: set text(font: font.name_raw) + + set heading(numbering: "1.1") + + v(0.6fr) + if logo != none { + align(right, image(logo, width: 26%)) + } + v(9.6fr) + + text(1.1em, date) + v(1.2em, weak: true) + text(2em, weight: 700, title) + + pad( + top: 0.7em, + right: 20%, + grid( + columns: (1fr,) * calc.min(3, authors.len()), + gutter: 1em, + ..authors.map(author => align(start)[ + *#author.name* \ + #author.email \ + #author.affiliation \ + #author.phone + ]), + ), + ) + + v(2.4fr) + pagebreak() + + set par(justify: true) + + if outlined { + outline(title: lang.outline) + pagebreak() + } + + body +} \ No newline at end of file diff --git a/fonts/Inter-Black.ttf b/fonts/Inter-Black.ttf new file mode 100644 index 0000000..3a156be Binary files /dev/null and b/fonts/Inter-Black.ttf differ diff --git a/fonts/Inter-BlackItalic.ttf b/fonts/Inter-BlackItalic.ttf new file mode 100644 index 0000000..a440694 Binary files /dev/null and b/fonts/Inter-BlackItalic.ttf differ diff --git a/fonts/Inter-Bold.ttf b/fonts/Inter-Bold.ttf new file mode 100644 index 0000000..d439b32 Binary files /dev/null and b/fonts/Inter-Bold.ttf differ diff --git a/fonts/Inter-BoldItalic.ttf b/fonts/Inter-BoldItalic.ttf new file mode 100644 index 0000000..5050997 Binary files /dev/null and b/fonts/Inter-BoldItalic.ttf differ diff --git a/fonts/Inter-ExtraBold.ttf b/fonts/Inter-ExtraBold.ttf new file mode 100644 index 0000000..78b5cc1 Binary files /dev/null and b/fonts/Inter-ExtraBold.ttf differ diff --git a/fonts/Inter-ExtraBoldItalic.ttf b/fonts/Inter-ExtraBoldItalic.ttf new file mode 100644 index 0000000..7a2bd4f Binary files /dev/null and b/fonts/Inter-ExtraBoldItalic.ttf differ diff --git a/fonts/Inter-ExtraLight.ttf b/fonts/Inter-ExtraLight.ttf new file mode 100644 index 0000000..55e2e94 Binary files /dev/null and b/fonts/Inter-ExtraLight.ttf differ diff --git a/fonts/Inter-ExtraLightItalic.ttf b/fonts/Inter-ExtraLightItalic.ttf new file mode 100644 index 0000000..983d98d Binary files /dev/null and b/fonts/Inter-ExtraLightItalic.ttf differ diff --git a/fonts/Inter-Italic.ttf b/fonts/Inter-Italic.ttf new file mode 100644 index 0000000..aff213c Binary files /dev/null and b/fonts/Inter-Italic.ttf differ diff --git a/fonts/Inter-Light.ttf b/fonts/Inter-Light.ttf new file mode 100644 index 0000000..1a7ec67 Binary files /dev/null and b/fonts/Inter-Light.ttf differ diff --git a/fonts/Inter-LightItalic.ttf b/fonts/Inter-LightItalic.ttf new file mode 100644 index 0000000..31c19ed Binary files /dev/null and b/fonts/Inter-LightItalic.ttf differ diff --git a/fonts/Inter-Medium.ttf b/fonts/Inter-Medium.ttf new file mode 100644 index 0000000..d014903 Binary files /dev/null and b/fonts/Inter-Medium.ttf differ diff --git a/fonts/Inter-MediumItalic.ttf b/fonts/Inter-MediumItalic.ttf new file mode 100644 index 0000000..2bb6a9e Binary files /dev/null and b/fonts/Inter-MediumItalic.ttf differ diff --git a/fonts/Inter-Regular.ttf b/fonts/Inter-Regular.ttf new file mode 100644 index 0000000..af82a2e Binary files /dev/null and b/fonts/Inter-Regular.ttf differ diff --git a/fonts/Inter-SemiBold.ttf b/fonts/Inter-SemiBold.ttf new file mode 100644 index 0000000..3fc77c7 Binary files /dev/null and b/fonts/Inter-SemiBold.ttf differ diff --git a/fonts/Inter-SemiBoldItalic.ttf b/fonts/Inter-SemiBoldItalic.ttf new file mode 100644 index 0000000..46918f3 Binary files /dev/null and b/fonts/Inter-SemiBoldItalic.ttf differ diff --git a/fonts/Inter-Thin.ttf b/fonts/Inter-Thin.ttf new file mode 100644 index 0000000..4e067ec Binary files /dev/null and b/fonts/Inter-Thin.ttf differ diff --git a/fonts/Inter-ThinItalic.ttf b/fonts/Inter-ThinItalic.ttf new file mode 100644 index 0000000..e57a7aa Binary files /dev/null and b/fonts/Inter-ThinItalic.ttf differ diff --git a/fonts/JetBrainsMono-Bold.ttf b/fonts/JetBrainsMono-Bold.ttf new file mode 100644 index 0000000..8c93043 Binary files /dev/null and b/fonts/JetBrainsMono-Bold.ttf differ diff --git a/fonts/JetBrainsMono-BoldItalic.ttf b/fonts/JetBrainsMono-BoldItalic.ttf new file mode 100644 index 0000000..1ddf216 Binary files /dev/null and b/fonts/JetBrainsMono-BoldItalic.ttf differ diff --git a/fonts/JetBrainsMono-ExtraBold.ttf b/fonts/JetBrainsMono-ExtraBold.ttf new file mode 100644 index 0000000..435d7a7 Binary files /dev/null and b/fonts/JetBrainsMono-ExtraBold.ttf differ diff --git a/fonts/JetBrainsMono-ExtraBoldItalic.ttf b/fonts/JetBrainsMono-ExtraBoldItalic.ttf new file mode 100644 index 0000000..79e616e Binary files /dev/null and b/fonts/JetBrainsMono-ExtraBoldItalic.ttf differ diff --git a/fonts/JetBrainsMono-ExtraLight.ttf b/fonts/JetBrainsMono-ExtraLight.ttf new file mode 100644 index 0000000..c131cbf Binary files /dev/null and b/fonts/JetBrainsMono-ExtraLight.ttf differ diff --git a/fonts/JetBrainsMono-ExtraLightItalic.ttf b/fonts/JetBrainsMono-ExtraLightItalic.ttf new file mode 100644 index 0000000..a768985 Binary files /dev/null and b/fonts/JetBrainsMono-ExtraLightItalic.ttf differ diff --git a/fonts/JetBrainsMono-Italic.ttf b/fonts/JetBrainsMono-Italic.ttf new file mode 100644 index 0000000..ccc9d6a Binary files /dev/null and b/fonts/JetBrainsMono-Italic.ttf differ diff --git a/fonts/JetBrainsMono-Light.ttf b/fonts/JetBrainsMono-Light.ttf new file mode 100644 index 0000000..15f15a2 Binary files /dev/null and b/fonts/JetBrainsMono-Light.ttf differ diff --git a/fonts/JetBrainsMono-LightItalic.ttf b/fonts/JetBrainsMono-LightItalic.ttf new file mode 100644 index 0000000..506208f Binary files /dev/null and b/fonts/JetBrainsMono-LightItalic.ttf differ diff --git a/fonts/JetBrainsMono-Medium.ttf b/fonts/JetBrainsMono-Medium.ttf new file mode 100644 index 0000000..9767115 Binary files /dev/null and b/fonts/JetBrainsMono-Medium.ttf differ diff --git a/fonts/JetBrainsMono-MediumItalic.ttf b/fonts/JetBrainsMono-MediumItalic.ttf new file mode 100644 index 0000000..415a9e3 Binary files /dev/null and b/fonts/JetBrainsMono-MediumItalic.ttf differ diff --git a/fonts/JetBrainsMono-Regular.ttf b/fonts/JetBrainsMono-Regular.ttf new file mode 100644 index 0000000..dff66cc Binary files /dev/null and b/fonts/JetBrainsMono-Regular.ttf differ diff --git a/fonts/JetBrainsMono-SemiBold.ttf b/fonts/JetBrainsMono-SemiBold.ttf new file mode 100644 index 0000000..a70e69b Binary files /dev/null and b/fonts/JetBrainsMono-SemiBold.ttf differ diff --git a/fonts/JetBrainsMono-SemiBoldItalic.ttf b/fonts/JetBrainsMono-SemiBoldItalic.ttf new file mode 100644 index 0000000..968602e Binary files /dev/null and b/fonts/JetBrainsMono-SemiBoldItalic.ttf differ diff --git a/fonts/JetBrainsMono-Thin.ttf b/fonts/JetBrainsMono-Thin.ttf new file mode 100644 index 0000000..7dbe2ac Binary files /dev/null and b/fonts/JetBrainsMono-Thin.ttf differ diff --git a/fonts/JetBrainsMono-ThinItalic.ttf b/fonts/JetBrainsMono-ThinItalic.ttf new file mode 100644 index 0000000..c6ad6c2 Binary files /dev/null and b/fonts/JetBrainsMono-ThinItalic.ttf differ diff --git a/lang_de.typ b/lang_de.typ new file mode 100644 index 0000000..c89131a --- /dev/null +++ b/lang_de.typ @@ -0,0 +1,11 @@ +#import "langs.typ" +#import "dustypst.typ" + +#let default_lang = langs.de + +#let pkgtable(core: "", extra: "", /*community: "",*/ aur: "", multilib: "", groups: "") = pkgtable_(lang: default_lang, core: "", extra: "", /*community: "",*/ aur: "", multilib: "", groups: "") +#let note(content) = dustypst.note(lang: default_lang, content) +#let tip(content) = dustypst.tip(lang: default_lang, content) +#let important(content) = dustypst.important(lang: default_lang, content) +#let warning(content) = dustypst.warning(lang: default_lang, content) +#let caution(content) = dustypst.caution(lang: default_lang, content) \ No newline at end of file diff --git a/langs.typ b/langs.typ new file mode 100644 index 0000000..4bd8375 --- /dev/null +++ b/langs.typ @@ -0,0 +1,23 @@ +#let en = ( + lang: "en", + outline: "Chapters", + packages: "Packages", + note: "Note", + tip: "Tip", + important: "Important", + warning: "Warning", + caution: "Caution", +) + +#let de = ( + lang: "de", + outline: "Inhaltsverzeichnis", + packages: "Pakete", + note: "Anmerkung", + tip: "Hinweis", + important: "Wichtig", + warning: "Warnung", + caution: "Achtung", +) + +#let default_lang = en \ No newline at end of file