summaryrefslogtreecommitdiff
path: root/files/filters/hugo-pre.sh
diff options
context:
space:
mode:
Diffstat (limited to 'files/filters/hugo-pre.sh')
-rwxr-xr-xfiles/filters/hugo-pre.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/files/filters/hugo-pre.sh b/files/filters/hugo-pre.sh
index b716525..cd303ec 100755
--- a/files/filters/hugo-pre.sh
+++ b/files/filters/hugo-pre.sh
@@ -13,3 +13,14 @@ case $extension in
;;
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 "<hr/>"
+echo "<pre>"
+cloc --git "$head" --quiet --md | pandoc -f gfm -t html
+echo "</pre>"