diff options
Diffstat (limited to '')
-rw-r--r-- | build/latex/academia/%INIT_APPLICATION_NAME.tex (renamed from build/latex/%INIT_APPLICATION_NAME.tex) | 0 | ||||
-rw-r--r-- | build/latex/academia/.envrc (renamed from build/latex/.envrc) | 0 | ||||
-rw-r--r-- | build/latex/academia/.gitignore (renamed from build/latex/.gitignore) | 0 | ||||
-rw-r--r-- | build/latex/academia/.reuse/templates/default.jinja2 | 2 | ||||
-rw-r--r-- | build/latex/academia/LICENSE (renamed from build/latex/LICENSE) | 0 | ||||
-rw-r--r-- | build/latex/academia/README.md (renamed from build/latex/README.md) | 0 | ||||
-rwxr-xr-x | build/latex/academia/build.sh (renamed from build/latex/build.sh) | 0 | ||||
-rw-r--r-- | build/latex/academia/cog.toml (renamed from build/latex/cog.toml) | 0 | ||||
-rw-r--r-- | build/latex/academia/content/static/title.tex (renamed from build/latex/content/static/title.tex) | 0 | ||||
-rw-r--r-- | build/latex/academia/flake.lock (renamed from build/latex/flake.lock) | 12 | ||||
-rw-r--r-- | build/latex/academia/flake.nix (renamed from build/latex/flake.nix) | 2 | ||||
-rw-r--r-- | build/latex/academia/headers/preamble.tex (renamed from build/latex/headers/preamble.tex) | 0 | ||||
-rw-r--r-- | build/latex/academia/headers/preamble_local.tex (renamed from build/latex/headers/preamble_local.tex) | 0 | ||||
-rw-r--r-- | build/latex/academia/init (renamed from build/latex/init) | 77 | ||||
-rw-r--r-- | build/latex/academia/lpm.toml (renamed from build/latex/lpm.toml) | 8 | ||||
-rw-r--r-- | build/latex/academia/possible_resources_for_v3_template.txt | 15 | ||||
-rw-r--r-- | build/latex/academia/references/reference.bib (renamed from build/latex/references/reference.bib) | 0 | ||||
-rwxr-xr-x | build/latex/academia/scripts/cprh.sh | 57 | ||||
-rwxr-xr-x | build/latex/academia/scripts/extract_text_from_all.sh (renamed from build/latex/scripts/extract_text_from_all.sh) | 0 | ||||
-rw-r--r-- | build/latex/academia/shell_line_editor.sh (renamed from build/latex/shell_line_editor.sh) | 0 | ||||
-rw-r--r-- | build/latex/academia/treefmt.nix (renamed from build/latex/treefmt.nix) | 0 | ||||
-rwxr-xr-x | build/latex/academia/update.sh (renamed from build/latex/update.sh) | 0 | ||||
-rwxr-xr-x | build/latex/academia/watch.sh | 70 |
23 files changed, 188 insertions, 55 deletions
diff --git a/build/latex/%INIT_APPLICATION_NAME.tex b/build/latex/academia/%INIT_APPLICATION_NAME.tex index e7934fe..e7934fe 100644 --- a/build/latex/%INIT_APPLICATION_NAME.tex +++ b/build/latex/academia/%INIT_APPLICATION_NAME.tex diff --git a/build/latex/.envrc b/build/latex/academia/.envrc index 3bc1085..3bc1085 100644 --- a/build/latex/.envrc +++ b/build/latex/academia/.envrc diff --git a/build/latex/.gitignore b/build/latex/academia/.gitignore index 539b891..539b891 100644 --- a/build/latex/.gitignore +++ b/build/latex/academia/.gitignore diff --git a/build/latex/academia/.reuse/templates/default.jinja2 b/build/latex/academia/.reuse/templates/default.jinja2 new file mode 100644 index 0000000..688bffc --- /dev/null +++ b/build/latex/academia/.reuse/templates/default.jinja2 @@ -0,0 +1,2 @@ +%INIT_REUSE_TEMPLATE +<!-- vim: ft=htmldjango --> diff --git a/build/latex/LICENSE b/build/latex/academia/LICENSE index dbb2b35..dbb2b35 100644 --- a/build/latex/LICENSE +++ b/build/latex/academia/LICENSE diff --git a/build/latex/README.md b/build/latex/academia/README.md index ffa08c2..ffa08c2 100644 --- a/build/latex/README.md +++ b/build/latex/academia/README.md diff --git a/build/latex/build.sh b/build/latex/academia/build.sh index 1206ee7..1206ee7 100755 --- a/build/latex/build.sh +++ b/build/latex/academia/build.sh diff --git a/build/latex/cog.toml b/build/latex/academia/cog.toml index ccca764..ccca764 100644 --- a/build/latex/cog.toml +++ b/build/latex/academia/cog.toml diff --git a/build/latex/content/static/title.tex b/build/latex/academia/content/static/title.tex index e4a833d..e4a833d 100644 --- a/build/latex/content/static/title.tex +++ b/build/latex/academia/content/static/title.tex diff --git a/build/latex/flake.lock b/build/latex/academia/flake.lock index e095a79..1d384fd 100644 --- a/build/latex/flake.lock +++ b/build/latex/academia/flake.lock @@ -104,17 +104,17 @@ ] }, "locked": { - "lastModified": 1711915832, - "narHash": "sha256-5vFraJ2xnDvuEI2zeUbre8amzVDLAneODNNdJb6HSZk=", + "lastModified": 1718253944, + "narHash": "sha256-22AP7h3Utx7xfJ7uyPWH2f6B6xFysCYgPQhNonTeEQ4=", "ref": "refs/heads/prime", - "rev": "67f3079cd49deb116ba215244e7a1a1575a71ede", - "revCount": 10, + "rev": "7ea10db20a83eedffd69a8c8824e14992ada3e10", + "revCount": 20, "type": "git", - "url": "https://codeberg.org/Soispha/lpm.git" + "url": "https://codeberg.org/bpeetz/lpm.git" }, "original": { "type": "git", - "url": "https://codeberg.org/Soispha/lpm.git" + "url": "https://codeberg.org/bpeetz/lpm.git" } }, "nixpkgs": { diff --git a/build/latex/flake.nix b/build/latex/academia/flake.nix index efc4f3f..1e0969e 100644 --- a/build/latex/flake.nix +++ b/build/latex/academia/flake.nix @@ -19,7 +19,7 @@ }; }; lpm = { - url = "git+https://codeberg.org/Soispha/lpm.git"; + url = "git+https://codeberg.org/bpeetz/lpm.git"; inputs = { nixpkgs.follows = "nixpkgs"; flake-compat.follows = "flake-compat"; diff --git a/build/latex/headers/preamble.tex b/build/latex/academia/headers/preamble.tex index bc8aa8a..bc8aa8a 100644 --- a/build/latex/headers/preamble.tex +++ b/build/latex/academia/headers/preamble.tex diff --git a/build/latex/headers/preamble_local.tex b/build/latex/academia/headers/preamble_local.tex index e69de29..e69de29 100644 --- a/build/latex/headers/preamble_local.tex +++ b/build/latex/academia/headers/preamble_local.tex diff --git a/build/latex/init b/build/latex/academia/init index f416b34..edb0d1e 100644 --- a/build/latex/init +++ b/build/latex/academia/init @@ -51,8 +51,8 @@ git init # 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/\([a-z]*\)/\u\1/')" -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/\([a-z]*\)/\U\1(1)/')" "dont_ask" +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)" @@ -60,59 +60,50 @@ prompt AUTHOR_EMAIL "The email of the author (or authors)" "$(git config --get u # cog change-log variables prompt REMOTE "The remote, this project will be pushed to" "git.vhack.eu" -prompt REPOSITORY "The name of the repository in the remote" "$APPLICATION_NAME" +prompt REPOSITORY "The path of the repository on the remote" "$APPLICATION_NAME" prompt OWNER "The name of owner of the repository" "$AUTHOR_NAME" # nice meta data -prompt DESCRIPTION "The description of this project" "[can be empty]" +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" -# LICENSE.spdx data (source: https://github.com/david-a-wheeler/spdx-tutorial) if [ -e ./lpm.toml ]; then # Use a different default license in latex projects. init_default_license="CC-BY-SA-4.0" else - init_default_license="GPL-3.0-or-later" + init_default_license="AGPL-3.0-or-later" fi -prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" -prompt APPLICATION_ORIGINATOR "The person or organization from whom the package originally came" "$AUTHOR_NAME" -prompt APPLICATION_HOME_PAGE "The package's home page URL" "https://$REMOTE/$OWNER/$REPOSITORY" - -echo "Downloading license .." -case "$SPDX_LICENSE_IDENTIFIER" in -"AGPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/agpl-3.0.txt" - curl "$default_license_url" >COPYING - ;; -"GPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/gpl-3.0.txt" - curl "$default_license_url" >COPYING - ;; -"LGPL-3.0-or-later") - default_license_url="https://www.gnu.org/licenses/lgpl+gpl-3.0.txt" - curl "https://www.gnu.org/licenses/gpl-3.0.txt" >COPYING - curl "https://www.gnu.org/licenses/lgpl-3.0-standalone.html" >COPYING.LESSER - ;; - -"Apache-2.0") - default_license_url="https://www.apache.org/licenses/LICENSE-2.0.txt" - curl "$default_license_url" >LICENSE - ;; - -"CC-BY-SA-4.0") - default_license_url="https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt" - curl "$default_license_url" >LICENSE - ;; - -*) - default_license_url="file:///dev/null" - echo " -> No license found for your identifier: '$SPDX_LICENSE_IDENTIFIER'" - ;; -esac - -prompt LICENSE_URL "The url of the license" "$default_license_url" "dont_ask" +prompt SPDX_LICENSE_IDENTIFIER "THE SPDX identifer of your choosen license" "$init_default_license" "dont_ask" + +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" +prompt REUSE_TEMPLATE "The template used in reuse annotate" "$( + cat <<EOF | fmt --uniform-spacing --width=75 +{% 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. + +You should have received a copy of the License along with this program. +If not, see <$LICENSE_URL>. +EOF +)" "dont_ask" echo "$DESCRIPTION" >.git/description diff --git a/build/latex/lpm.toml b/build/latex/academia/lpm.toml index 636eae9..0925886 100644 --- a/build/latex/lpm.toml +++ b/build/latex/academia/lpm.toml @@ -1,10 +1,8 @@ -[last_chapter] -user_name = "static" -number = 0 +main_file = "%INIT_APPLICATION_NAME.tex" [templates] section = ''' -%! TEX root = ../../../%INIT_APPLICATION_NAME +%! TEX root = ../../../%INIT_APPLICATION_NAME.tex % LTeX: language=en-GB \section{REPLACMENT_SECTION_TITLE} % DATE @@ -12,7 +10,7 @@ This is some text ''' chapter = ''' -%! TEX root = ../../%INIT_APPLICATION_NAME +%! TEX root = ../../%INIT_APPLICATION_NAME.tex % LTeX: language=en-GB \chapter{REPLACEMENT_CHAPTER} diff --git a/build/latex/academia/possible_resources_for_v3_template.txt b/build/latex/academia/possible_resources_for_v3_template.txt new file mode 100644 index 0000000..4232d52 --- /dev/null +++ b/build/latex/academia/possible_resources_for_v3_template.txt @@ -0,0 +1,15 @@ +https://davidcarlisle.github.io/uk-tex-faq/ +https://ctan.org/tex-archive/info/knuth-pdf +https://www.ctan.org/pkg/texinfo +https://davidcarlisle.github.io/uk-tex-faq/FAQ-LaTeX2HTML.html +https://www.w3.org/Tools/Word_proc_filters.html +https://davidcarlisle.github.io/uk-tex-faq/FAQ-mathml.html +-- +https://ctan.org/pkg/l3kernel +https://stackoverflow.com/questions/2918449/inlining-the-latex-input-command +https://ctan.org/tex-archive/support/flatten +https://ctan.org/tex-archive/support/flatex +http://www.math.tau.ac.il/~sariel/flatex.html +https://mirror.funkfreundelandshut.de/latex/macros/latex/required/l3kernel/expl3.pdf +https://tex.stackexchange.com/questions/24932/moving-to-latex3-for-package-authors +https://ctan.org/pkg/l3packages diff --git a/build/latex/references/reference.bib b/build/latex/academia/references/reference.bib index e69de29..e69de29 100644 --- a/build/latex/references/reference.bib +++ b/build/latex/academia/references/reference.bib diff --git a/build/latex/academia/scripts/cprh.sh b/build/latex/academia/scripts/cprh.sh new file mode 100755 index 0000000..9582575 --- /dev/null +++ b/build/latex/academia/scripts/cprh.sh @@ -0,0 +1,57 @@ +#! /usr/bin/env sh + +die() { + echo "$@" 1>&2 + exit 1 +} + +help() { + cat <<EOF +A copyright header managment tool. + +USAGE: + cprh.sh [OPTIONS] contribute NAME EMAIL FILE.. + +OPTIONS: + --help | -h + Display this help and exit. + +ARGUMENTS: + NAME := [[git config user.name]] + Your name. + + NAME := [[git config user.email]] + Your email address. + + FILE := [[git diff --name-only --cached]] + The file you want to change. This can be given multiple times. +EOF +} + +for arg in "$@"; do + case "$arg" in + "--help" | "-h") + help + exit 0 + ;; + *) + echo "'$1' is not a recognized option. See --help for more!" 1>&2 + exit 1 + ;; + esac +done + +user_name="$1" +[ -z "$user_name" ] && die "No NAME set! See --help for more" + +user_email="$2" +[ -z "$user_email" ] && die "No EMAIL set! See --help for more" +shift 2 + +styleOne="" +styleTwo="" +[ "$COMMENT_STYLE" ] && styleOne="--style" && styleTwo="$COMMENT_STYLE" + +# The styleTwo must be unquoted to avoid adding empty args to reuse +# shellcheck disable=2086 +reuse annotate --copyright "$user_name <$user_email>" --copyright-prefix string-c --template default --multi-line $styleOne $styleTwo diff --git a/build/latex/scripts/extract_text_from_all.sh b/build/latex/academia/scripts/extract_text_from_all.sh index 11b2ac4..11b2ac4 100755 --- a/build/latex/scripts/extract_text_from_all.sh +++ b/build/latex/academia/scripts/extract_text_from_all.sh diff --git a/build/latex/shell_line_editor.sh b/build/latex/academia/shell_line_editor.sh index 8d6833a..8d6833a 100644 --- a/build/latex/shell_line_editor.sh +++ b/build/latex/academia/shell_line_editor.sh diff --git a/build/latex/treefmt.nix b/build/latex/academia/treefmt.nix index 794e8fc..794e8fc 100644 --- a/build/latex/treefmt.nix +++ b/build/latex/academia/treefmt.nix diff --git a/build/latex/update.sh b/build/latex/academia/update.sh index 49216b8..49216b8 100755 --- a/build/latex/update.sh +++ b/build/latex/academia/update.sh diff --git a/build/latex/academia/watch.sh b/build/latex/academia/watch.sh new file mode 100755 index 0000000..e5147f2 --- /dev/null +++ b/build/latex/academia/watch.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env sh + +help() { + cat <<EOF +An simple watch script, useful to see the changes in the document as it evolves. + +USAGE: + watch.sh [OPTIONS] [COMMAND] + +OPTIONS: + --help | -h + Display this help and exit. + + --open [READER] | -o [READER] + Open the build PDF in READER before waiting for changes. + READER defaults to the READER environment variable or + 'zathura' if the env variable is unset. + --sleeptime [T] | -s [T] + How long to sleep between each build attempt in seconds. The + time defaults to 10 seconds. +ARGUMENTS: + READER := [[echo "\${READER-zathura}"]] + The reader to open the build PDF with. + + T := [[seq 1 100]] + The time to sleep between each build attempt. +EOF +} + +reader="" +time="10" +for arg in "$@"; do + case "$arg" in + "--help" | "-h") + help + exit 0 + ;; + + "--open" | "-o") + shift 1 + reader="$1" + if [ -z "$reader" ]; then + reader="${READER-zathura}" + else + shift 1 + fi + ;; + + "--sleeptime" | "-s") + shift 1 + time="$1" + if [ -z "$time" ]; then + time=10 + else + shift 1 + fi + ;; + *) + echo "'$1' is not a recognized option! See '--help' for more detail." 1>&2 + exit 1 + ;; + esac +done + +[ -n "$reader" ] && "$reader" ./build/%INIT_APPLICATION_NAME.pdf & + +while true; do + ./build.sh + sleep "$time" +done |