From c2b20568121db07fe4ba16703f7c319cd398939a Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 1 Apr 2024 13:09:06 +0200 Subject: fix(common/scripts/renew_copyright_header): Add support for TeX files --- common/scripts/renew_copyright_header.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/scripts/renew_copyright_header.sh b/common/scripts/renew_copyright_header.sh index edb0a65..4f424c3 100755 --- a/common/scripts/renew_copyright_header.sh +++ b/common/scripts/renew_copyright_header.sh @@ -3,6 +3,7 @@ # NOTE: This is the line length of the .licensure.yml header template **plus** the extra # line after the template comment. TEMPLATE_LINE_LENGTH=20 +LATEX_TEMPLATE_LINE_LENGTH=9 PROJECT_ROOT="$(git rev-parse --show-toplevel)" @@ -17,6 +18,11 @@ remove() { "Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk") sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file" ;; + # LaTeX files (or TeX files in general) have a different license, use the + # $LATEX_TEMPLATE_LINE_LENGTH variable. + "tex") + sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file" + ;; # normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long) "c" | "h" | "md" | "rs") length="$((TEMPLATE_LINE_LENGTH + 2))" @@ -66,7 +72,7 @@ if [ -f "$1" ]; then fi else fd --type file --hidden . | while read -r file; do - if grep --quiet 'SPDX-License-Identifier: GPL-3.0-or-later' "$file"; then + if grep --quiet 'SPDX-License-Identifier' "$file"; then filename="$(basename -- "$file")" extension="${filename##*.}" filename="${filename%.*}" -- cgit 1.4.1