fix(licensure): Add support for lua, svg and drawio files

This commit is contained in:
Benedikt Peetz 2024-05-04 20:56:31 +02:00
parent 6c80698589
commit d7e4159a26
2 changed files with 20 additions and 2 deletions

View File

@ -135,6 +135,22 @@ comments:
comment_char: "//" comment_char: "//"
trailing_lines: 1 trailing_lines: 1
- extensions:
- lua
# The commenter field defines the kind of commenter to
# generate. There are two types of commenters: line and block.
#
# This demonstrates a line commenter configuration. A line
# commenter type will apply the comment_char to the beginning of
# each line in the license header. It will then apply a number of
# empty newlines to the end of the header equal to trailing_lines.
#
# If trailing_lines is omitted it is assumed to be 0.
commenter:
type: line
comment_char: "--"
trailing_lines: 1
- extensions: - extensions:
- rs - rs
- tri - tri
@ -161,6 +177,8 @@ comments:
- extension: - extension:
- html - html
- md - md
- svg
- drawio
commenter: commenter:
type: block type: block
start_block_char: "<!--\n" start_block_char: "<!--\n"

4
scripts/renew_copyright_header.sh Executable file → Normal file
View File

@ -41,7 +41,7 @@ remove() {
# formatters do weird things to the file # formatters do weird things to the file
case "$extension" in case "$extension" in
# normal '#' comments (these are $TEMPLATE_LINE_LENGTH lines long) # normal '#' comments (these are $TEMPLATE_LINE_LENGTH lines long)
"Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk") "Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk" | "lua")
sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file" sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file"
;; ;;
# LaTeX files (or TeX files in general) have a different license, use the # LaTeX files (or TeX files in general) have a different license, use the
@ -50,7 +50,7 @@ remove() {
sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file" sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file"
;; ;;
# normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long) # normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long)
"c" | "h" | "md" | "rs") "c" | "h" | "md" | "rs" | "html" | "svg" | "drawio")
length="$((TEMPLATE_LINE_LENGTH + 2))" length="$((TEMPLATE_LINE_LENGTH + 2))"
sed --in-place "1,${length}d;" "$file" sed --in-place "1,${length}d;" "$file"
;; ;;