Compare commits

...

27 Commits
v0.4.1 ... main

Author SHA1 Message Date
Sven Vogel 56f330693d Merge pull request 'feat/fira-fonts' (#61) from feat/fira-fonts into main
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m59s Details
Reviewed-on: #61
2024-09-27 15:49:43 +00:00
Sven Vogel 1a263f66ac chore: added font directory to ci
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 2m0s Details
2024-09-27 17:47:08 +02:00
Sven Vogel 75d50f3207 feat: added fira fonts
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 2m16s Details
2024-09-27 17:43:58 +02:00
Sven Vogel 6a4d78ba8b Merge pull request 'removed: install of package sudo in github action' (#59) from fix/ci-failing-on-github into main
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m43s Details
Reviewed-on: #59
2024-08-27 19:38:31 +00:00
Sven Vogel 4da04a195c removed: install of package sudo in github action
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m48s Details
2024-08-27 21:35:27 +02:00
Sven Vogel 572d505701 added nix pipeline to github
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m46s Details
2024-08-27 21:20:17 +02:00
Sven Vogel 255cdfeae1 Merge branch 'feature/typstyle'
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 2m48s Details
2024-08-27 21:16:23 +02:00
Sven Vogel 1548bf8c5b changed release pipeline to make use of nix
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m43s Details
2024-08-27 20:58:01 +02:00
Sven Vogel dabe0a2ef5 fixed failing tests
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m41s Details
2024-08-27 20:54:33 +02:00
Sven Vogel 6c8f94e4b7 fixed test local import 2024-08-27 20:36:21 +02:00
Sven Vogel ae729230bb made generate-theme executable 2024-08-27 20:28:50 +02:00
Sven Vogel 9c3ae5c9e7 switched to unstable nix channel 2024-08-27 20:27:41 +02:00
Sven Vogel 093ed09293 fixed format of template for (#13)
Gitea Action for checking typst compilation / run-ci-linux (push) Failing after 1m47s Details
2024-08-27 19:52:07 +02:00
Sven Vogel 946a16fce6 add typstyle check to CI (#13) 2024-08-27 19:50:31 +02:00
Sven Vogel 7ad138dc00 fix CI failing (#18) 2024-08-27 19:50:09 +02:00
Sven Vogel 201e991ac4 added sudo to action runner
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 1m52s Details
2024-08-27 19:36:24 +02:00
Sven Vogel 2daf7bb6c9 updated nix action to v27
Gitea Action for checking typst compilation / run-ci-linux (push) Failing after 11s Details
2024-08-27 19:34:46 +02:00
Sven Vogel 37e60a315e make long titles break on title page but not on content (#54)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 28s Details
2024-08-27 14:07:16 +02:00
Sven Vogel 9f9225910f fix lock notice spelling mistake (#53)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 31s Details
2024-08-27 13:52:50 +02:00
Sven Vogel e1b8eceea6 fix heading supplement not translated (#52)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 27s Details
2024-08-26 16:10:52 +02:00
Sven Vogel 0438d73ab5 only show used acronyms (#51)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 28s Details
2024-08-26 15:26:28 +02:00
Sven Vogel 410c753339 fix wrong glossary and acronym group language (#50)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 27s Details
2024-08-26 15:08:03 +02:00
Sven Vogel dd6a9ccce0 decrease padding between acronyms and glossary entries (#49)
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 27s Details
2024-08-26 14:47:37 +02:00
Sven Vogel 9ba1fea4d7 changed: ci action syntax
Gitea Action for checking typst compilation / run-ci-linux (push) Failing after 10s Details
2024-07-08 22:58:13 +02:00
Sven Vogel 4a1fcd0a35 changed: CI runs on nix shell
Gitea Action for checking typst compilation / run-ci-linux (push) Failing after 0s Details
2024-07-08 22:56:56 +02:00
Sven Vogel d648d5121c changed: formatted source files 2024-07-08 21:57:23 +02:00
Sven Vogel 4fd088ce3f added: format script 2024-07-08 21:50:13 +02:00
60 changed files with 626 additions and 207 deletions

View File

@ -5,15 +5,16 @@ on: [push]
jobs: jobs:
run-ci-linux: run-ci-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TYPST_INSTALL: /usr/local
TYPST_VERSION: 0.11.1
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install Typst CLI - name: Install dependencies for Nix setup action
run: curl -fsSL https://typst.community/typst-install/install.sh | sh -s "$TYPST_VERSION" run: |
- name: Set up Python 3 apt update -y
run: apt update -y && apt install python3-pip -y apt install sudo -y
- name: Setup Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run CI - name: Run CI
run: bash -c ./run-ci.sh run: nix-shell --run ./run-ci.sh

View File

@ -3,21 +3,24 @@ name: release
on: on:
push: push:
tags: tags:
- '*' - 'v*.*.*'
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - name: Check out repository code
uses: actions/checkout@v3
- name: Install dependencies for Nix setup action
run: |
apt update -y
apt install sudo -y
- name: Setup Nix
uses: cachix/install-nix-action@v27
with: with:
fetch-depth: 0 nix_path: nixpkgs=channel:nixos-unstable
- name: Install Typst CLI
run: curl -fsSL https://typst.community/typst-install/install.sh | sh -s "$TYPST_VERSION"
- name: Set up Python 3
run: apt update -y && apt install python3-pip -y
- name: Run CI - name: Run CI
run: bash -c ./run-ci.sh run: nix-shell --run ./run-ci.sh
- name: Setup go - name: Setup go
uses: https://github.com/actions/setup-go@v4 uses: https://github.com/actions/setup-go@v4
with: with:

View File

@ -5,16 +5,12 @@ on: [push]
jobs: jobs:
run-ci-linux: run-ci-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
TYPST_INSTALL: $HOME/.typst
TYPST_VERSION: 0.11.1
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install Typst CLI - name: Setup Nix
run: curl -fsSL https://typst.community/typst-install/install.sh | sh -s "$TYPST_VERSION" uses: cachix/install-nix-action@v27
- uses: actions/setup-python@v5
with: with:
python-version: '3.11' nix_path: nixpkgs=channel:nixos-unstable
- name: Run CI - name: Run CI
run: export PATH="$TYPST_INSTALL/bin:$PATH" && bash -c ./run-ci.sh run: nix-shell --run ./run-ci.sh

View File

@ -1,32 +1,30 @@
name: release
on: on:
push: push:
# Sequence of patterns matched against refs/tags
tags: tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - 'v*.*.*'
name: Create Release
jobs: jobs:
build: release:
name: Create Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install Typst CLI - name: Setup Nix
run: curl -fsSL https://typst.community/typst-install/install.sh | sh -s "$TYPST_VERSION" uses: cachix/install-nix-action@v27
- uses: actions/setup-python@v5
with: with:
python-version: '3.11' nix_path: nixpkgs=channel:nixos-unstable
- name: Run CI - name: Run CI
run: export PATH="$TYPST_INSTALL/bin:$PATH" && bash -c ./run-ci.sh run: nix-shell --run ./run-ci.sh
- name: Create Release - name: Setup go
id: create_release uses: https://github.com/actions/setup-go@v4
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with: with:
tag_name: ${{ github.ref }} go-version: '>=1.20.1'
release_name: Release ${{ github.ref }} - name: Create release
draft: false id: create-release
prerelease: false uses: https://gitea.com/actions/release-action@main
with:
files: |-
example.pdf
api_key: '${{secrets.RELEASE_TOKEN}}'

View File

@ -131,9 +131,10 @@ Complies with ABB branding guidelines such as:
## Fonts ## Fonts
Both fonts used in the document are licensed under the [Open Font License](https://openfontlicense.org/) and can be used for non-commercial as well as commercial purposes. They can be downloaded from google fonts: Both fonts used in the document are licensed under the [Open Font License](https://openfontlicense.org/) and can be used for non-commercial as well as commercial purposes:
- [Montserrat](https://fonts.google.com/specimen/Montserrat) - [Fira Sans](https://github.com/bBoxType/FiraSans)
- [Open Sans](https://fonts.google.com/specimen/Open+Sans) - [Fira Math](https://github.com/firamath/firamath)
- [Fira Code NF](https://www.nerdfonts.com/font-downloads)
Consider giving the creators of the font credit for their amazing work! Consider giving the creators of the font credit for their amazing work!

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

93
fonts/Fira Code/LICENSE Normal file
View File

@ -0,0 +1,93 @@
Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

48
fonts/Fira Code/README.md Normal file
View File

@ -0,0 +1,48 @@
# Nerd Fonts
This is an archived font from the Nerd Fonts release v3.2.1.
For more information see:
* https://github.com/ryanoasis/nerd-fonts/
* https://github.com/ryanoasis/nerd-fonts/releases/latest/
# Fira Code
**Fira Code** is a free monospaced font with programming ligatures.
For more information have a look at the upstream website: https://github.com/tonsky/FiraCode
Version: 6.2
## Which font?
### TL;DR
* Pick your font family:
* If you are limited to monospaced fonts (because of your terminal, etc) then pick a font with `Nerd Font Mono` (or `NFM`).
* If you want to have bigger icons (usually around 1.5 normal letters wide) pick a font without `Mono` i.e. `Nerd Font` (or `NF`). Most terminals support this, but ymmv.
* If you work in a proportional context (GUI elements or edit a presentation etc) pick a font with `Nerd Font Propo` (or `NFP`).
### Ligatures
Ligatures are generally preserved in the patched fonts.
Nerd Fonts `v2.0.0` had no ligatures in the `Nerd Font Mono` fonts, this has been dropped with `v2.1.0`.
If you have a ligature-aware terminal and don't want ligatures you can (usually) disable them in the terminal settings.
### Explanation
Once you narrow down your font choice of family (`Droid Sans`, `Inconsolata`, etc) and style (`bold`, `italic`, etc) you have 2 main choices:
#### `Option 1: Download already patched font`
* For a stable version download a font package from the [release page](https://github.com/ryanoasis/nerd-fonts/releases)
* Or download the development version from the folders here
#### `Option 2: Patch your own font`
* Patch your own variations with the various options provided by the font patcher (i.e. not include all symbols for smaller font size)
For more information see: [The FAQ](https://github.com/ryanoasis/nerd-fonts/wiki/FAQ-and-Troubleshooting#which-font)
[SIL-RFN]:http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web_fonts_and_RFNs#14cbfd4a

Binary file not shown.

92
fonts/Fira Math/LICENSE Normal file
View File

@ -0,0 +1,92 @@
Copyright (C) 2018--2023 by Xiangdong Zeng <xdzeng96@gmail.com>
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
generate-theme.sh Normal file → Executable file
View File

View File

@ -25,19 +25,29 @@ function enter-section() {
printf "\\n" printf "\\n"
eval "$2" eval "$2"
if [ $? -neq $3 ]; then exit_status=$?
abort "command: $2 failed in section: $1"
if [ "$3" == "should fail" ]; then
log "INFO" "expected to fail..."
if [ $exit_status -eq 0 ]; then
abort "command: $2 failed in section: $1 with: $exit_status"
fi
else
log "INFO" "expected to pass..."
if [ ! $exit_status -eq 0 ]; then
abort "command: $2 failed in section: $1 with: $exit_status"
fi
fi fi
printf "\\n" printf "\\n"
log "INFO" "section $1 completed successfully" log "INFO" "section $1 completed successfully"
} }
enter-section "BUILD: ABB code theme" "./generate-theme.sh" 0 enter-section "Typstyle checking" "./run-fmt.sh --check src/lib.typ" 0
enter-section "Compiling template..." "typst compile template/main.typ --root . example.pdf" 0 enter-section "Compiling template..." "typst compile template/main.typ --root . --font-path fonts example.pdf"
enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root ." 0 enter-section "TEST: local template import" "typst compile tests/local-import/main.typ --root . --font-path fonts"
enter-section "TEST: invalid config case 1" "typst compile tests/invalid-config/test-case-1.typ --root ." 1 enter-section "TEST: invalid config case 1" "typst compile tests/invalid-config/test-case-1.typ --root . --font-path fonts" "should fail"
enter-section "TEST: invalid config case 2" "compile tests/invalid-config/test-case-2.typ" 0 enter-section "TEST: invalid config case 2" "typst compile tests/invalid-config/test-case-2.typ --root . --font-path fonts"
enter-section "TEST: invalid config case 3" "typst compile tests/invalid-config/test-case-3.typ --root ." 1 enter-section "TEST: invalid config case 3" "typst compile tests/invalid-config/test-case-3.typ --root . --font-path fonts" "should fail"
log "INFO" "CI completed successfully" log "INFO" "CI completed successfully"

42
run-fmt.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
function format() {
# format file
# typstyle --format $1
if [ -z "$1" ]; then
return
fi
local wd=$(dirname $(realpath "$1"))
echo "processing file $1..."
typstyle "$2" "$1" > /dev/null
if [ $? -eq 1 ]; then
echo "failed format validation: $1"
exit 1
fi
local imports=$(rg "#import \"([a-z0-9/\-]+\.typ)\"" -Nor '$1' "$1")
# format all included files
while IFS= read -r line; do
if [ -z "$line" ]; then
continue
fi
format "$wd/$line" "$2"
done <<< "$imports"
}
case $1 in
"--format")
format "$2" "--inplace"
;;
"--check")
format "$2" "--check"
;;
*)
echo "unknown option: $1"
exit 1
;;
esac

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-unstable";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
python312
python312Packages.pyyaml
typst
typstyle
];
}

View File

@ -59,9 +59,9 @@
bottom: 2.5cm)), bottom: 2.5cm)),
text: ( text: (
size: 12pt, size: 12pt,
font: "Open Sans"), font: "Fira Sans"),
heading: ( heading: (
font: "Montserrat"), font: "Fira Sans"),
code: ( code: (
theme: "res/abb.tmTheme", theme: "res/abb.tmTheme",
font: "FiraCode Nerd Font", font: "FiraCode Nerd Font",

View File

@ -30,7 +30,10 @@ SOFTWARE.*/
#let __query_labels_with_key(loc, key, before: false) = { #let __query_labels_with_key(loc, key, before: false) = {
if before { if before {
query( query(
selector(label(__glossary_label_prefix + key)).before(loc, inclusive: false), selector(label(__glossary_label_prefix + key)).before(
loc,
inclusive: false,
),
loc, loc,
) )
} else { } else {
@ -56,13 +59,18 @@ SOFTWARE.*/
let entlong = entry.at("long", default: "") let entlong = entry.at("long", default: "")
let textLink = if display != none { let textLink = if display != none {
[#display] [#display]
} else if (is_first or long == true) and entlong != [] and entlong != "" and long != false { } else if (
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
[#entlong (#entry.short#suffix)] [#entlong (#entry.short#suffix)]
} else { } else {
[#entry.short#suffix] [#entry.short#suffix]
} }
[#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)] [#link(
label(entry.key),
textLink,
)#label(__glossary_label_prefix + entry.key)]
} else { } else {
panic(__not-found-panic-error-msg(key)) panic(__not-found-panic-error-msg(key))
} }
@ -100,13 +108,18 @@ SOFTWARE.*/
[#entplural] [#entplural]
} }
let textLink = if (is_first or long == true) and entlong != [] and entlong != "" and long != false { let textLink = if (
is_first or long == true
) and entlong != [] and entlong != "" and long != false {
[#entlong (#short)] [#entlong (#short)]
} else { } else {
[#short] [#short]
} }
[#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)] [#link(
label(entry.key),
textLink,
)#label(__glossary_label_prefix + entry.key)]
} else { } else {
panic(__not-found-panic-error-msg(key)) panic(__not-found-panic-error-msg(key))
} }
@ -116,7 +129,9 @@ SOFTWARE.*/
// show rule to make the references for glossarium // show rule to make the references for glossarium
#let make-glossary(body) = { #let make-glossary(body) = {
show ref: r => { show ref: r => {
if r.element != none and r.element.func() == figure and r.element.kind == __glossarium_figure { if r.element != none and r.element.func() == figure and r
.element
.kind == __glossarium_figure {
// call to the general citing function // call to the general citing function
gls(str(r.target), suffix: r.citation.supplement) gls(str(r.target), suffix: r.citation.supplement)
} else { } else {
@ -170,7 +185,13 @@ SOFTWARE.*/
numbering: none, numbering: none,
caption: { caption: {
context { context {
let term_references = __query_labels_with_key(here(), entry.key) let key = if entry.key.ends-with("__glossary_entry") {
entry.key.replace("__glossary_entry", "")
} else {
entry.key
}
let term_references = __query_labels_with_key(here(), key)
if term_references.len() != 0 or show-all [ if term_references.len() != 0 or show-all [
#let desc = entry.at("desc", default: "") #let desc = entry.at("desc", default: "")
#let long = entry.at("long", default: "") #let long = entry.at("long", default: "")
@ -178,6 +199,7 @@ SOFTWARE.*/
#let hasDesc = desc != "" and desc != [] #let hasDesc = desc != "" and desc != []
#block( #block(
below: 1.5em,
par(hanging-indent: 1em)[ par(hanging-indent: 1em)[
#text(weight: "bold", entry.short) #text(weight: "bold", entry.short)
#if hasLong and hasDesc [ #if hasLong and hasDesc [
@ -193,7 +215,9 @@ SOFTWARE.*/
.sorted(key: x => x.page()) .sorted(key: x => x.page())
.fold( .fold(
(values: (), pages: ()), (values: (), pages: ()),
((values, pages), x) => if pages.contains(x.page()) { ((values, pages), x) => if pages.contains(
x.page(),
) {
(values: values, pages: pages) (values: values, pages: pages)
} else { } else {
values.push(x) values.push(x)
@ -207,7 +231,10 @@ SOFTWARE.*/
if page-numbering == none { if page-numbering == none {
page-numbering = "1" page-numbering = "1"
} }
link(x)[#numbering(page-numbering, ..counter(page).at(x))] link(x)[#numbering(
page-numbering,
..counter(page).at(x),
)]
} }
) )
.join(", ") .join(", ")

View File

@ -7,7 +7,7 @@
// Edited: 08.07.2024 // Edited: 08.07.2024
// License: MIT // License: MIT
#let glossary(entries) = { #let glossary(entries, config) = {
assert( assert(
type(entries) == dictionary, type(entries) == dictionary,
@ -54,13 +54,13 @@
message: "The optional group of glossary entry `" + k + "` is not a string", message: "The optional group of glossary entry `" + k + "` is not a string",
) )
} else { } else {
let acronym_group = if (context text.lang) == "de" { let acronym_group = if config.lang == "de" {
"Akronyme" "Abkürzungsverzeichnis"
} else { } else {
"Acronyms" "List of Acronyms"
} }
let glossary_group = if (context text.lang) == "de" { let glossary_group = if config.lang == "de" {
"Begriffe" "Begriffe"
} else { } else {
"Glossary" "Glossary"
@ -75,8 +75,14 @@
// create dedicated entries for // create dedicated entries for
// acronym and glossary // acronym and glossary
if "long" in v and "desc" in v { if "long" in v and "desc" in v {
processed_glossary.insert(k, (short: v.short, long: v.long, group: acronym_group)) processed_glossary.insert(
processed_glossary.insert(k + "__glossary_entry", (short: v.short, desc: v.desc, long: v.long, group: glossary_group)) k,
(short: v.short, long: v.long, group: acronym_group),
)
processed_glossary.insert(
k + "__glossary_entry",
(short: v.short, desc: v.desc, long: v.long, group: glossary_group),
)
} else { } else {
processed_glossary.insert(k, v) processed_glossary.insert(k, v)
processed_glossary.at(k).group = group processed_glossary.at(k).group = group

View File

@ -31,7 +31,13 @@
inset: (left: 2pt, right: 2pt), inset: (left: 2pt, right: 2pt),
outset: (top: 4pt, bottom: 4pt), outset: (top: 4pt, bottom: 4pt),
fill: ABB-GRAY-06, fill: ABB-GRAY-06,
[#box(fill: rgb(color), radius: 2pt, inset: 0pt, width: 0.75em, height: 0.75em) #text( [#box(
fill: rgb(color),
radius: 2pt,
inset: 0pt,
width: 0.75em,
height: 0.75em,
) #text(
font: default-config.style.code.font, font: default-config.style.code.font,
size: default-config.style.code.size, size: default-config.style.code.size,
content, content,
@ -40,13 +46,17 @@
} }
#let url(label, content) = { #let url(label, content) = {
link(label)[#underline(offset: 2pt, stroke: 0.5pt + blue, text(fill: blue)[ link(label)[#underline(
offset: 2pt,
stroke: 0.5pt + blue,
text(fill: blue)[
#content #content
#let domain = label.find(regex("\w+\.\w+(?:\.\w+)*")) #let domain = label.find(regex("\w+\.\w+(?:\.\w+)*"))
#if domain.len() > 0 [ #if domain.len() > 0 [
(#domain) (#domain)
] ]
])] ],
)]
} }
// start of template pages and styles // start of template pages and styles
@ -93,10 +103,10 @@
#if "glossary" in config.thesis and config.thesis.glossary != none { #if "glossary" in config.thesis and config.thesis.glossary != none {
print-glossary( print-glossary(
show-all: true, show-all: false,
disable-back-references: true, disable-back-references: true,
enable-group-pagebreak: true, enable-group-pagebreak: true,
glossary(config.thesis.glossary), glossary(config.thesis.glossary, config),
) )
pagebreak(weak: true) pagebreak(weak: true)

View File

@ -21,7 +21,7 @@
] ]
if text.lang == "de" [ if text.lang == "de" [
Der Inhalt der dieser Arbeit mit dem Thema Der Inhalt dieser Arbeit mit dem Thema
] else if text.lang == "en" [ ] else if text.lang == "en" [
The content of this work with the topic The content of this work with the topic
] ]

View File

@ -80,9 +80,15 @@
"Table of Contents" "Table of Contents"
} }
let header-supplement = if (text.lang == "de") {
"Kapitel"
} else {
"chapter"
}
pagebreak(weak: true) pagebreak(weak: true)
outline( outline(
target: heading.where(supplement: [chapter]), target: heading.where(supplement: [#header-supplement]),
title: title, title: title,
indent: auto, indent: auto,
) )

View File

@ -16,17 +16,20 @@
// title // title
#v(2cm) #v(2cm)
#text(size: 2em, weight: "semibold", thesis.title) #par(justify: false, leading: 1.5em)[
#text(size: 2em, weight: "bold", hyphenate: false, thesis.title)
#linebreak()
// subtitle // subtitle
#text(size: 1.5em, thesis.subtitle) #text(size: 2em, weight: "light", thesis.subtitle)
]
#set align(center + horizon)
// type of paper // type of paper
#v(1cm) #text(size: 1.5em, weight: "medium", thesis.kind)
#text(size: 1.5em, weight: "bold", thesis.kind)
// faculty // faculty
#pad(top: 0.5cm)[ #pad()[
#if text.lang == "de" [ #if text.lang == "de" [
Praxisphase des #author.semester Semesters an der Fakultät für #author.faculty Praxisphase des #author.semester Semesters an der Fakultät für #author.faculty
#linebreak() #linebreak()
@ -41,7 +44,7 @@
] ]
// university // university
#pad(top: 0.5cm)[ #pad()[
#if text.lang == "de" [ #if text.lang == "de" [
an der an der
] else if text.lang == "en" [ ] else if text.lang == "en" [
@ -53,7 +56,7 @@
#author.university #author.university
] ]
#set align(horizon + left) #set align(bottom + left)
#if text.lang == "de" [ #if text.lang == "de" [
#table( #table(

View File

@ -12,7 +12,13 @@
#let watermark-color = luma(50%).transparentize(70%) #let watermark-color = luma(50%).transparentize(70%)
#let watermark-pattern = pattern(size: (5pt, 5pt))[ #let watermark-pattern = pattern(size: (5pt, 5pt))[
#place(line(start: (50%, 0%), end: (50%, 100%), stroke: (paint: watermark-color, thickness: 3pt))) #place(
line(
start: (50%, 0%),
end: (50%, 100%),
stroke: (paint: watermark-color, thickness: 3pt),
),
)
] ]
#let watermark(config) = if config.draft { #let watermark(config) = if config.draft {
@ -29,7 +35,10 @@
#linebreak() #linebreak()
document version. document version.
#linebreak() #linebreak()
#text(size: 0.75em, "Further usage without the authors consent is not permitted.")]]] #text(
size: 0.75em,
"Further usage without the authors consent is not permitted.",
)]]]
} }
#let numberingH(c) = { #let numberingH(c) = {
@ -66,12 +75,19 @@
show heading: set text( show heading: set text(
font: style.heading.font, font: style.heading.font,
weight: "semibold", weight: "bold"
) )
set heading(supplement: [chapter]) let header-supplement = if config.lang == "de" {
"Kapitel"
} else {
"chapter"
}
set heading(supplement: [#header-supplement])
set math.equation(numbering: "(1)") set math.equation(numbering: "(1)")
show math.equation: set text(font: "Fira Math", size: 12pt)
// Set header spacing // Set header spacing
show heading.where(level: 1): it => v(2em) + it + v(1em) show heading.where(level: 1): it => v(2em) + it + v(1em)
@ -111,17 +127,27 @@
e => { e => {
let (i, l) = e let (i, l) = e
let n = i + 1 let n = i + 1
let n_str = if (calc.rem(n, 1) == 0) or (true and i == 0) { text(font: style.code.font, size: style.code.size, fill: ABB-BLACK, str(n)) } else { none } let n_str = if (calc.rem(n, 1) == 0) or (true and i == 0) {
(n_str + h(0.5em), raw(block: true, lang: lang, l)) text(
}) font: style.code.font,
size: style.code.size,
fill: ABB-BLACK,
str(n),
)
} else {
none
} }
else { (n_str + h(0.5em), raw(block: true, lang: lang, l))
( ( 1fr, ), },
)
} else {
(
(1fr,),
(left,), (left,),
e => { e => {
let (i, l) = e let (i, l) = e
raw(block: true, lang: lang, l) raw(block: true, lang: lang, l)
} },
) )
} }
} }
@ -139,9 +165,13 @@
.enumerate() .enumerate()
.map(make_row) .map(make_row)
.flatten() .flatten()
.map(c => if c.has("text") and c.text == "" { v(1em) } else { c }) .map(c => if c.has("text") and c.text == "" {
v(1em)
} else {
c
})
) )
} },
) )
#v(-1em) #v(-1em)
#align(center + top, it.caption) #align(center + top, it.caption)
@ -153,7 +183,7 @@
// based on: https://github.com/typst/typst/discussions/3871 // based on: https://github.com/typst/typst/discussions/3871
show figure.caption: c => [ show figure.caption: c => [
#if c.body.fields().len() > 0 { #if c.body.fields().len() > 0 {
text(weight: "semibold")[ text(weight: "medium")[
#c.supplement #c.counter.display("1.1.1") #c.supplement #c.counter.display("1.1.1")
] ]
c.separator c.separator
@ -178,8 +208,20 @@
stroke: (x, y) => ( stroke: (x, y) => (
left: none, left: none,
right: none, right: none,
top: if y == 0 { 1.5pt } else if y < 2 { 1pt } else { 0.5pt }, top: if y == 0 {
bottom: if y == 0 { 1pt } else { 1.5pt } )) 1.5pt
} else if y < 2 {
1pt
} else {
0.5pt
},
bottom: if y == 0 {
1pt
} else {
1.5pt
},
),
)
// make table header bold // make table header bold
show table.cell.where(y: 0): set text(weight: "bold") show table.cell.where(y: 0): set text(weight: "bold")
@ -188,7 +230,8 @@
set par( set par(
justify: true, justify: true,
first-line-indent: 1em, first-line-indent: 1em,
leading: 1em) leading: 1em,
)
// give links a color // give links a color
show link: set text(fill: style.link.color) show link: set text(fill: style.link.color)
@ -201,17 +244,26 @@
header-ascent: style.header.content-padding, header-ascent: style.header.content-padding,
footer-descent: style.header.content-padding, footer-descent: style.header.content-padding,
margin: ( margin: (
top: style.page.margin.top + style.header.underline-top-padding + style.header.content-padding, top: style.page.margin.top + style.header.underline-top-padding + style
.header
.content-padding,
bottom: style.page.margin.bottom + style.footer.content-padding, bottom: style.page.margin.bottom + style.footer.content-padding,
left: style.page.margin.left, left: style.page.margin.left,
right: style.page.margin.right), right: style.page.margin.right,
),
numbering: (..nums) => { numbering: (..nums) => {
let current-page = here().page() let current-page = here().page()
if current-page == 1 { if current-page == 1 {
[] []
} else if query(<end-of-prelude>).first().location().page() > current-page { } else if query(<end-of-prelude>)
.first()
.location()
.page() > current-page {
numbering("I", nums.pos().first()) numbering("I", nums.pos().first())
} else if query(<end-of-content>).first().location().page() >= current-page { } else if query(<end-of-content>)
.first()
.location()
.page() >= current-page {
numbering("1", nums.pos().first()) numbering("1", nums.pos().first())
} else { } else {
numbering("a", nums.pos().first()) numbering("a", nums.pos().first())
@ -228,7 +280,11 @@
set align(center) set align(center)
numbering("I", page-counter) numbering("I", page-counter)
} else if query(<end-of-content>).first().location().page() >= page-number { } else if query(<end-of-content>).first().location().page() >= page-number {
numbering("1 / 1", page-counter, counter(page).at(<end-of-content>).last()) numbering(
"1 / 1",
page-counter,
counter(page).at(<end-of-content>).last(),
)
} else { } else {
numbering("a", page-counter) numbering("a", page-counter)
} }
@ -248,7 +304,13 @@
// right align logo of DHBW // right align logo of DHBW
align(right, image("res/DHBW.svg", height: style.header.logo-height))) align(right, image("res/DHBW.svg", height: style.header.logo-height)))
} else if query(<end-of-content>).first().location().page() >= current-page and query(<end-of-prelude>).first().location().page() < current-page + 1 { } else if query(<end-of-content>)
.first()
.location()
.page() >= current-page and query(<end-of-prelude>)
.first()
.location()
.page() < current-page + 1 {
let heading = currentH() let heading = currentH()
heading.at(0) heading.at(0)
@ -261,7 +323,8 @@
v(style.header.underline-top-padding - 1em) v(style.header.underline-top-padding - 1em)
line(length: 100%) line(length: 100%)
} }
}) },
)
body body
} }

View File

@ -3,8 +3,8 @@
#import "abstract.typ": abstract, summary #import "abstract.typ": abstract, summary
#show: dhbw-template.with(( #show: dhbw-template.with((
lang: "en", lang: "de",
region: "en", region: "de",
draft: false, draft: false,
author: ( author: (
name: "Sven Vogel", name: "Sven Vogel",
@ -51,14 +51,15 @@
#lorem(200) #lorem(200)
@einstein @einstein
= Lorem Ipsum 3 = Lorem Ipsum 3 <sec:hello>
#lorem(15) t `Hello, World!` #lorem(50) #lorem(15) t `Hello, World!` #lorem(50)
$ $
angle.l a, b angle.r &= arrow(a) dot arrow(b) \ angle.l a, b angle.r &= arrow(a) dot arrow(b) \
&= a_1 b_1 + a_2 b_2 + ... a_n b_n \ &= a_1 b_1 + a_2 b_2 + ... a_n b_n \
&= sum_(i=1)^n a_i b_i. &= sum_(i=1)^n a_i b_i. \
integral_2^4(3x + 4x^2)
$ $
#lorem(140) #lorem(140)
@ -68,7 +69,7 @@ $
lorem(200), lorem(200),
) )
#url("https://github.com", "text") #url("https://github.com", "text") @sec:hello
#lorem(50) #lorem(50)

View File

@ -1,8 +1,7 @@
#import "../../src/lib.typ": dhbw-template #import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with( #show: dhbw-template.with((
config: (
lang: none, lang: none,
region: "en", region: "en",
author: ( author: (

View File

@ -1,8 +1,7 @@
#import "../../src/lib.typ": dhbw-template #import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with( #show: dhbw-template.with((
config: (
lang: "en", lang: "en",
this-key-is-not-in-config: "Ha Ha", this-key-is-not-in-config: "Ha Ha",
region: "en", region: "en",
@ -15,7 +14,8 @@
university: "DHBW Mannheim", university: "DHBW Mannheim",
company: "ABB AG", company: "ABB AG",
supervisor: "Benny Goodman", supervisor: "Benny Goodman",
matriculation-number: 123456789), matriculation-number: 123456789,
),
thesis: ( thesis: (
title: "Unofficial ABB/DHBW Typst template", title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises", subtitle: "for reports and thesises",
@ -27,4 +27,8 @@
keywords: ("IT", "other stuff"), keywords: ("IT", "other stuff"),
bibliography: none, bibliography: none,
glossary: none, glossary: none,
appendices: none))) appendices: none,
),
))
= Heading

View File

@ -1,15 +1,15 @@
#import "../../src/lib.typ": dhbw-template #import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with( #show: dhbw-template.with((
config: (
lang: "en", lang: "en",
region: "en", region: "en",
author: ( author: (
university: "DHBW Mannheim", university: "DHBW Mannheim",
company: "ABB AG", company: "ABB AG",
supervisor: none, supervisor: none,
matriculation-number: 123456789), matriculation-number: 123456789,
),
thesis: ( thesis: (
title: "Unofficial ABB/DHBW Typst template", title: "Unofficial ABB/DHBW Typst template",
subtitle: "for reports and thesises", subtitle: "for reports and thesises",
@ -21,4 +21,6 @@
keywords: ("IT", "other stuff"), keywords: ("IT", "other stuff"),
bibliography: none, bibliography: none,
glossary: none, glossary: none,
appendices: none))) appendices: none,
),
))

View File

@ -1,8 +1,7 @@
#import "../../src/lib.typ": dhbw-template #import "../../src/lib.typ": dhbw-template
#show: dhbw-template.with( #show: dhbw-template.with((
config: (
lang: "en", lang: "en",
region: "en", region: "en",
author: ( author: (
@ -27,3 +26,5 @@
bibliography: none, bibliography: none,
glossary: none, glossary: none,
appendices: none))) appendices: none)))
= Heading