From 4393288f44a9f318f88d1857e85ea8c57ceb3009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 11 Oct 2022 01:22:15 +0200 Subject: Force current filters. --- hugo-pre.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 hugo-pre.sh (limited to 'hugo-pre.sh') diff --git a/hugo-pre.sh b/hugo-pre.sh new file mode 100755 index 0000000..cd303ec --- /dev/null +++ b/hugo-pre.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +name=$1 + +extension=${name: -3} + +case $extension in + .md) pandoc -f gfm -t html ;; + *) + cat <<- EOF +
$(cat -)
+ EOF + ;; +esac + +prel_head="$(grep -Eo 'h=([-A-Za-z0-9.~_+]|%[A-Fa-f0-9]{2})*' <<< "$REQUEST_URI")" +if [ $? -eq 0 ]; then + head=$(cut -c 3- <<< "$prel_head") +else + head=$CGIT_REPO_DEFBRANCH +fi + +echo "
" +echo "
"
+cloc --git "$head" --quiet --md | pandoc -f gfm -t html
+echo "
" -- cgit v1.2.3