From 77d197c029444ca6aab11570c8a1b088d72990c0 Mon Sep 17 00:00:00 2001 From: teridax Date: Mon, 1 Jul 2024 12:13:57 +0200 Subject: [PATCH] updated style and example --- examples/glossary.typ | 0 examples/glossary.yml | 1 + examples/lipsum.typ | 81 +- examples/refs.yml | 6 + src/pages/abstract.typ | 4 +- src/pages/confidentiality-statement.typ | 7 +- src/pages/declaration-of-authorship.typ | 5 +- src/pages/glossar.typ | 7 - src/pages/prerelease-note.typ | 5 +- src/pages/titlepage.typ | 19 +- src/{pages => }/res/ABB.svg | 0 src/{pages => }/res/DHBW.svg | 0 src/res/github.tmTheme | 1742 +++++++++++++++++++++++ src/style.typ | 136 +- src/template.typ | 61 +- 15 files changed, 1955 insertions(+), 119 deletions(-) create mode 100644 examples/glossary.typ create mode 100644 examples/glossary.yml create mode 100644 examples/refs.yml delete mode 100644 src/pages/glossar.typ rename src/{pages => }/res/ABB.svg (100%) rename src/{pages => }/res/DHBW.svg (100%) create mode 100644 src/res/github.tmTheme diff --git a/examples/glossary.typ b/examples/glossary.typ new file mode 100644 index 0000000..e69de29 diff --git a/examples/glossary.yml b/examples/glossary.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/examples/glossary.yml @@ -0,0 +1 @@ + diff --git a/examples/lipsum.typ b/examples/lipsum.typ index 9b9a1d3..2c05960 100644 --- a/examples/lipsum.typ +++ b/examples/lipsum.typ @@ -1,17 +1,59 @@ #import "../src/template.typ": dhbw-template -#show: dhbw-template +#let config = ( + author: ( + name: "Sven Vogel", + semester: 4, + program: "Informationstechnik", + course: "TINF22IT2", + faculty: "Technik", + university: "DHBW Mannheim", + company: "ABB AG", + supervisor: "Florian Miedniak", + matriculation-number: 1191225), + thesis: ( + title: "Konfiguration & Integration von PROFINET", + subtitle: "für die AC500 SPS", + submission-date: "20. März 2024", + timeframe: "1. Januar 2023 - 20. März 2024", + kind: "T2000", + summary: "", + abstract: "", + keywods: ( "IT", "PROFINET" ), + bibliography: bibliography("refs.yml"), + glossary: ( + ( + key: "oidc", + short: "OIDC", + long: "OpenID Connect", + desc: [OpenID is an open standard and decentralized authentication protocol promoted by the non-profit #link("https://en.wikipedia.org/wiki/OpenID#OpenID_Foundation")[OpenID Foundation].], + group: "Akronyme", + ), + ( + key: "potato", + short: "potato", + // "plural" will be used when "short" should be pluralized + plural: "potatoes", + desc: [#lorem(10)], + group: "Begriffe" + ), + ) +)) + +#show: doc => dhbw-template(config: config, doc: doc) = Lorem Ipsum #lorem(25) +@oidc #lorem(100) == Lorem Ipsum 2 #lorem(200) +@texbook = Lorem Ipsum 3 @@ -31,9 +73,42 @@ $ "Hello", "World"), caption: [ Some table ]) +#pagebreak() + #figure( ```rust - fn main() -> { +use std::env; +use std::fs::OpenOptions; +use std::io::Write; - } +fn main() { + // Get the file path from the environment variable + let file_path = match env::var("OUTPUT_FILE") { + Ok(path) => path, + Err(_) => { + eprintln!("Error: OUTPUT_FILE environment variable is not set"); + return; + } + }; + + // Open the file in append mode, create it if it doesn't exist + let mut file = match OpenOptions::new() + .append(true) + .create(true) + .open(&file_path) + { + Ok(file) => file, + Err(e) => { + eprintln!("Error opening file {}: {}", file_path, e); + return; + } + }; + + // Write "Hello, World" to the file + if let Err(e) = writeln!(file, "Hello, World") { + eprintln!("Error writing to file: {}", e); + } else { + println!("Successfully appended 'Hello, World' to {}", file_path); + } +} ```, caption: [Some code]) \ No newline at end of file diff --git a/examples/refs.yml b/examples/refs.yml new file mode 100644 index 0000000..11b1e86 --- /dev/null +++ b/examples/refs.yml @@ -0,0 +1,6 @@ +texbook: + type: book + title: The {TeX} Book + author: Knuth, Donald E. + date: 1986 + publisher: Addison-Wesley Professional diff --git a/src/pages/abstract.typ b/src/pages/abstract.typ index 5efd003..68c991a 100644 --- a/src/pages/abstract.typ +++ b/src/pages/abstract.typ @@ -1,6 +1,8 @@ -#let new_abstract(thesis) = context [ +#let new_abstract(config) = context [ + #let thesis = config.thesis + #pagebreak(weak: true) #align(center + horizon)[ #if text.lang == "de" [ diff --git a/src/pages/confidentiality-statement.typ b/src/pages/confidentiality-statement.typ index d52f32e..d4c2f11 100644 --- a/src/pages/confidentiality-statement.typ +++ b/src/pages/confidentiality-statement.typ @@ -1,7 +1,8 @@ -#let new_confidentiality_statement_page( - thesis, - author) = context [ +#let new_confidentiality_statement_page(config) = context [ + + #let thesis = config.thesis + #let author = config.author #v(2em) #if text.lang == "de" [ diff --git a/src/pages/declaration-of-authorship.typ b/src/pages/declaration-of-authorship.typ index c9ba477..8b73a45 100644 --- a/src/pages/declaration-of-authorship.typ +++ b/src/pages/declaration-of-authorship.typ @@ -1,5 +1,8 @@ -#let new_declaration_of_authorship(thesis, author) = context [ +#let new_declaration_of_authorship(config) = context [ + + #let thesis = config.thesis + #let author = config.author #v(2em) #if text.lang == "de" [ diff --git a/src/pages/glossar.typ b/src/pages/glossar.typ deleted file mode 100644 index a5765c7..0000000 --- a/src/pages/glossar.typ +++ /dev/null @@ -1,7 +0,0 @@ - -#let new-glossar(glossary) = { - import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl - show: make-glossary - - print-glossary(glossary) -} diff --git a/src/pages/prerelease-note.typ b/src/pages/prerelease-note.typ index 688a1b7..6a3dfee 100644 --- a/src/pages/prerelease-note.typ +++ b/src/pages/prerelease-note.typ @@ -1,5 +1,8 @@ -#let new_prerelease_note(thesis, author) = context [ +#let new_prerelease_note(config) = context [ + + #let thesis = config.thesis + #let author = config.author #v(2em) #if text.lang == "de" [ diff --git a/src/pages/titlepage.typ b/src/pages/titlepage.typ index 8bb61eb..2561a31 100644 --- a/src/pages/titlepage.typ +++ b/src/pages/titlepage.typ @@ -1,22 +1,11 @@ -#let new_title_page( - thesis, - author) = context [ +#let new_title_page(config) = context [ - #let LogoHeight = 1.5cm + #let thesis = config.thesis + #let author = config.author #set align(center) - // logo of ABB and DHBW - #grid( - // set width of columns - // we need two, so make both half the page width - columns: (50%, 50%), - // left align logo of ABB - align(left, image("res/ABB.svg", height: LogoHeight)), - // right align logo of DHBW - align(right, image("res/DHBW.svg", height: LogoHeight))) - // title #v(2cm) #text(size: 2em, weight: "semibold", thesis.title) @@ -130,5 +119,5 @@ ) ) - #counter(page).update(1) + #counter(page).update(0) ] diff --git a/src/pages/res/ABB.svg b/src/res/ABB.svg similarity index 100% rename from src/pages/res/ABB.svg rename to src/res/ABB.svg diff --git a/src/pages/res/DHBW.svg b/src/res/DHBW.svg similarity index 100% rename from src/pages/res/DHBW.svg rename to src/res/DHBW.svg diff --git a/src/res/github.tmTheme b/src/res/github.tmTheme new file mode 100644 index 0000000..6aa306d --- /dev/null +++ b/src/res/github.tmTheme @@ -0,0 +1,1742 @@ + + + + + + name + GitHub + settings + + + + + settings + + + background + #ffffff + foreground + #323232 + invisibles + #000000 + caret + #323232 + + + gutter + #ffffff + gutterForeground + #b3b3b3 + + + guide + #e8e8e8 + stackGuide + #e8e8e8 + activeGuide + #b3b3b3 + + + lineHighlight + #f5f5f5 + findHighlight + #f8eec7 + findHighlightForeground + #323232 + selection + #f8eec7 + selectionBorder + #ffffff + + + bracketsForeground + #63a35c + bracketsOptions + underline + bracketContentsForeground + #63a35c + bracketContentsOptions + underline + + + tagsForeground + #63a35c + tagsOptions + underline + + + + + + name + Comment + scope + comment + settings + + foreground + #969896 + fontStyle + italic + + + + + + name + String + scope + string + settings + + foreground + #183691 + + + + + + name + RegExp Operator + scope + regexp-operator + settings + + foreground + #a71d5d + + + + + + name + RegExp Character Class + scope + string.regexp.characterclass punctuation.definition.string.begin, string.regexp.characterclass punctuation.definition.string.end + settings + + foreground + #a71d5d + + + + + + name + Number + scope + constant.numeric + settings + + foreground + #0086b3 + + + + + + name + Built-in Constant + scope + constant.language + settings + + foreground + #0086b3 + + + + + + name + User-defined Constant + scope + constant.character, constant.other, variable.other.constant + settings + + foreground + #0086b3 + + + + + + name + Variable + scope + variable + settings + + foreground + #323232 + + + + + + name + Keyword + scope + keyword + settings + + foreground + #a71d5d + fontStyle + bold + + + + + + name + Bitwise + scope + bitwise-operator + settings + + foreground + #a71d5d + fontStyle + bold + + + + + + name + Operator Accessor + scope + punctuation.accessor + settings + + foreground + #a71d5d + fontStyle + bold + + + + + + name + Storage + scope + storage + settings + + foreground + #a71d5d + fontStyle + bold + + + + + + name + Storage Type + scope + storage.type + settings + + foreground + #a71d5d + fontStyle + bold + + + + + + name + Class Name + scope + entity.name.class + settings + + foreground + #0086b3 + + + + + + name + Inherited Class + scope + entity.other.inherited-class + settings + + foreground + #0086b3 + + + + + + name + Function Name + scope + entity.name.function + settings + + foreground + #795da3 + fontStyle + bold + + + + + + name + Function Argument + scope + variable.parameter + settings + + foreground + #323232 + + + + + + name + Tag Name + scope + entity.name.tag + settings + + foreground + #63a35c + + + + + + name + Tag Attribute + scope + entity.other.attribute-name + settings + + foreground + #795da3 + + + + + + name + Library Function + scope + support.function + settings + + foreground + #62a35c + + + + + + name + Library Constant + scope + support.constant + settings + + foreground + #0086b3 + + + + + + name + Library Class + scope + support.type, support.class + settings + + foreground + #0086b3 + + + + + + name + Library Variable + scope + support.other.variable + settings + + foreground + #323232 + + + + + + name + Invalid + scope + invalid, invalid.illegal, invalid.deprecated + settings + + background + #f5f5f5 + foreground + #b52a1d + fontStyle + bold + + + + + + + + + name + Find-in-files Filename + scope + entity.name.filename.find-in-files + settings + + foreground + #323232 + fontStyle + bold + + + + name + Find-in-files Line Numbers + scope + constant.numeric.line-number.find-in-files, constant.numeric.line-number.match.find-in-files + settings + + foreground + #b3b3b3 + + + + + + + + + + name + Diff Header + scope + meta.diff.header + settings + + foreground + #969896 + background + #ffffff + fontStyle + italic + + + + + name + Diff Header + scope + meta.diff.header punctuation.definition.from-file.diff + settings + + foreground + #bd2c00 + background + #ffecec + fontStyle + italic bold + + + + + name + Diff Header + scope + meta.diff.header punctuation.definition.to-file.diff + settings + + foreground + #55a532 + background + #eaffea + fontStyle + italic bold + + + + + name + Diff Range + scope + meta.diff.range + settings + + foreground + #969896 + fontStyle + italic bold + + + + + name + Diff Deleted + scope + markup.deleted + settings + + background + #ffecec + + + + + name + Diff Deleted Punctuation + scope + markup.deleted punctuation.definition.inserted + settings + + foreground + #bd2c00 + fontStyle + bold + + + + + name + Diff Inserted + scope + markup.inserted + settings + + background + #eaffea + + + + + name + Diff Inserted Punctuation + scope + markup.inserted punctuation.definition.inserted + settings + + foreground + #55a532 + fontStyle + bold + + + + + + + + + + name + GitGutter Deleted + scope + markup.deleted.git_gutter + settings + + foreground + #bd2c00 + + + + + name + GitGutter Inserted + scope + markup.inserted.git_gutter + settings + + foreground + #55a532 + + + + + name + GitGutter Modified + scope + markup.changed.git_gutter + settings + + foreground + #0086B3 + + + + + name + GitGutter Ignored + scope + markup.ignored.git_gutter + settings + + foreground + #b3b3b3 + + + + + name + GitGutter Untracked + scope + markup.untracked.git_gutter + settings + + foreground + #b3b3b3 + + + + + + + + + + name + Entity Punctuation + scope + source.css punctuation.definition.entity + settings + + foreground + #323232 + + + + + name + Pseudo Selector + scope + source.css entity.other.attribute-name.pseudo-class, source.css entity.other.attribute-name.pseudo-element + settings + + foreground + #a71d5d + + + + + name + Property Value + scope + source.css meta.value, source.css support.constant, source.css support.function + settings + + foreground + #323232 + + + + + name + Color + scope + source.css constant.other.color + settings + + foreground + #ed6a43 + + + + + + + + + + name + Entity Punctuation + scope + source.scss punctuation.definition.entity + settings + + foreground + #323232 + + + + + name + Pseudo Selector + scope + source.scss entity.other.attribute-name.pseudo-class, source.scss entity.other.attribute-name.pseudo-element + settings + + foreground + #a71d5d + + + + + name + Color + scope + source.scss support.constant.property-value, source.scss support.function + settings + + foreground + #323232 + + + + + name + Variable + scope + source.scss variable + settings + + foreground + #a71d5d + + + + + + + + + + name + this + scope + variable.language.this.js + settings + + foreground + #ed6a43 + + + + + name + Function + scope + source.js entity.name.function + settings + + foreground + #323232 + fontStyle + regular + + + + + name + Function Definition + scope + source.js meta.function entity.name.function, source.js entity.name.function meta.function + settings + + foreground + #795da3 + fontStyle + bold + + + + + name + New Function + scope + entity.name.type.new.js + settings + + foreground + #795da3 + + + + + name + Function Prototype + scope + variable.language.prototype.js + settings + + foreground + #0086b3 + + + + + name + Support Function + scope + source.js support.function + settings + + foreground + #0086b3 + + + + + name + Function Prototype + scope + support.type.object.console.js + settings + + foreground + #795da3 + + + + + + + + + + name + JSON Property - 20 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 20 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 19 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 19 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 18 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 18 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 17 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 17 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 16 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 16 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 15 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 15 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 14 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 14 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 13 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 13 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 12 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 12 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 11 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 11 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 10 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 10 Deep + scope + meta meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 9 Deep + scope + meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 9 Deep + scope + meta meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 8 Deep + scope + meta meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 8 Deep + scope + meta meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 7 Deep + scope + meta meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 7 Deep + scope + meta meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 6 Deep + scope + meta meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 6 Deep + scope + meta meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 5 Deep + scope + meta meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 5 Deep + scope + meta meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 4 Deep + scope + meta meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 4 Deep + scope + meta meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 3 Deep + scope + meta meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 3 Deep + scope + meta meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 2 Deep + scope + meta meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 2 Deep + scope + meta meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property - 1 Deep + scope + meta meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value - 1 Deep + scope + meta meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + name + JSON Property + scope + meta.structure.dictionary.json string.quoted.double.json + settings + + foreground + #183691 + fontStyle + bold + + + + name + JSON Value + scope + meta.structure.dictionary.json meta.structure.dictionary.value.json string.quoted.double.json + settings + + foreground + #323232 + fontStyle + regular + + + + + + + + + + name + Keyword + scope + source.python keyword + settings + + fontStyle + bold + + + + + name + Storage + scope + source.python storage + settings + + fontStyle + bold + + + + + name + Storage Type + scope + source.python storage.type + settings + + fontStyle + bold + + + + + name + Function + scope + source.python entity.name.function + settings + + foreground + #323232 + fontStyle + bold + + + + + + + + + + name + Class + scope + source.php entity.name.type.class + settings + + foreground + #323232 + fontStyle + bold + + + + + + + + + + name + Language Variable + scope + variable.language.ruby + settings + + foreground + #ed6a43 + + + + + name + Module Name + scope + entity.name.type.module.ruby + settings + + foreground + #795da3 + fontStyle + bold + + + + + name + Class Name + scope + entity.name.type.class.ruby + settings + + foreground + #795da3 + fontStyle + bold + + + + + name + Inherited Class + scope + entity.other.inherited-class.ruby + settings + + foreground + #795da3 + fontStyle + bold + + + + + + + + + + name + Punctuation + scope + text.html.markdown punctuation.definition + settings + + foreground + #a71d5d + + + + + name + Separator + scope + text.html.markdown meta.separator + settings + + foreground + #b3b3b3 + + + + + name + Heading + scope + text.html.markdown markup.heading + settings + + fontStyle + bold + + + + + name + Code Block + scope + text.html.markdown markup.raw.block + settings + + foreground + #323232 + + + + + name + Inline Code + scope + text.html.markdown markup.raw.inline + settings + + foreground + #323232 + + + + + name + Link and Image + scope + text.html.markdown meta.link, text.html.markdown meta.image + settings + + foreground + #4183c4 + + + + name + Link URL + scope + text.html.markdown markup.underline.link, text.html.markdown constant.other.reference + settings + + fontStyle + italic + + + + + name + List + scope + text.html.markdown markup.list + settings + + foreground + #ed6a43 + + + + + name + Bold + scope + text.html.markdown markup.bold + settings + + fontStyle + bold + + + + + name + Italic + scope + text.html.markdown markup.italic + settings + + fontStyle + italic + + + + + name + Bold Italic + scope + text.html.markdown markup.bold markup.italic + settings + + fontStyle + bold italic + + + + + name + Italic Bold + scope + text.html.markdown markup.italic markup.bold + settings + + fontStyle + italic bold + + + + + \ No newline at end of file diff --git a/src/style.typ b/src/style.typ index a2d739a..59d7067 100644 --- a/src/style.typ +++ b/src/style.typ @@ -7,8 +7,14 @@ // Edited: 27.06.2024 // License: MIT +#let HeaderPaddingBottom = 1.5em +#let LogoHeight = 3em +#let HeaderUnderlinePaddingTop = 0pt + // global style of document -#let global_styled_doc(doc: content) = context [ +#let global_styled_doc(config: dictionary, body: content) = context [ + #let thesis = config.thesis + // set page geometry // paper format of A4 #set page( @@ -31,7 +37,15 @@ #show heading.where(level: 2): it => v(1em) + it + v(0.5em) #show heading.where(level: 3): it => v(0.5em) + it + v(0.25em) - #set raw(tab-size: 4) + #set raw(tab-size: 4, theme: "res/github.tmTheme") + #show raw.where(block: true): code => { + show raw.line: line => { + text(fill: gray)[#line.number] + h(1em) + line.body + } + code + } #set block(spacing: 2em) #set par( @@ -39,68 +53,88 @@ first-line-indent: 1em, leading: 1em) - #doc -] + #show link: set text(fill: red.darken(15%)) -#let HeaderPaddingBottom = 1.5em -#let LogoHeight = 3em -#let HeaderUnderlinePaddingTop = 0pt - -#let prelude_styled(body: content, thesis) = context [ + #set heading(numbering: none) #set page( header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom, - numbering: "I", - margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom), - header: [ - #grid( - columns: (1fr, auto), - align: (horizon, bottom), - context [ _ #thesis.title _ ], - image("pages/res/DHBW.svg", height: LogoHeight) - ) - #v(HeaderUnderlinePaddingTop - 1em) - #line(length: 100%) - ]) + footer-descent: 1em, + margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em), + numbering: (..nums) => { + let current-page = here().page() + if current-page == 1{ + [] + } else if query().first().location().page() <= current-page { + numbering("1 / 1", ..nums) + } else { + numbering("I", nums.pos().first()) + } + }, + header: context { + set align(left) + if here().page() == 1 { + // logo of ABB and DHBW + grid( + // set width of columns + // we need two, so make both half the page width + columns: (50%, 50%), + // left align logo of ABB + align(left, image("res/ABB.svg", height: LogoHeight)), + // right align logo of DHBW + align(right, image("res/DHBW.svg", height: LogoHeight))) + + } else if query().first().location().page() <= here().page() { + let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here())) + + let header-title = thesis.title + + if headers-before.len() > 0 { + header-title = headers-before.last().body + } else { + let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here())) + + if headers-after.len() > 0 { + header-title = headers-after.first().body + } + } + + grid( + columns: (1fr, auto), + align: (horizon, bottom), + context [ _ #header-title _ ], + image("res/DHBW.svg", height: LogoHeight)) + + v(HeaderUnderlinePaddingTop - 1em) + line(length: 100%) + } else { + grid( + columns: (1fr, auto), + align: (horizon, bottom), + context [ _ #config.thesis.title _ ], + image("res/DHBW.svg", height: LogoHeight) + ) + v(HeaderUnderlinePaddingTop - 1em) + line(length: 100%) + } + }) #body ] -#let content_styled(body: content, thesis) = [ +#let prelude_styled(config: dictionary, body: content) = context [ + + #body +] + +#let content_styled(config: dictionary, body: content) = [ // setup equate for sub equation labeling #import "@preview/equate:0.2.0": equate #show: equate.with(breakable: true, sub-numbering: true) #set math.equation(numbering: "(1.1)") #set heading(numbering: "1.") - #page( - header-ascent: HeaderUnderlinePaddingTop + HeaderPaddingBottom, - numbering: "1/1", - footer-descent: 1em, - margin: (top: 2.5cm + LogoHeight + HeaderUnderlinePaddingTop + HeaderPaddingBottom, bottom: 2.5cm + 1em), - header: context [ - #let headers-before = query(selector(heading.where(numbering: "1.", level: 1)).before(here())) - #let header-title = thesis.title + #let thesis = config.thesis - #if headers-before.len() > 0 { - header-title = headers-before.last().body - } else { - let headers-after = query(selector(heading.where(numbering: "1.", level: 1)).after(here())) - - if headers-after.len() > 0 { - header-title = headers-after.first().body - } - } - - #grid( - columns: (1fr, auto), - align: (horizon, bottom), - context [ _ #header-title _ ], - image("pages/res/DHBW.svg", height: LogoHeight) - ) - #v(HeaderUnderlinePaddingTop - 1em) - #line(length: 100%) - ])[ - #body - ] + #body ] diff --git a/src/template.typ b/src/template.typ index 463cd60..82a916f 100644 --- a/src/template.typ +++ b/src/template.typ @@ -8,12 +8,12 @@ // License: MIT // start of template pages and styles -#let dhbw-template(doc) = [ +#let dhbw-template(config: dictionary, doc: content) = [ #import "style.typ": global_styled_doc, prelude_styled, content_styled // apply global style to every element in the argument content - #global_styled_doc(doc: [ + #global_styled_doc(config: config, body: [ #import "pages/titlepage.typ": new_title_page #import "pages/declaration-of-authorship.typ": new_declaration_of_authorship @@ -21,60 +21,47 @@ #import "pages/prerelease-note.typ": new_prerelease_note #import "pages/outline.typ": new_outline #import "pages/abstract.typ": new_abstract - #import "pages/glossar.typ": new-glossar #set text(lang: "de", region: "de") - #let author = ( - name: "Sven Vogel", - semester: 4, - program: "Informationstechnik", - course: "TINF22IT2", - faculty: "Technik", - university: "DHBW Mannheim", - company: "ABB AG", - supervisor: "Florian Miedniak", - matriculation-number: 1191225 - ) - - #let thesis = ( - title: "Konfiguration & Integration von PROFINET", - subtitle: "für die AC500 SPS", - submission-date: "20. März 2024", - timeframe: "1. Januar 2023 - 20. März 2024", - kind: "T2000", - summary: "", - abstract: "", - ) - - #let glossary = () - // preppend title page - #new_title_page(thesis, author) + #new_title_page(config) - #prelude_styled(thesis, body: [ + #prelude_styled(config: config, body: [ #pagebreak(weak: true) - #new_declaration_of_authorship(thesis, author) + #new_declaration_of_authorship(config) #pagebreak(weak: true) - #new_confidentiality_statement_page(thesis, author) + #new_confidentiality_statement_page(config) #pagebreak(weak: true) - #new_prerelease_note(thesis, author) + #new_prerelease_note(config) #pagebreak(weak: true) #new_outline() #pagebreak(weak: true) - #new_abstract(thesis) - - #pagebreak(weak: true) - #new-glossar(glossary) + #new_abstract(config) ]) - #content_styled(thesis, body: [ + #import "@preview/glossarium:0.4.1": make-glossary, print-glossary, gls, glspl + #show: make-glossary + + #pagebreak(weak: true) + #print-glossary(config.thesis.glossary) + #pagebreak(weak: true) + + #metadata("prelude terminate") + + #content_styled(config: config, body: [ // code of document follows here #doc + + #if config.thesis.bibliography != none { + pagebreak(weak: true) + set bibliography(style: "ieee") + config.thesis.bibliography + } ]) ]) ] \ No newline at end of file