From 1cb8504a4dfcf5977411267c80d4ee62a180c2d6 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 4 Oct 2024 12:31:16 +0200 Subject: chore(build): Regenerate --- build/awk/init | 2 + build/c/init | 2 + build/latex/academia/%INIT_APPLICATION_NAME.tex | 9 +- build/latex/academia/build.sh | 27 ++- build/latex/academia/flake.nix | 5 +- .../headers/preamble/core/graphics_and_floats.tex | 8 +- .../latex/academia/headers/preamble/core/index.tex | 2 +- .../academia/headers/preamble/core/references.tex | 2 +- build/latex/academia/init | 2 + build/latex/academia/lpm.toml | 10 +- build/latex/letter/build.sh | 27 ++- build/latex/letter/flake.nix | 5 +- build/latex/letter/init | 2 + .../latex/presentation/%INIT_APPLICATION_NAME.tex | 60 +++++ build/latex/presentation/.envrc | 9 + build/latex/presentation/.gitignore | 8 + .../presentation/.reuse/templates/default.jinja2 | 1 + build/latex/presentation/README.md | 12 + build/latex/presentation/build.sh | 53 +++++ build/latex/presentation/cog.toml | 24 ++ .../presentation/content/static/questions.tex | 10 + build/latex/presentation/content/static/title.tex | 28 +++ build/latex/presentation/flake.nix | 139 ++++++++++++ build/latex/presentation/git_template/config | 7 + build/latex/presentation/git_template/description | 1 + .../git_template/hooks/applypatch-msg.sample | 15 ++ .../git_template/hooks/commit-msg.sample | 24 ++ .../git_template/hooks/fsmonitor-watchman.sample | 174 +++++++++++++++ .../git_template/hooks/post-update.sample | 8 + .../git_template/hooks/pre-applypatch.sample | 14 ++ .../git_template/hooks/pre-commit.sample | 49 ++++ .../git_template/hooks/pre-merge-commit.sample | 13 ++ .../git_template/hooks/pre-push.sample | 53 +++++ .../git_template/hooks/pre-rebase.sample | 169 ++++++++++++++ .../git_template/hooks/pre-receive.sample | 24 ++ .../git_template/hooks/prepare-commit-msg.sample | 42 ++++ .../git_template/hooks/push-to-checkout.sample | 78 +++++++ .../git_template/hooks/sendemail-validate.sample | 77 +++++++ .../presentation/git_template/hooks/update.sample | 128 +++++++++++ build/latex/presentation/git_template/info/exclude | 6 + build/latex/presentation/headers/preamble.tex | 2 + .../headers/preamble/beamer/appendix.tex | 1 + .../headers/preamble/beamer/columns.tex | 1 + .../headers/preamble/beamer/float_positioning.tex | 4 + .../presentation/headers/preamble/beamer/mod.tex | 6 + .../presentation/headers/preamble/beamer/pdfpc.tex | 2 + .../presentation/headers/preamble/core/bable.tex | 1 + .../headers/preamble/core/chemistry.tex | 5 + .../headers/preamble/core/copyright.tex | 15 ++ .../headers/preamble/core/date_and_time.tex | 1 + .../headers/preamble/core/encoding.tex | 4 + .../headers/preamble/core/graphics_and_floats.tex | 22 ++ .../presentation/headers/preamble/core/index.tex | 8 + .../presentation/headers/preamble/core/linting.tex | 1 + .../headers/preamble/core/margindate.tex | 37 +++ .../presentation/headers/preamble/core/math.tex | 27 +++ .../presentation/headers/preamble/core/mod.tex | 16 ++ .../presentation/headers/preamble/core/notes.tex | 1 + .../headers/preamble/core/references.tex | 37 +++ .../presentation/headers/preamble/core/visuals.tex | 10 + build/latex/presentation/headers/preamble/mod.tex | 2 + .../latex/presentation/headers/preamble_local.tex | 0 build/latex/presentation/init | 194 ++++++++++++++++ build/latex/presentation/init.local | 70 ++++++ build/latex/presentation/lpm.toml | 37 +++ build/latex/presentation/present.sh | 14 ++ build/latex/presentation/references/reference.bib | 0 build/latex/presentation/scripts/fix_notes.sh | 23 ++ build/latex/presentation/shell_line_editor.sh | 247 +++++++++++++++++++++ build/latex/presentation/treefmt.nix | 70 ++++++ build/latex/presentation/update.sh | 3 + build/latex/presentation/watch.sh | 70 ++++++ build/rust/init | 2 + build/shell/init | 2 + 74 files changed, 2236 insertions(+), 28 deletions(-) create mode 100644 build/latex/presentation/%INIT_APPLICATION_NAME.tex create mode 100644 build/latex/presentation/.envrc create mode 100644 build/latex/presentation/.gitignore create mode 100644 build/latex/presentation/.reuse/templates/default.jinja2 create mode 100644 build/latex/presentation/README.md create mode 100755 build/latex/presentation/build.sh create mode 100644 build/latex/presentation/cog.toml create mode 100644 build/latex/presentation/content/static/questions.tex create mode 100644 build/latex/presentation/content/static/title.tex create mode 100644 build/latex/presentation/flake.nix create mode 100644 build/latex/presentation/git_template/config create mode 100644 build/latex/presentation/git_template/description create mode 100644 build/latex/presentation/git_template/hooks/applypatch-msg.sample create mode 100644 build/latex/presentation/git_template/hooks/commit-msg.sample create mode 100644 build/latex/presentation/git_template/hooks/fsmonitor-watchman.sample create mode 100644 build/latex/presentation/git_template/hooks/post-update.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-applypatch.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-commit.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-merge-commit.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-push.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-rebase.sample create mode 100644 build/latex/presentation/git_template/hooks/pre-receive.sample create mode 100644 build/latex/presentation/git_template/hooks/prepare-commit-msg.sample create mode 100644 build/latex/presentation/git_template/hooks/push-to-checkout.sample create mode 100644 build/latex/presentation/git_template/hooks/sendemail-validate.sample create mode 100644 build/latex/presentation/git_template/hooks/update.sample create mode 100644 build/latex/presentation/git_template/info/exclude create mode 100644 build/latex/presentation/headers/preamble.tex create mode 100644 build/latex/presentation/headers/preamble/beamer/appendix.tex create mode 100644 build/latex/presentation/headers/preamble/beamer/columns.tex create mode 100644 build/latex/presentation/headers/preamble/beamer/float_positioning.tex create mode 100644 build/latex/presentation/headers/preamble/beamer/mod.tex create mode 100644 build/latex/presentation/headers/preamble/beamer/pdfpc.tex create mode 100644 build/latex/presentation/headers/preamble/core/bable.tex create mode 100644 build/latex/presentation/headers/preamble/core/chemistry.tex create mode 100644 build/latex/presentation/headers/preamble/core/copyright.tex create mode 100644 build/latex/presentation/headers/preamble/core/date_and_time.tex create mode 100644 build/latex/presentation/headers/preamble/core/encoding.tex create mode 100644 build/latex/presentation/headers/preamble/core/graphics_and_floats.tex create mode 100644 build/latex/presentation/headers/preamble/core/index.tex create mode 100644 build/latex/presentation/headers/preamble/core/linting.tex create mode 100644 build/latex/presentation/headers/preamble/core/margindate.tex create mode 100644 build/latex/presentation/headers/preamble/core/math.tex create mode 100644 build/latex/presentation/headers/preamble/core/mod.tex create mode 100644 build/latex/presentation/headers/preamble/core/notes.tex create mode 100644 build/latex/presentation/headers/preamble/core/references.tex create mode 100644 build/latex/presentation/headers/preamble/core/visuals.tex create mode 100644 build/latex/presentation/headers/preamble/mod.tex create mode 100644 build/latex/presentation/headers/preamble_local.tex create mode 100644 build/latex/presentation/init create mode 100755 build/latex/presentation/init.local create mode 100644 build/latex/presentation/lpm.toml create mode 100755 build/latex/presentation/present.sh create mode 100644 build/latex/presentation/references/reference.bib create mode 100755 build/latex/presentation/scripts/fix_notes.sh create mode 100644 build/latex/presentation/shell_line_editor.sh create mode 100644 build/latex/presentation/treefmt.nix create mode 100755 build/latex/presentation/update.sh create mode 100755 build/latex/presentation/watch.sh diff --git a/build/awk/init b/build/awk/init index 9ee0462..e8f72c8 100644 --- a/build/awk/init +++ b/build/awk/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ diff --git a/build/c/init b/build/c/init index 9ee0462..e8f72c8 100644 --- a/build/c/init +++ b/build/c/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ diff --git a/build/latex/academia/%INIT_APPLICATION_NAME.tex b/build/latex/academia/%INIT_APPLICATION_NAME.tex index a5fe645..72db095 100644 --- a/build/latex/academia/%INIT_APPLICATION_NAME.tex +++ b/build/latex/academia/%INIT_APPLICATION_NAME.tex @@ -1,7 +1,10 @@ % LTeX: language=%INIT_LANGUAGE -%\documentclass[a4paper, 12pt, nosolutions]{report} -% \documentclass[a4paper, 12pt, onecolumn]{report} -\documentclass[a4paper, 12pt, twocolumn]{scrartcl} +\documentclass[ + a4paper, 12pt, twocolumn, + % nosolutions, + draft, + % final, +]{report} \input{headers/preamble.tex} \input{headers/preamble_local.tex} diff --git a/build/latex/academia/build.sh b/build/latex/academia/build.sh index c67ad52..1ff2b6e 100755 --- a/build/latex/academia/build.sh +++ b/build/latex/academia/build.sh @@ -1,6 +1,8 @@ #!/usr/bin/env sh -file="./%INIT_APPLICATION_NAME.tex" +root="$(git rev-parse --show-toplevel)" + +file="$root/%INIT_APPLICATION_NAME.tex" dst=build clear=false @@ -21,10 +23,31 @@ for arg in "$@"; do done # find all directories which are not the destination dir or inside it -find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do +find "$root" -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do mkdir --parents "$dst/$dir" done test "$clear" = true && rm "$dst/${file%tex}out" +fd . "$root/figures" --type file --extension tex | while read -r figure; do + figure_name_full="$(basename "$figure")" + figure_name="${figure_name_full%.tex}" + + figure_hash="$(sha256sum "$figure")" + figure_cache_hash="$( + [ -e "$dst/figures/$figure_name/$figure_name.sha256sum_hash" ] && + cat "$dst/figures/$figure_name/$figure_name.sha256sum_hash" + )" + + echo "Compiling figure: '$figure_name'.." + mkdir --parents "$dst/figures/$figure_name" + + if [ "$figure_hash" = "$figure_cache_hash" ]; then + echo " -> Didn't change, not re-compiling." + else + echo "$figure_hash" >"$dst/figures/$figure_name/$figure_name.sha256sum_hash" + pdflatex -output-directory="$dst" -file-line-error -jobname="figures/$figure_name/$figure_name" "$figure" + fi +done + latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" diff --git a/build/latex/academia/flake.nix b/build/latex/academia/flake.nix index 6a21c68..bfdf673 100644 --- a/build/latex/academia/flake.nix +++ b/build/latex/academia/flake.nix @@ -46,15 +46,12 @@ }; crane = { url = "github:ipetkov/crane"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; + inputs = {}; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; }; }; }; diff --git a/build/latex/academia/headers/preamble/core/graphics_and_floats.tex b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex index c0784c9..c71fc2a 100644 --- a/build/latex/academia/headers/preamble/core/graphics_and_floats.tex +++ b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex @@ -7,9 +7,6 @@ \usepackage{pgfplots} % plots, 2D and 3D \pgfplotsset{compat=1.18} % Set a compatibility level, to be able to use the new versions -\usetikzlibrary{external} -\tikzexternalize[prefix=figures/, mode=list and make] - % \usetikzlibrary{intersections, angles, quotes, calc, positioning} % \usetikzlibrary{arrows.meta} %TODO maybe deprecated? @@ -17,6 +14,9 @@ % \usepackage{subcaption} % like caption package, but for subfigures % \usepackage{booktabs} % better tables - \usepackage{float} % Allows placing floats here (H) and creating new floats `\newfloat` \usepackage{wrapfig} % Wraps text around figures with the \begin{wrapfigure} environment + +\NewDocumentCommand{\IncludeTikz}{m}{ + \includegraphics{build/figures/#1/#1} +} diff --git a/build/latex/academia/headers/preamble/core/index.tex b/build/latex/academia/headers/preamble/core/index.tex index a52cc20..3efbfc4 100644 --- a/build/latex/academia/headers/preamble/core/index.tex +++ b/build/latex/academia/headers/preamble/core/index.tex @@ -4,5 +4,5 @@ \ifdraft{ \usepackage{showidx} } { - \message {Draft packages not loaded, showidx not loaded.} + \message {Draft option not enabled, 'showidx' not loaded.} } diff --git a/build/latex/academia/headers/preamble/core/references.tex b/build/latex/academia/headers/preamble/core/references.tex index e42b22f..179d903 100644 --- a/build/latex/academia/headers/preamble/core/references.tex +++ b/build/latex/academia/headers/preamble/core/references.tex @@ -33,5 +33,5 @@ \ifdraft{ \usepackage{showlabels} } { - \message {Draft packages not loaded, 'showlabels' not loaded.} + \message {Draft option not enabled, 'showlabels' not loaded.} } diff --git a/build/latex/academia/init b/build/latex/academia/init index 9ee0462..e8f72c8 100644 --- a/build/latex/academia/init +++ b/build/latex/academia/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ diff --git a/build/latex/academia/lpm.toml b/build/latex/academia/lpm.toml index 1821b73..28702c9 100644 --- a/build/latex/academia/lpm.toml +++ b/build/latex/academia/lpm.toml @@ -17,18 +17,14 @@ chapter = ''' figure = ''' % LTeX: language=%INIT_LANGUAGE -\documentclass[varwidth]{standalone} +\documentclass{standalone} \input{../headers/preamble.tex} \input{../headers/preamble_local.tex} -\usepackage{tikz} - \begin{document} % lpm::current_date (lpm::new_figure_name) - -\begin{tizkpicture} - \node at (0,0) {Hello world!}; +\begin{tikzpicture} + \draw node[left] {ping?} (0,0) -- (3,0) node[right] {Pong!} ; \end{tikzpicture} - \end{document} ''' diff --git a/build/latex/letter/build.sh b/build/latex/letter/build.sh index c67ad52..1ff2b6e 100755 --- a/build/latex/letter/build.sh +++ b/build/latex/letter/build.sh @@ -1,6 +1,8 @@ #!/usr/bin/env sh -file="./%INIT_APPLICATION_NAME.tex" +root="$(git rev-parse --show-toplevel)" + +file="$root/%INIT_APPLICATION_NAME.tex" dst=build clear=false @@ -21,10 +23,31 @@ for arg in "$@"; do done # find all directories which are not the destination dir or inside it -find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do +find "$root" -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do mkdir --parents "$dst/$dir" done test "$clear" = true && rm "$dst/${file%tex}out" +fd . "$root/figures" --type file --extension tex | while read -r figure; do + figure_name_full="$(basename "$figure")" + figure_name="${figure_name_full%.tex}" + + figure_hash="$(sha256sum "$figure")" + figure_cache_hash="$( + [ -e "$dst/figures/$figure_name/$figure_name.sha256sum_hash" ] && + cat "$dst/figures/$figure_name/$figure_name.sha256sum_hash" + )" + + echo "Compiling figure: '$figure_name'.." + mkdir --parents "$dst/figures/$figure_name" + + if [ "$figure_hash" = "$figure_cache_hash" ]; then + echo " -> Didn't change, not re-compiling." + else + echo "$figure_hash" >"$dst/figures/$figure_name/$figure_name.sha256sum_hash" + pdflatex -output-directory="$dst" -file-line-error -jobname="figures/$figure_name/$figure_name" "$figure" + fi +done + latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" diff --git a/build/latex/letter/flake.nix b/build/latex/letter/flake.nix index 6a21c68..bfdf673 100644 --- a/build/latex/letter/flake.nix +++ b/build/latex/letter/flake.nix @@ -46,15 +46,12 @@ }; crane = { url = "github:ipetkov/crane"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; + inputs = {}; }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; }; }; }; diff --git a/build/latex/letter/init b/build/latex/letter/init index 9ee0462..e8f72c8 100644 --- a/build/latex/letter/init +++ b/build/latex/letter/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ diff --git a/build/latex/presentation/%INIT_APPLICATION_NAME.tex b/build/latex/presentation/%INIT_APPLICATION_NAME.tex new file mode 100644 index 0000000..a04a7dd --- /dev/null +++ b/build/latex/presentation/%INIT_APPLICATION_NAME.tex @@ -0,0 +1,60 @@ +% LTeX: language=%INIT_LANGUAGE +\documentclass[ + a4paper, 12pt, + draft, + % final, + hyperref={ pdflang=%INIT_DATE_TIME_LANGUAGE }, +]{beamer} + +\input{headers/preamble.tex} +\input{headers/preamble_local.tex} + +\title{\textbf{%INIT_APPLICATION_NAME_STYLIZED}} +\author{%INIT_AUTHOR_NAME \\ +\href{mailto:%INIT_AUTHOR_EMAIL}{%INIT_AUTHOR_EMAIL}\\[1cm] +{\small Supervisor: TODO}} +\date{\DTMToday} + +% For the copyright section +\SetYears{%INIT_YEAR} +\SetAuthors{%INIT_AUTHOR_NAME} + +\logo{\includegraphics[height=1cm]{references/images/logo}} + +\usetheme[block=fill]{moloch} + +% \setbeameroption{hide notes} % Only slides +% \setbeameroption{show only notes} % Only notes +% \setbeameroption{show notes on second screen} % Both + +\pdfpcsetup{ + % Other settings can be package options, or can go here + duration=10, +} + +\makeatletter +\hypersetup{ + pdftitle={\@title}, + pdfsubject={}, + pdfauthor={\@authors}, + pdfkeywords={TODO}, +} +\makeatother + +\includeonly { + % lpm::next_chapter_includeonly_marker +} + +\begin{document} +\input{content/static/title} + +% lpm::next_chapter_marker + +\input{content/static/questions} + +\appendix +\begin{frame} + \printbibliography + \printindex +\end{frame} +\end{document} diff --git a/build/latex/presentation/.envrc b/build/latex/presentation/.envrc new file mode 100644 index 0000000..3bc1085 --- /dev/null +++ b/build/latex/presentation/.envrc @@ -0,0 +1,9 @@ +use flake || use nix +watch_file flake.nix + +PATH_add ./scripts + +if on_git_branch; then + echo && git status --short --branch && + echo && git fetch --verbose +fi diff --git a/build/latex/presentation/.gitignore b/build/latex/presentation/.gitignore new file mode 100644 index 0000000..539b891 --- /dev/null +++ b/build/latex/presentation/.gitignore @@ -0,0 +1,8 @@ +# build +/result +/build + +/resources.local + +# dev env +.direnv diff --git a/build/latex/presentation/.reuse/templates/default.jinja2 b/build/latex/presentation/.reuse/templates/default.jinja2 new file mode 100644 index 0000000..7a2d08f --- /dev/null +++ b/build/latex/presentation/.reuse/templates/default.jinja2 @@ -0,0 +1 @@ + diff --git a/build/latex/presentation/README.md b/build/latex/presentation/README.md new file mode 100644 index 0000000..6dad42c --- /dev/null +++ b/build/latex/presentation/README.md @@ -0,0 +1,12 @@ +# %INIT_APPLICATION_NAME_STYLIZED + +> %INIT_DESCRIPTION + +## Licensing + +This project complies with the REUSE v3.2 specification. This means that every file +clearly states its copyright. +Please run `./scripts/cprh.sh contributer NAME EMAIL FILES..` after you +contributed to `FILES..` to record your contribution (obviously replacing +the `NAME`, `EMAIL` and `FILES..` placeholders with your name, email, and +the paths to the changed files respectively (see the `--help` output for more)). diff --git a/build/latex/presentation/build.sh b/build/latex/presentation/build.sh new file mode 100755 index 0000000..1ff2b6e --- /dev/null +++ b/build/latex/presentation/build.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env sh + +root="$(git rev-parse --show-toplevel)" + +file="$root/%INIT_APPLICATION_NAME.tex" +dst=build + +clear=false + +for arg in "$@"; do + case "$arg" in + "--clear") + clear=true + ;; + --*) + echo "No such option: '$arg'" + exit 2 + ;; + *) + file="$arg" + ;; + esac +done + +# find all directories which are not the destination dir or inside it +find "$root" -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do + mkdir --parents "$dst/$dir" +done + +test "$clear" = true && rm "$dst/${file%tex}out" + +fd . "$root/figures" --type file --extension tex | while read -r figure; do + figure_name_full="$(basename "$figure")" + figure_name="${figure_name_full%.tex}" + + figure_hash="$(sha256sum "$figure")" + figure_cache_hash="$( + [ -e "$dst/figures/$figure_name/$figure_name.sha256sum_hash" ] && + cat "$dst/figures/$figure_name/$figure_name.sha256sum_hash" + )" + + echo "Compiling figure: '$figure_name'.." + mkdir --parents "$dst/figures/$figure_name" + + if [ "$figure_hash" = "$figure_cache_hash" ]; then + echo " -> Didn't change, not re-compiling." + else + echo "$figure_hash" >"$dst/figures/$figure_name/$figure_name.sha256sum_hash" + pdflatex -output-directory="$dst" -file-line-error -jobname="figures/$figure_name/$figure_name" "$figure" + fi +done + +latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" diff --git a/build/latex/presentation/cog.toml b/build/latex/presentation/cog.toml new file mode 100644 index 0000000..ebb3a5d --- /dev/null +++ b/build/latex/presentation/cog.toml @@ -0,0 +1,24 @@ +tag_prefix = "v" +branch_whitelist = ["main", "prime"] +ignore_merge_commits = false + +pre_bump_hooks = [ + "reuse lint", # Check licensing status. + "nix flake check", # Verify the project builds. + "flake_version_update --version v{{version}} --input-file flake.nix", # Bump the version in the flake.nix file + "nix fmt", # Format. +] +post_bump_hooks = [ + "git push", + "git push origin v{{version}}", # push the new tag to origin +] + +[bump_profiles] + +[changelog] +path = "NEWS.md" +template = "remote" +remote = "%INIT_REMOTE" +repository = "%INIT_REPOSITORY" +owner = "%INIT_OWNER" +authors = [{ signature = "%INIT_AUTHOR_NAME", username = "%INIT_OWNER" }] diff --git a/build/latex/presentation/content/static/questions.tex b/build/latex/presentation/content/static/questions.tex new file mode 100644 index 0000000..40c3803 --- /dev/null +++ b/build/latex/presentation/content/static/questions.tex @@ -0,0 +1,10 @@ +% LTeX: language=%INIT_LANGUAGE + +{ +\logo{} + +\begin{frame}[standout] + % TODO change to your needed language + \shadowtext{Questions?} +\end{frame} +} diff --git a/build/latex/presentation/content/static/title.tex b/build/latex/presentation/content/static/title.tex new file mode 100644 index 0000000..30ad3d9 --- /dev/null +++ b/build/latex/presentation/content/static/title.tex @@ -0,0 +1,28 @@ +% LTeX: language=%INIT_LANGUAGE + +\maketitle + +% \begin{frame}{Content} +% \setbeamertemplate{section in toc}[sections numbered] +% \tableofcontents[hideallsubsections] +% \end{frame} + +\begin{frame}[fragile]{Copyright} + % TODO: Translate this section (or remove this comment, if your language of choice is English) + + This presentation is available under: + \begin{center} + \url{%INIT_HOME_PAGE} + \end{center} + + \makeatletter + Copyright \textcopyright{} \@authors{} \@years{}\\ + \ \\ + This work is licensed under the terms of the %INIT_SPDX_LICENSE_IDENTIFIER licence. + The licence text can be found online at \url{%INIT_LICENSE_URL}. + \ + \makeatother + + % TODO match the logo to your real license + \begin{center}\ccbysa\end{center} +\end{frame} diff --git a/build/latex/presentation/flake.nix b/build/latex/presentation/flake.nix new file mode 100644 index 0000000..8bdb11b --- /dev/null +++ b/build/latex/presentation/flake.nix @@ -0,0 +1,139 @@ +{ + description = "%INIT_DESCRIPTION"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + flake_version_update = { + url = "git+https://codeberg.org/soispha/flake_version_update.git"; + inputs = { + systems.follows = "systems"; + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + lpm = { + url = "git+https://codeberg.org/bpeetz/lpm.git"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-compat.follows = "flake-compat"; + flake-utils.follows = "flake-utils"; + rust-overlay.follows = "rust-overlay"; + crane.follows = "crane"; + systems.follows = "systems"; + }; + }; + + # inputs for following + systems = { + url = "github:nix-systems/x86_64-linux"; # only evaluate for this system + }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs = { + systems.follows = "systems"; + }; + }; + crane = { + url = "github:ipetkov/crane"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + treefmt-nix, + lpm, + flake_version_update, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + + # This version is set automatically on `cog bump --auto`; + version = "v%INIT_APPLICATION_VERSION"; # GUIDING VERSION STRING + + # TODO reduce to the needed ones + texlive = pkgs.texlive.combined.scheme-full; + + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; + + build = pkgs.stdenv.mkDerivation { + pname = "%INIT_APPLICATION_NAME"; + inherit version; + src = ./.; + + buildInputs = [ + texlive + ]; + + # Run local + preferLocalBuild = true; + allowSubstitutes = false; + + buildPhase = '' + # TODO: I have no idea, why calling it with `./build.sh` does not work <2024-03-20> + bash ./build.sh + ''; + + installPhase = '' + install -D "./build/%INIT_APPLICATION_NAME.pdf" "$out/%INIT_APPLICATION_NAME.pdf"; + ''; + }; + in { + packages.default = build; + + checks = { + inherit build; + formatting = treefmtEval.config.build.check self; + }; + + formatter = treefmtEval.config.build.wrapper; + + devShells.default = pkgs.mkShell { + env = { + FONTCONFIG_FILE = pkgs.makeFontsConf { + fontDirectories = [ + "${pkgs.fira-mono}/share/fonts/opentype" + "${pkgs.fira}/share/fonts/opentype" + ]; + }; + }; + + packages = with pkgs; [ + cocogitto + reuse + flake_version_update.packages."${system}".default + lpm.packages."${system}".default + texlive + + wl-mirror + + zathura + + pdfpc + ]; + }; + }); +} diff --git a/build/latex/presentation/git_template/config b/build/latex/presentation/git_template/config new file mode 100644 index 0000000..f0c8d31 --- /dev/null +++ b/build/latex/presentation/git_template/config @@ -0,0 +1,7 @@ +[remote "origin"] + url = %INIT_CLONE_URL + fetch = +refs/heads/*:refs/remotes/origin/* + pushurl = %INIT_PUSH_URL +[branch "%INIT_MAIN_BRANCH"] + remote = origin + merge = refs/heads/%INIT_MAIN_BRANCH diff --git a/build/latex/presentation/git_template/description b/build/latex/presentation/git_template/description new file mode 100644 index 0000000..bf2d1bf --- /dev/null +++ b/build/latex/presentation/git_template/description @@ -0,0 +1 @@ +%INIT_DESCRIPTION diff --git a/build/latex/presentation/git_template/hooks/applypatch-msg.sample b/build/latex/presentation/git_template/hooks/applypatch-msg.sample new file mode 100644 index 0000000..e6c87c6 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/build/latex/presentation/git_template/hooks/commit-msg.sample b/build/latex/presentation/git_template/hooks/commit-msg.sample new file mode 100644 index 0000000..5604587 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/build/latex/presentation/git_template/hooks/fsmonitor-watchman.sample b/build/latex/presentation/git_template/hooks/fsmonitor-watchman.sample new file mode 100644 index 0000000..367d462 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/fsmonitor-watchman.sample @@ -0,0 +1,174 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 2) and last update token +# formatted as a string and outputs to stdout a new update token and +# all files that have been modified since the update token. Paths must +# be relative to the root of the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $last_update_token) = @ARGV; + +# Uncomment for debugging +# print STDERR "$0 $version $last_update_token\n"; + +# Check the hook interface version +if ($version ne 2) { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree = get_working_dir(); + +my $retry = 1; + +my $json_pkg; +eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; +} or do { + require JSON::PP; + $json_pkg = "JSON::PP"; +}; + +launch_watchman(); + +sub launch_watchman { + my $o = watchman_query(); + if (is_work_tree_watched($o)) { + output_result($o->{clock}, @{$o->{files}}); + } +} + +sub output_result { + my ($clockid, @files) = @_; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # binmode $fh, ":utf8"; + # print $fh "$clockid\n@files\n"; + # close $fh; + + binmode STDOUT, ":utf8"; + print $clockid; + print "\0"; + local $, = "\0"; + print @files; +} + +sub watchman_clock { + my $response = qx/watchman clock "$git_work_tree"/; + die "Failed to get clock id on '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + return $json_pkg->new->utf8->decode($response); +} + +sub watchman_query { + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $last_update_token but not from the .git folder. + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + my $last_update_line = ""; + if (substr($last_update_token, 0, 1) eq "c") { + $last_update_token = "\"$last_update_token\""; + $last_update_line = qq[\n"since": $last_update_token,]; + } + my $query = <<" END"; + ["query", "$git_work_tree", {$last_update_line + "fields": ["name"], + "expression": ["not", ["dirname", ".git"]] + }] + END + + # Uncomment for debugging the watchman query + # open (my $fh, ">", ".git/watchman-query.json"); + # print $fh $query; + # close $fh; + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + # Uncomment for debugging the watch response + # open ($fh, ">", ".git/watchman-response.json"); + # print $fh $response; + # close $fh; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + return $json_pkg->new->utf8->decode($response); +} + +sub is_work_tree_watched { + my ($output) = @_; + my $error = $output->{error}; + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { + $retry--; + my $response = qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + $output = $json_pkg->new->utf8->decode($response); + $error = $output->{error}; + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # close $fh; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + my $o = watchman_clock(); + $error = $output->{error}; + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + output_result($o->{clock}, ("/")); + $last_update_token = $o->{clock}; + + eval { launch_watchman() }; + return 0; + } + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + return 1; +} + +sub get_working_dir { + my $working_dir; + if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $working_dir = Win32::GetCwd(); + $working_dir =~ tr/\\/\//; + } else { + require Cwd; + $working_dir = Cwd::cwd(); + } + + return $working_dir; +} diff --git a/build/latex/presentation/git_template/hooks/post-update.sample b/build/latex/presentation/git_template/hooks/post-update.sample new file mode 100644 index 0000000..e3b3f9f --- /dev/null +++ b/build/latex/presentation/git_template/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/build/latex/presentation/git_template/hooks/pre-applypatch.sample b/build/latex/presentation/git_template/hooks/pre-applypatch.sample new file mode 100644 index 0000000..c414f0e --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/build/latex/presentation/git_template/hooks/pre-commit.sample b/build/latex/presentation/git_template/hooks/pre-commit.sample new file mode 100644 index 0000000..55f180d --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff-index --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/build/latex/presentation/git_template/hooks/pre-merge-commit.sample b/build/latex/presentation/git_template/hooks/pre-merge-commit.sample new file mode 100644 index 0000000..0ed3c36 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-merge-commit.sample @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff --git a/build/latex/presentation/git_template/hooks/pre-push.sample b/build/latex/presentation/git_template/hooks/pre-push.sample new file mode 100644 index 0000000..cb27ddb --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/build/latex/presentation/git_template/hooks/pre-rebase.sample b/build/latex/presentation/git_template/hooks/pre-rebase.sample new file mode 100644 index 0000000..d062617 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /nix/store/57hpz6jj3pnjwdwwg6jgmj9gr7kxs8zp-perl-5.38.2/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/build/latex/presentation/git_template/hooks/pre-receive.sample b/build/latex/presentation/git_template/hooks/pre-receive.sample new file mode 100644 index 0000000..0bf2643 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/pre-receive.sample @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/build/latex/presentation/git_template/hooks/prepare-commit-msg.sample b/build/latex/presentation/git_template/hooks/prepare-commit-msg.sample new file mode 100644 index 0000000..24283a0 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/prepare-commit-msg.sample @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/nix/store/57hpz6jj3pnjwdwwg6jgmj9gr7kxs8zp-perl-5.38.2/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /nix/store/57hpz6jj3pnjwdwwg6jgmj9gr7kxs8zp-perl-5.38.2/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /nix/store/57hpz6jj3pnjwdwwg6jgmj9gr7kxs8zp-perl-5.38.2/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/build/latex/presentation/git_template/hooks/push-to-checkout.sample b/build/latex/presentation/git_template/hooks/push-to-checkout.sample new file mode 100644 index 0000000..07fa538 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/push-to-checkout.sample @@ -0,0 +1,78 @@ +#!/usr/bin/env bash + +# An example hook script to update a checked-out tree on a git push. +# +# This hook is invoked by git-receive-pack(1) when it reacts to git +# push and updates reference(s) in its repository, and when the push +# tries to update the branch that is currently checked out and the +# receive.denyCurrentBranch configuration variable is set to +# updateInstead. +# +# By default, such a push is refused if the working tree and the index +# of the remote repository has any difference from the currently +# checked out commit; when both the working tree and the index match +# the current commit, they are updated to match the newly pushed tip +# of the branch. This hook is to be used to override the default +# behaviour; however the code below reimplements the default behaviour +# as a starting point for convenient modification. +# +# The hook receives the commit with which the tip of the current +# branch is going to be updated: +commit=$1 + +# It can exit with a non-zero status to refuse the push (when it does +# so, it must not modify the index or the working tree). +die () { + echo >&2 "$*" + exit 1 +} + +# Or it can make any necessary changes to the working tree and to the +# index to bring them to the desired state when the tip of the current +# branch is updated to the new commit, and exit with a zero status. +# +# For example, the hook can simply run git read-tree -u -m HEAD "$1" +# in order to emulate git fetch that is run in the reverse direction +# with git push, as the two-tree form of git read-tree -u -m is +# essentially the same as git switch or git checkout that switches +# branches while keeping the local changes in the working tree that do +# not interfere with the difference between the branches. + +# The below is a more-or-less exact translation to shell of the C code +# for the default behaviour for git's push-to-checkout hook defined in +# the push_to_deploy() function in builtin/receive-pack.c. +# +# Note that the hook will be executed from the repository directory, +# not from the working tree, so if you want to perform operations on +# the working tree, you will have to adapt your code accordingly, e.g. +# by adding "cd .." or using relative paths. + +if ! git update-index -q --ignore-submodules --refresh +then + die "Up-to-date check failed" +fi + +if ! git diff-files --quiet --ignore-submodules -- +then + die "Working directory has unstaged changes" +fi + +# This is a rough translation of: +# +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX +if git cat-file -e HEAD 2>/dev/null +then + head=HEAD +else + head=$(git hash-object -t tree --stdin &2 + exit 1 +} + +unset GIT_DIR GIT_WORK_TREE +cd "$worktree" && + +if grep -q "^diff --git " "$1" +then + validate_patch "$1" +else + validate_cover_letter "$1" +fi && + +if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL" +then + git config --unset-all sendemail.validateWorktree && + trap 'git worktree remove -ff "$worktree"' EXIT && + validate_series +fi diff --git a/build/latex/presentation/git_template/hooks/update.sample b/build/latex/presentation/git_template/hooks/update.sample new file mode 100644 index 0000000..1910758 --- /dev/null +++ b/build/latex/presentation/git_template/hooks/update.sample @@ -0,0 +1,128 @@ +#!/usr/bin/env bash +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --type=bool hooks.allowunannotated) +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) +denycreatebranch=$(git config --type=bool hooks.denycreatebranch) +allowdeletetag=$(git config --type=bool hooks.allowdeletetag) +allowmodifytag=$(git config --type=bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin &2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/build/latex/presentation/git_template/info/exclude b/build/latex/presentation/git_template/info/exclude new file mode 100644 index 0000000..a5196d1 --- /dev/null +++ b/build/latex/presentation/git_template/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/build/latex/presentation/headers/preamble.tex b/build/latex/presentation/headers/preamble.tex new file mode 100644 index 0000000..d45262a --- /dev/null +++ b/build/latex/presentation/headers/preamble.tex @@ -0,0 +1,2 @@ +\input{headers/preamble/mod.tex} +\input{headers/preamble_local.tex} diff --git a/build/latex/presentation/headers/preamble/beamer/appendix.tex b/build/latex/presentation/headers/preamble/beamer/appendix.tex new file mode 100644 index 0000000..e0599b9 --- /dev/null +++ b/build/latex/presentation/headers/preamble/beamer/appendix.tex @@ -0,0 +1 @@ +\usepackage{appendixnumberbeamer} diff --git a/build/latex/presentation/headers/preamble/beamer/columns.tex b/build/latex/presentation/headers/preamble/beamer/columns.tex new file mode 100644 index 0000000..594bc49 --- /dev/null +++ b/build/latex/presentation/headers/preamble/beamer/columns.tex @@ -0,0 +1 @@ +\usepackage{multicol} % allows for multi-columns everywhere, with the "multicols" environment diff --git a/build/latex/presentation/headers/preamble/beamer/float_positioning.tex b/build/latex/presentation/headers/preamble/beamer/float_positioning.tex new file mode 100644 index 0000000..28a9167 --- /dev/null +++ b/build/latex/presentation/headers/preamble/beamer/float_positioning.tex @@ -0,0 +1,4 @@ +% \usepackage[absolute,overlay,showboxes]{textpos} +\usepackage[absolute,overlay]{textpos} + +\usepackage{adjustbox} diff --git a/build/latex/presentation/headers/preamble/beamer/mod.tex b/build/latex/presentation/headers/preamble/beamer/mod.tex new file mode 100644 index 0000000..a82acad --- /dev/null +++ b/build/latex/presentation/headers/preamble/beamer/mod.tex @@ -0,0 +1,6 @@ +\setbeamercolor{itemize/enumerate body}{fg=gray} + +\input{headers/preamble/beamer/appendix.tex} +\input{headers/preamble/beamer/columns.tex} +\input{headers/preamble/beamer/float_positioning.tex} +\input{headers/preamble/beamer/pdfpc.tex} diff --git a/build/latex/presentation/headers/preamble/beamer/pdfpc.tex b/build/latex/presentation/headers/preamble/beamer/pdfpc.tex new file mode 100644 index 0000000..93e1f2d --- /dev/null +++ b/build/latex/presentation/headers/preamble/beamer/pdfpc.tex @@ -0,0 +1,2 @@ +% "overridenote" must be specified as a package option +\usepackage[overridenote]{pdfpc} diff --git a/build/latex/presentation/headers/preamble/core/bable.tex b/build/latex/presentation/headers/preamble/core/bable.tex new file mode 100644 index 0000000..f034018 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/bable.tex @@ -0,0 +1 @@ +\usepackage[%INIT_BABLE_LANGUAGE]{babel} % For language support diff --git a/build/latex/presentation/headers/preamble/core/chemistry.tex b/build/latex/presentation/headers/preamble/core/chemistry.tex new file mode 100644 index 0000000..94f2592 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/chemistry.tex @@ -0,0 +1,5 @@ +\usepackage[locale = %INIT_SIUNITX_LANGUAGE]{siunitx} % For easy unit representation +\sisetup{per-mode = fraction} + +\usepackage[version=4]{mhchem} % for \ce command +\usepackage{chemfig} diff --git a/build/latex/presentation/headers/preamble/core/copyright.tex b/build/latex/presentation/headers/preamble/core/copyright.tex new file mode 100644 index 0000000..268b910 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/copyright.tex @@ -0,0 +1,15 @@ +\ExplSyntaxOn +\cs_new_protected:Npn \SetAuthors #1 +{ + \tl_const:Nn \AuthorList {#1} +} +\cs_new_protected:Npn \SetYears #1 +{ + \tl_const:Nn \YearList {#1} +} +\ExplSyntaxOff + +\usepackage[scale=2]{ccicons} % Typeset the cc icons + +% TODO: Add a `\copyright` macro, that generates the copyright text automatically and +% language defined <2024-10-03> diff --git a/build/latex/presentation/headers/preamble/core/date_and_time.tex b/build/latex/presentation/headers/preamble/core/date_and_time.tex new file mode 100644 index 0000000..32e838d --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/date_and_time.tex @@ -0,0 +1 @@ +\usepackage[%INIT_DATE_TIME_LANGUAGE, showdow]{datetime2} % make handling dates easier diff --git a/build/latex/presentation/headers/preamble/core/encoding.tex b/build/latex/presentation/headers/preamble/core/encoding.tex new file mode 100644 index 0000000..1f48d2a --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/encoding.tex @@ -0,0 +1,4 @@ + +\usepackage[utf8]{inputenc} % use utf8 encoding +\usepackage[T1]{fontenc} % for 8bit font support +\usepackage{lmodern} % latin modern fonts, should be better than ae, aecompl diff --git a/build/latex/presentation/headers/preamble/core/graphics_and_floats.tex b/build/latex/presentation/headers/preamble/core/graphics_and_floats.tex new file mode 100644 index 0000000..c71fc2a --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/graphics_and_floats.tex @@ -0,0 +1,22 @@ +\usepackage{graphicx} % allows for easy inclusion of graphics +\usepackage{xcolor} % colors and color mixing \color{red!30!green!40!blue} + +\usepackage{tikz} % Nice drawn graphics, for library see: https://tex.stackexchange.com/a/42664 +\usetikzlibrary{calc} + +\usepackage{pgfplots} % plots, 2D and 3D +\pgfplotsset{compat=1.18} % Set a compatibility level, to be able to use the new versions + +% \usetikzlibrary{intersections, angles, quotes, calc, positioning} +% \usetikzlibrary{arrows.meta} %TODO maybe deprecated? + +% \usepackage{tikz-cd} % better commutative diagrams +% \usepackage{subcaption} % like caption package, but for subfigures +% \usepackage{booktabs} % better tables + +\usepackage{float} % Allows placing floats here (H) and creating new floats `\newfloat` +\usepackage{wrapfig} % Wraps text around figures with the \begin{wrapfigure} environment + +\NewDocumentCommand{\IncludeTikz}{m}{ + \includegraphics{build/figures/#1/#1} +} diff --git a/build/latex/presentation/headers/preamble/core/index.tex b/build/latex/presentation/headers/preamble/core/index.tex new file mode 100644 index 0000000..3efbfc4 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/index.tex @@ -0,0 +1,8 @@ +\usepackage{index} % Helps to create an index +\makeindex + +\ifdraft{ + \usepackage{showidx} +} { + \message {Draft option not enabled, 'showidx' not loaded.} +} diff --git a/build/latex/presentation/headers/preamble/core/linting.tex b/build/latex/presentation/headers/preamble/core/linting.tex new file mode 100644 index 0000000..a1bbe34 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/linting.tex @@ -0,0 +1 @@ +\usepackage{nag} diff --git a/build/latex/presentation/headers/preamble/core/margindate.tex b/build/latex/presentation/headers/preamble/core/margindate.tex new file mode 100644 index 0000000..5579f98 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/margindate.tex @@ -0,0 +1,37 @@ +\DTMnewdatestyle{margindate}{ + \renewcommand*\DTMdisplaydate[4]{ + \MakeLowercase{\DTMshortweekdayname{##4}}\space + \number##3\relax\space + \MakeLowercase{\DTMshortmonthname{##2}}\space + \DTMtwodigits{\DTMtwodigits{##1}} + } + \renewcommand*\DTMDisplaydate[4]{ + \DTMshortweekdayname{##4}\space + ##3\space + \DTMshortmonthname{##2}\space + \DTMtwodigits{\DTMtwodigits{##1}} + } +} + +\NewDocumentCommand\MarginContent{m}{ + \marginpar{ + \small\textsf{\mbox{#1}} + }\relax +} + +\NewDocumentCommand\MarginDate{m}{ + { + \DTMsetdatestyle{margindate} + + \MarginContent{\DTMDate{#1}} + } +} + +\NewDocumentCommand\AnnotatedSection{m m}{ + \section{#1} + \MarginContent{#2} +} +\NewDocumentCommand\DatedSection{m m}{ + \section{#1} + \MarginDate{#2} +} diff --git a/build/latex/presentation/headers/preamble/core/math.tex b/build/latex/presentation/headers/preamble/core/math.tex new file mode 100644 index 0000000..170f57a --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/math.tex @@ -0,0 +1,27 @@ +\usepackage{amsmath} % extensive math commands +\usepackage{amsfonts} % more fonts for math (fracture, boldfaced and so on) +\usepackage{mathtools} % extension to amsmath, with more sensible defaults (eq numbers only when referenced) +\usepackage{amssymb} % more symbols, mostly redundant because already loaded by something else +\usepackage{mathrsfs} % support for the RSFS fonts (through \mathscr command) +\usepackage{cancel} % allows to cancel a part in math mode, for example to shorten a term +\usepackage{bm} % bold mode in math, but better than \boldsymbol command from ams. \bm + +% number sets +\NewDocumentCommand\N{}{\ensuremath{\mathbb{N}}} +\NewDocumentCommand\R{}{\ensuremath{\mathbb{R}}} +\NewDocumentCommand\Z{}{\ensuremath{\mathbb{Z}}} +\NewDocumentCommand\Q{}{\ensuremath{\mathbb{Q}}} +\NewDocumentCommand\C{}{\ensuremath{\mathbb{C}}} +\let\originalO\O +\RenewDocumentCommand\O{}{\ensuremath{\emptyset}} % replaces the Ø + +% readable limits +\let\originalLim\lim +\RenewDocumentCommand\lim{}{\originalLim\limits} + +% aliases +\let\implies\Rightarrow +\let\impliedby\Leftarrow + +\let\originalEpsilon\epsilon +\RenewDocumentCommand\epsilon{}{\varepsilon} % I like the textual epsilon more diff --git a/build/latex/presentation/headers/preamble/core/mod.tex b/build/latex/presentation/headers/preamble/core/mod.tex new file mode 100644 index 0000000..403ce58 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/mod.tex @@ -0,0 +1,16 @@ +% Core packages (used in the implementation of this preamble) +\usepackage{ifdraft} + +\input{headers/preamble/core/bable.tex} +\input{headers/preamble/core/chemistry.tex} +\input{headers/preamble/core/copyright.tex} +\input{headers/preamble/core/date_and_time.tex} +\input{headers/preamble/core/encoding.tex} +\input{headers/preamble/core/graphics_and_floats.tex} +\input{headers/preamble/core/index.tex} +\input{headers/preamble/core/linting.tex} +\input{headers/preamble/core/margindate.tex} +\input{headers/preamble/core/math.tex} +\input{headers/preamble/core/notes.tex} +\input{headers/preamble/core/references.tex} +\input{headers/preamble/core/visuals.tex} diff --git a/build/latex/presentation/headers/preamble/core/notes.tex b/build/latex/presentation/headers/preamble/core/notes.tex new file mode 100644 index 0000000..1f10ef3 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/notes.tex @@ -0,0 +1 @@ +\usepackage[obeyFinal,%INIT_TODONOTES_LANGUAGE]{todonotes} diff --git a/build/latex/presentation/headers/preamble/core/references.tex b/build/latex/presentation/headers/preamble/core/references.tex new file mode 100644 index 0000000..179d903 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/references.tex @@ -0,0 +1,37 @@ +\usepackage{csquotes} % required by biblatex + +% \usepackage{biblatex-dw} +\usepackage[backend=biber, + % style=footnote-dw, + % pageref=true, + % annotation=true, + % library=true, + % + style=numeric, + autocite=plain, + doi=true, + isbn=true, + loccittracker=true, + opcittracker=true, + % No idea what it does, but it was recomended to me + defernumbers=true +]{biblatex} % For bibtex references +\addbibresource{ref/references.bib} +% \bibliography{res/reference} % Set the location of the references + +\usepackage[pdflang=%INIT_DATE_TIME_LANGUAGE]{hyperref} +\hypersetup{ + colorlinks, + linkcolor={black}, + citecolor={black}, + urlcolor={blue!80!black} +} + +\usepackage[nospace,%INIT_TODONOTES_LANGUAGE]{varioref} % for \vref +\usepackage[%INIT_TODONOTES_LANGUAGE, noabbrev, nameinlink]{cleveref} + +\ifdraft{ + \usepackage{showlabels} +} { + \message {Draft option not enabled, 'showlabels' not loaded.} +} diff --git a/build/latex/presentation/headers/preamble/core/visuals.tex b/build/latex/presentation/headers/preamble/core/visuals.tex new file mode 100644 index 0000000..96a2fd2 --- /dev/null +++ b/build/latex/presentation/headers/preamble/core/visuals.tex @@ -0,0 +1,10 @@ +\usepackage[disable=ifdraft]{microtype} % makes text better to read +\usepackage{emptypage} % no page numbers and headings on empty pages + +\usepackage{blindtext} % blindtext + + +% horizontal rule +\NewDocumentCommand{\hr}{}{ + \par\noindent\rule[0.5ex]{\linewidth}{0.5pt} +} diff --git a/build/latex/presentation/headers/preamble/mod.tex b/build/latex/presentation/headers/preamble/mod.tex new file mode 100644 index 0000000..a8d5fc7 --- /dev/null +++ b/build/latex/presentation/headers/preamble/mod.tex @@ -0,0 +1,2 @@ +\input{headers/preamble/beamer/mod.tex} +\input{headers/preamble/core/mod.tex} diff --git a/build/latex/presentation/headers/preamble_local.tex b/build/latex/presentation/headers/preamble_local.tex new file mode 100644 index 0000000..e69de29 diff --git a/build/latex/presentation/init b/build/latex/presentation/init new file mode 100644 index 0000000..e8f72c8 --- /dev/null +++ b/build/latex/presentation/init @@ -0,0 +1,194 @@ +#!/usr/bin/env sh + +# shellcheck source=/dev/null +. "$(realpath "$(dirname "$0")")/shell_line_editor.sh" + +replacement_file="$(mktemp)" + +trap cleanup INT +trap "cleanup; remove_self" EXIT +cleanup() { + rm "$replacement_file" +} +avoid_cleanup="false" +remove_self() { + if [ "$avoid_cleanup" = "false" ]; then + rm "$(realpath "$0")" + rm "$(realpath "$(dirname "$0")")/shell_line_editor.sh" + [ -f "$(realpath "$(dirname "$0")")/init.local" ] && rm "$(realpath "$(dirname "$0")")/init.local" + fi +} +require() { + program="$1" + if ! command -v "$program" >/dev/null; then + avoid_cleanup="true" + echo "Please install '$program' for this init script to work." 1>&2 + exit 1 + fi +} +die() { + printf "init: ERROR: %s\n" "$1" + exit 1 +} + +# Prompt the user for a specific variable. +# ## Args: +# [1]: Name of the variable to populate the answer to +# [2]: An optional description +# [3]: An optionally suggested answer +# [4]: If this is set, the user is not even asked. +prompt() { + pr_variable_upper="$(echo "$1" | sed 's/\([a-z]\)/\U\1/')" + pr_description="$2" + pr_suggested_answer="$3" + pr_ask="$4" + + if [ -n "$pr_ask" ]; then + REPLY="$pr_suggested_answer" + else + printf "\033[94;1mEnter %s\033[0m" "$pr_variable_upper" + if [ -n "$pr_description" ]; then + printf " (\033[93;1m%s\033[0m):\n" "$pr_description" + else + printf ":\n" + fi + + # LE "> " 0 " " "$pr_suggested_answer" "yes_please_produce_debug_output" + LE "> " 0 " " "$pr_suggested_answer" "" + fi + + pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")" + + eval "$pr_new_variable" + printf "%s\n" "$pr_new_variable" >>"$replacement_file" +} + +require git + +require jq +require curl + +require fd +require mv +require sed +require chmod + +# necessary meta data +prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")" +prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')" +prompt APPLICATION_NAME_CAPITALIZED_MAN_PART "The capitalized name of the application (for documentation also with a man section part)" "$(echo "$APPLICATION_NAME" | sed 's/_/-/g' | sed 's/\(.*\)/\U\1(1)/')" "dont_ask" +prompt APPLICATION_VERSION "The version of this program, without the prefix" "0.1.0" + +prompt AUTHOR_NAME "The name of the author (or authors)" "$(git config --get user.name)" +prompt AUTHOR_EMAIL "The email of the author (or authors)" "$(git config --get user.email)" + +# cog change-log variables +prompt REMOTE "The remote, this project will be pushed to" "git.vhack.eu" +prompt REPOSITORY "The path of the repository on the remote" "$APPLICATION_NAME" + +owner1="$(printf "%.1s" "$AUTHOR_NAME")" +owner2="${AUTHOR_NAME#* }" +if [ "$owner2" = "$AUTHOR_NAME" ]; then + owner_build="$(echo "$AUTHOR_NAME" | tr '[:upper:]' '[:lower:]')" +else + owner_build="$(echo "$owner1$owner2" | tr '[:upper:]' '[:lower:]')" +fi +prompt OWNER "The name of owner of the repository" "$owner_build" + +# nice meta data +prompt DESCRIPTION "The description of this project" "" +prompt CURRENT_DATE "The stylized version of the current date" "$(date +'%b %Y')" +prompt YEAR "The year the work on this has begun (for copyright reasons)" "$(date +'%Y')" +prompt APPLICATION_SOURCE_CODE_REPOSITORY "The package's source code repository URL" "https://$REMOTE/$OWNER/$REPOSITORY" +prompt HOME_PAGE "The home page URL of the project" "https://$REPOSITORY.org/" +prompt BUG_URL "The URL people should report bugs to" "$APPLICATION_SOURCE_CODE_REPOSITORY/issues" + +# git stuff +prompt PUSH_URL "The url used to push this project" "git@$REMOTE:$OWNER/$REPOSITORY.git" +prompt CLONE_URL "The url used to clone this project" "git@$REMOTE:$OWNER/$REPOSITORY.git" +prompt MAIN_BRANCH "The name of the main branch" "$(git config init.defaultbranch)" + +if [ -e ./watch.sh ]; then + # Use a different default license in latex projects. + init_default_license="CC-BY-SA-4.0" +else + init_default_license="AGPL-3.0-or-later" +fi +prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" + +default_license_url="$(curl --silent --show-error "https://spdx.org/licenses/$SPDX_LICENSE_IDENTIFIER.json" | jq --raw-output '.seeAlso[0]')" + +# Prefer possible text versions of the license +if curl --fail --silent --show-error "$default_license_url.txt" >/dev/null; then + default_license_url="$default_license_url.txt" +fi +prompt LICENSE_URL "The url of the license" "$default_license_url" + +if [ -e ./.reuse/templates/default.jinja2 ]; then + if [ -n "$DESCRIPTION" ]; then + description_str=" - $DESCRIPTION" + else + description_str="" + fi + + cat <./.reuse/templates/default.jinja2 +{% for copyright_line in copyright_lines %} +{{ copyright_line }} +{% endfor %} +{% for contributor_line in contributor_lines %} +SPDX-FileContributor: {{ contributor_line }} +{% endfor %} +{% for expression in spdx_expressions %} +SPDX-License-Identifier: {{ expression }} +{% endfor %} + +This file is part of $APPLICATION_NAME_STYLIZED$description_str. + +You should have received a copy of the License along with this program. +If not, see <$LICENSE_URL>. +EOF +fi + +# Allow templates to add template specific prompts +[ -e init.local ] && . ./init.local + +git init --initial-branch "$MAIN_BRANCH" --template="./git_template" +rm --recursive ./git_template + +while read -r var; do + var_name="${var%=*}" + var_value="${var#*=\"}" + var_value="${var_value%\"}" + + fd . --hidden --type file --exec sed --in-place "s|%\bINIT_$var_name\b|$var_value|g" + + # Replace the variable in file paths + fd "%INIT_$var_name" . --hidden | while read -r file_path; do + new_file_path="$(echo "$file_path" | sed "s|%INIT_$var_name|$var_value|g")" + mv "$file_path" "$new_file_path" + done +done <"$replacement_file" + +# HACK: Re-add the executable permissions to files, which the nix template has somehow +# removed <2024-04-02> +chmod +x scripts/* +chmod +x update.sh +[ -f ./build.sh ] && chmod +x build.sh +[ -f ./watch.sh ] && chmod +x build.sh + +# Do the first run of reuse annotate +reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" +[ "$(echo "$reuse" | wc -l)" -ne 1 ] && die "Something is wrong with the nixpkgs#reuse derivation" + +git add . + +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + +git diff --name-only --cached | + xargs -I {} "$reuse" annotate \ + --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ + --copyright-style string-c \ + --template default \ + --license "$SPDX_LICENSE_IDENTIFIER" "{}" + +# vim: ft=sh diff --git a/build/latex/presentation/init.local b/build/latex/presentation/init.local new file mode 100755 index 0000000..123e349 --- /dev/null +++ b/build/latex/presentation/init.local @@ -0,0 +1,70 @@ +#!/usr/bin/env sh + +prompt LANGUAGE "The language to use in the latex documents" "en_GB" + +bable_language="" +case "$LANGUAGE" in +"en_GB") + bable_language="british" + ;; +en_*) + bable_language="english" + ;; +de_DE | de_*) + bable_language="ngerman" + ;; + +*) + echo "'$LANGUAGE' is not yet recognized by the init.local script! Please open an issue." 1>&2 + echo "set 'BABLE_LANGUAGE' to 'NOT_YET_RECOGNIZED_PLEASE_REPLACE' to help you find instances of the variable use." 1>&2 + bable_language="NOT_YET_RECOGNIZED_PLEASE_REPLACE" + ;; +esac + +if [ "$bable_language" = "british" ]; then + todonotes_language="english" +else + todonotes_language="$bable_language" +fi + +siunitx_language="" +# locales UK, US, DE (Germany), PL (Poland), FR (French), SI (Slovene) and ZA (South Africa). +case "$LANGUAGE" in +"en_GB") + siunitx_language="UK" # United Kingdom + ;; +"en_US") + siunitx_language="US" # United States of Amerika + ;; +en_ZA) + siunitx_language="ZA" # South Africa + ;; +en_*) + echo "'$LANGUAGE' is not yet recognized! But it seems english, thus we set SIUNITX_LANGUAGE='UK'." + siunitx_language="UK" + ;; +de_DE) + siunitx_language="DE" # Germany + ;; +pl_PL) + siunitx_language="PL" # Poland + ;; +fr_FR) + siunitx_language="FR" # French + ;; +sl_SL) + siunitx_language="SI" # Slovene + ;; +*) + echo "'$LANGUAGE' is not yet recognized by the init.local script! Please open an issue." 1>&2 + echo "set 'SIUNITX_LANGUAGE' to 'NOT_YET_RECOGNIZED_PLEASE_REPLACE' to help you find instances of the variable use." 1>&2 + siunitx_language="NOT_YET_RECOGNIZED_PLEASE_REPLACE" + ;; +esac + +prompt BABLE_LANGUAGE "The language to use for the bable package" "$bable_language" "dont_ask" +prompt DATE_TIME_LANGUAGE "The language to use for the datetime2 package" "$(echo "$LANGUAGE" | sed 's/_/-/g')" "dont_ask" +prompt SIUNITX_LANGUAGE "The language to use for the siunitx package" "$siunitx_language" "dont_ask" +prompt TODONOTES_LANGUAGE "The language to use for the todonotes package" "$todonotes_language" "dont_ask" + +# vim: ft=sh diff --git a/build/latex/presentation/lpm.toml b/build/latex/presentation/lpm.toml new file mode 100644 index 0000000..56e40fb --- /dev/null +++ b/build/latex/presentation/lpm.toml @@ -0,0 +1,37 @@ +main_file = "%INIT_APPLICATION_NAME.tex" + +[templates] +section = ''' +%! TEX root = ../../../%INIT_APPLICATION_NAME.tex +% LTeX: language=%INIT_LANGUAGE + +\begin{frame}{lpm::new_section_name} % lpm::current_date + \setbeamercolor{itemize/enumerate body}{fg=gray} + + \begin{enumerate}[<+-|alert@+>] + \item + \end{enumerate} +\end{frame} +''' + +chapter = """ +%! TEX root = ../../../%INIT_APPLICATION_NAME.tex +% LTeX: language=%INIT_LANGUAGE + +% Chapter (lpm::current_date) +\section{lpm::new_chapter_name} +""" + +figure = ''' +% LTeX: language=%INIT_LANGUAGE +\documentclass{standalone} + +\input{../headers/preamble.tex} +\input{../headers/preamble_local.tex} + +\begin{document} % lpm::current_date (lpm::new_figure_name) +\begin{tikzpicture} + \draw node[left] {ping?} (0,0) -- (3,0) node[right] {Pong!} ; +\end{tikzpicture} +\end{document} +''' diff --git a/build/latex/presentation/present.sh b/build/latex/presentation/present.sh new file mode 100755 index 0000000..19b17e5 --- /dev/null +++ b/build/latex/presentation/present.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +killall swayidle +pgrep gammastep | xargs kill + +# This avoids the `task` run in the `.zshrc` +export NVIM="true" + +wl-mirror HDMI-A-1 & + +pdfpc --windowed=both ./build/%INIT_APPLICATION_NAME.pdf & +riverctl send-to-output -current-tags next + +# vim: ft=sh diff --git a/build/latex/presentation/references/reference.bib b/build/latex/presentation/references/reference.bib new file mode 100644 index 0000000..e69de29 diff --git a/build/latex/presentation/scripts/fix_notes.sh b/build/latex/presentation/scripts/fix_notes.sh new file mode 100755 index 0000000..c5caf5b --- /dev/null +++ b/build/latex/presentation/scripts/fix_notes.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh + +# Compiling this document with pdflatex, will leave all utf8 chars in the `\note`s +# mangled. But, `pdfpc` interprets them as markdown, thus replacing all of them with their +# respective html entities results in them looking correct in during the presentation. +# +# This script automatically replaces them in the source files. +# +# # Known Bugs +# It does not account for `\note`s spanning multiple lines. So, for example, this would not +# be fixed: +# ```latex +# \note { +# Ästhetik ist hierbei nicht mit den Wundern der Kunst zu verwechseln. +# } +# ``` + +rg '\\note' --files-with-matches | while IFS= read -r file; do + [ "$(basename "$file")" = "$(basename "$0")" ] && continue + + echo "Fixing: '$file'" + sed --in-place 's/^\(.*\)\\note\(.*\){\(.*\)}/printf "%s\\\\\\note%s{%s}" "\1" "\2" "$( echo "\3" | sed "s@ä@\\\ä\;@g" | sed "s@ö@\\\ö\;@g" | sed "s@ü@\\\ü\;@g" | sed "s@Ä@\\\Ä\;@g" | sed "s@Ö@\\\Ö\;@g" | sed "s@Ü@\\\Ü\;@g" | sed "s@ß@\\\ß\;@g" | sed "s@→@\\\&rarr\;@g" )"/eg' "$file" +done diff --git a/build/latex/presentation/shell_line_editor.sh b/build/latex/presentation/shell_line_editor.sh new file mode 100644 index 0000000..8d6833a --- /dev/null +++ b/build/latex/presentation/shell_line_editor.sh @@ -0,0 +1,247 @@ +#! /usr/bin/env sh +# Taken in verbatim from: https://unix.stackexchange.com/a/113450, and somewhat changed + +LE_print_debug() { + LE_debug="$1" + LE_debug_msg="$2" + [ -n "$LE_debug" ] && printf "\nDBG: (%s)\n" "$LE_debug_msg" >outfile.debug +} + +LE() { + # Shell Line Editor. Extremely slow and stupid code. However it + # should work on ansi/vt100/linux derived terminals on POSIX + # systems. + # Understands some emacs key bindings: CTRL-(A,B,D,E,F,H,K,L) + # plus the CTRL-W and CTRL-U normal killword and kill. + # no Meta-X key, but handling of , , , + # . + # + # Args: + # [1]: prompt (\x sequences recognized, defaults to "") + # [2]: max input length (unlimited if < 0, (default)) + # [3]: fill character when erasing (defaults to space) + # [4]: initial value. + # [5]: whether to output debugfiles (outfile.debug and outfile.raw.debug) + # Returns: + # 0: OK + # 1: od(d) error or CTRL-C hit + + LE_prompt="$1" + LE_max=${2--1} + LE_fill=${3-" "} + LE_debug="$5" + + LE_backward() { + LE_substract="$1" + while [ -n "$LE_substract" ]; do + printf '\b%s' "$2" + LE_substract=${LE_substract%?} + done + } + + LE_fill() { + LE_substract="$1" + while [ -n "$LE_substract" ]; do + printf '%s' "$LE_fill" + LE_substract=${LE_substract%?} + done + } + + # Used but not right now + # shellcheck disable=2016 + LE_restore='stty "$LE_tty" + LC_COLLATE='${LC_COLLATE-"; unset LC_COLLATE"} + + # LE_tty is used in the restore above + # shellcheck disable=2034 + LE_ret=1 LE_tty=$(stty -g) LC_COLLATE=C + + # text on the right of the cursor + LE_left=$4 + # text on the left of the cursor + LE_right='' + + # Tell the terminal to show us every char inputted + stty -icanon -echo -isig min 3 time 1 -istrip + printf '%b%s' "$LE_prompt" "$LE_left" + + # clear the output + [ -n "$LE_debug" ] && printf "" >outfile.debug + [ -n "$LE_debug" ] && printf "" >outfile.raw.debug + + # The value needs to be split for it to work (and it's either way just numbers) + # shellcheck disable=2046 + while set -- $(dd bs=3 count=1 2>/dev/null | od -vAn -to1); do + while [ "$#" -gt 0 ]; do + [ -n "$LE_debug" ] && printf "%b" "\0$1" >>outfile.debug + [ -n "$LE_debug" ] && printf "%s " "$1" >>outfile.raw.debug + LE_current_key=$1 + shift + + # 033 is ^[ (`printf "\\$1\n" | cat -v`) + if [ "$LE_current_key" = 033 ]; then + case "$1$2$3" in + # [ C | O C -> ^F forward + 133103* | 117103*) + shift 2 + LE_current_key=006 + ;; + # [ D | O D -> ^B backward + 133104* | 117104*) + shift 2 + LE_current_key=002 + ;; + # [ H | O H -> ^A beginning of line + 133110* | 117110*) + shift 2 + LE_current_key=001 + ;; + # [ P | O P -> ^D del char + 133120* | 117120*) + shift 2 + LE_current_key=004 + ;; + # [ F | O F -> ^E end of line + 133106* | 117106*) + shift 2 + LE_current_key=005 + ;; + # [ 1 ~ -> ^A beginning of line + 133061176) + shift 3 + LE_current_key=001 + ;; + # [ 4 ~ -> ^E end of line + 133064176) + shift 3 + LE_current_key=005 + ;; + # [ 3 ~ -> ^D del char + 133063176) + shift 3 + LE_current_key=004 + ;; + # [ | O + 133* | 117*) + shift + # Is $1 in ge 0 AND le 9 OR eq ';'? + # These are control sequences for things like colors; Ignore them + while [ "0$1" -ge 060 ] && [ "0$1" -le 071 ] || + [ "0$1" -eq 073 ]; do + shift + done + ;; + esac + fi + + case "$LE_current_key" in + 001) # ^A beginning of line + LE_backward "$LE_left" + LE_right="$LE_left$LE_right" + LE_left= + ;; + 002) # ^B backward + if [ "$LE_left" = "" ]; then + # bell + printf '\a' + LE_print_debug "$LE_debug" "backward with empty left" + else + printf '\b' + LE_tmp="${LE_left%?}" + LE_right="${LE_left#"$LE_tmp"}$LE_right" + LE_left="$LE_tmp" + fi ;; + 003) # CTRL-C + break 2 ;; + 004) # ^D del char + if [ "$LE_right" = "" ]; then + # bell (tell the user that the line is empty) + printf '\a' + LE_print_debug "$LE_debug" "delete with empty right" + else + LE_right="${LE_right#?}" + printf '%s\b' "$LE_right$LE_fill" + LE_backward "$LE_right" + fi ;; + 012 | 015) # NL or CR + LE_ret=0 + break 2 + ;; + 005) # ^E end of line + printf '%s' "$LE_right" + LE_left="$LE_left$LE_right" + LE_right= + ;; + 006) # ^F forward + if [ "$LE_right" = "" ]; then + # bell (tell the user that the line is empty) + printf '\a' + LE_print_debug "$LE_debug" "forward with empty right" + else + LE_tmp="${LE_right#?}" + LE_left="$LE_left${LE_right%"$LE_tmp"}" + printf %s "${LE_right%"$LE_tmp"}" + LE_right="$LE_tmp" + fi ;; + 010 | 177) # backspace or del + if [ "$LE_left" = "" ]; then + # bell + printf '\a' + LE_print_debug "$LE_debug" "backspace with empty left" + else + printf '\b%s\b' "$LE_right$LE_fill" + LE_backward "$LE_right" + LE_left="${LE_left%?}" + fi ;; + 013) # ^K kill to end of line + LE_fill "$LE_right" + LE_backward "$LE_right" + LE_right="" + ;; + 014) # ^L redraw + printf '\r%b%s' "$LE_prompt" "$LE_left$LE_right" + LE_backward "$LE_right" + ;; + 025) # ^U kill line + LE_backward "$LE_left" + LE_fill "$LE_left$LE_right" + LE_backward "$LE_left$LE_right" + LE_left="" + LE_right="" + ;; + 027) # ^W kill word + if [ "$LE_left" = "" ]; then + # bell + printf '\a' + else + LE_tmp="${LE_left% *}" + LE_backward "${LE_left#"$LE_tmp"}" + LE_fill "${LE_left#"$LE_tmp"}" + LE_backward "${LE_left#"$LE_tmp"}" + LE_left="$LE_tmp" + fi ;; + # Print the received key, as it did not match a special key + [02][4-7]? | [13]??) # 040 -> 177, 240 -> 377 + # was assuming iso8859-x at the time + if [ "$LE_max" -gt 0 ] && LE_tmp="$LE_left$LE_right" && + [ "${#LE_tmp}" -eq "$LE_max" ]; then + # bell, when the user is trying to cross the line limit + printf '\a' + LE_print_debug "$LE_debug" "max output reached" + else + LE_left="$LE_left$(printf '%b' "\0$LE_current_key")" + printf '%b%s' "\0$LE_current_key" "$LE_right" + LE_backward "$LE_right" + fi ;; + *) + LE_print_debug "$LE_debug" "key not recognized: $(printf "%b" "\0$LE_current_key")" + printf '\a' + ;; + esac + done + done + eval "$LE_restore" + REPLY=$LE_left$LE_right + echo + return "$LE_ret" +} diff --git a/build/latex/presentation/treefmt.nix b/build/latex/presentation/treefmt.nix new file mode 100644 index 0000000..794e8fc --- /dev/null +++ b/build/latex/presentation/treefmt.nix @@ -0,0 +1,70 @@ +{ + treefmt-nix, + pkgs, +}: +treefmt-nix.lib.evalModule pkgs ( + {pkgs, ...}: { + # Used to find the project root + projectRootFile = "flake.nix"; + + programs = { + alejandra.enable = true; + rustfmt.enable = true; + clang-format.enable = true; + mdformat.enable = true; + shfmt = { + enable = true; + indent_size = 4; + }; + shellcheck.enable = true; + prettier = { + enable = true; + settings = { + arrowParens = "always"; + bracketSameLine = false; + bracketSpacing = true; + editorconfig = true; + embeddedLanguageFormatting = "auto"; + endOfLine = "lf"; + # experimentalTernaries = false; + htmlWhitespaceSensitivity = "css"; + insertPragma = false; + jsxSingleQuote = true; + printWidth = 80; + proseWrap = "always"; + quoteProps = "consistent"; + requirePragma = false; + semi = true; + singleAttributePerLine = true; + singleQuote = false; + trailingComma = "all"; + useTabs = false; + vueIndentScriptAndStyle = false; + + tabWidth = 2; + }; + }; + stylua.enable = true; + ruff = { + enable = true; + format = true; + }; + taplo.enable = true; + }; + + settings = { + global.excludes = [ + "CHANGELOG.md" + "NEWS.md" + ]; + formatter = { + clang-format = { + options = ["--style" "GNU"]; + }; + shfmt = { + includes = ["*.bash"]; + }; + }; + }; + } +) diff --git a/build/latex/presentation/update.sh b/build/latex/presentation/update.sh new file mode 100755 index 0000000..49216b8 --- /dev/null +++ b/build/latex/presentation/update.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +nix flake update diff --git a/build/latex/presentation/watch.sh b/build/latex/presentation/watch.sh new file mode 100755 index 0000000..e5147f2 --- /dev/null +++ b/build/latex/presentation/watch.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env sh + +help() { + cat <&2 + exit 1 + ;; + esac +done + +[ -n "$reader" ] && "$reader" ./build/%INIT_APPLICATION_NAME.pdf & + +while true; do + ./build.sh + sleep "$time" +done diff --git a/build/rust/init b/build/rust/init index 9ee0462..e8f72c8 100644 --- a/build/rust/init +++ b/build/rust/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ diff --git a/build/shell/init b/build/shell/init index 9ee0462..e8f72c8 100644 --- a/build/shell/init +++ b/build/shell/init @@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse" git add . +cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)" + git diff --name-only --cached | xargs -I {} "$reuse" annotate \ --copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \ -- cgit 1.4.1