diff options
author | David Oberhollenzer <goliath@infraroot.at> | 2020-03-17 16:10:23 +0100 |
---|---|---|
committer | David Oberhollenzer <goliath@infraroot.at> | 2020-06-28 17:18:45 +0200 |
commit | bb34d2b128ebc1b95f7cbd40876689707eb1e1e0 (patch) | |
tree | 2262dd6c1332e5526700ecb8e138daca8a1c7bd3 /util |
Initial commit
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'util')
-rwxr-xr-x | util/copyright.sh | 24 | ||||
-rwxr-xr-x | util/sitemap.sh | 14 |
2 files changed, 38 insertions, 0 deletions
diff --git a/util/copyright.sh b/util/copyright.sh new file mode 100755 index 0000000..a21caf9 --- /dev/null +++ b/util/copyright.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +filename="$1" + +git log --follow --pretty=format:"%ad,%an" --date="format:%Y" -- "$filename" |\ +awk -F, '{ + if (length(min[$2]) == 0) { + min[$2] = max[$2] = $1 + } else { + max[$2]=$1 > max[$2] ? $1 : max[$2] + min[$2]=$1 < min[$2] ? $1 : min[$2] + } + }END{ + for (a in max) + print a "," min[a] "," max[a] + }' |\ +sort --field-separator=',' --key=3 --reverse |\ +awk -F, '{ + if ($2 == $3) { + print "Copyright © " $2 " " $1 "<br/>" + } else { + print "Copyright © " $2 "-" $3 " " $1 "<br/>" + } +}' diff --git a/util/sitemap.sh b/util/sitemap.sh new file mode 100755 index 0000000..643ed44 --- /dev/null +++ b/util/sitemap.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +url="${1%/}" +mdpath="$2" +htmlpath="${3#/}" + +date=$(git log -1 --format=%cs "$mdpath") + +cat <<_EOF +<url> +<loc>$(echo $url/$htmlpath)</loc> +<lastmod>$date</lastmod> +</url> +_EOF |