From 4bb8750480c92ae90dd3498cb5bc8cf3c7cacd02 Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Sun, 23 Feb 2020 16:00:42 +0100 Subject: Integrate the scripts and plugins used by soupault in Soupault.org --- scripts/generate_history.sh | 54 --------------------------------------------- scripts/katex.js | 10 --------- 2 files changed, 64 deletions(-) delete mode 100755 scripts/generate_history.sh delete mode 100644 scripts/katex.js (limited to 'scripts') diff --git a/scripts/generate_history.sh b/scripts/generate_history.sh deleted file mode 100755 index cc70d55..0000000 --- a/scripts/generate_history.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/bash - -FORMAT="{\"subject\":\"%s\",\"abbr_hash\":\"%h\",\"hash\":\"%H\",\"date\":\"%cs\"" - -function generate_history_json () { - local file="${1}" - - local logs=$(git --no-pager log --follow --pretty=format:"${FORMAT}" "${file}") - - if [ ! $? -eq 0 ]; then - exit 1 - fi - - local count=0 - local name="${file}" - - while read -r line; do - local hash=$(echo "${line}}" | jq -j '.hash') - - local pre_name="$(git --no-pager show --stat=10000 ${hash} | sed -e 's/ *\(.*\){\(.*\) => \(.*\)}/\1\2 => \1\3/' | grep "=> ${name}" | xargs | cut -d' ' -f1)" - - if [[ ${count} -eq 0 ]]; then - echo -n "[ " - else - echo -n ", " - fi - - echo "${line}, \"filename\":\"${name}\"}" - - if [[ ! -z "${pre_name}" ]]; then - name="$(echo ${pre_name})" - fi - - count=$(( ${count} + 1 )) - done < <(echo "${logs}") - - echo -n "]" -} - -function generate_json () { - local file="${1}" - - echo "{" - echo " \"file\" : \"${file}\"," - echo " \"history\" : $(generate_history_json "${file}")" - echo "}" -} - -FILE=`cat` - -tmp_file=$(mktemp) -generate_json ${FILE} > ${tmp_file} -haskell-mustache ${1} ${tmp_file} -rm ${tmp_file} diff --git a/scripts/katex.js b/scripts/katex.js deleted file mode 100644 index b3f6925..0000000 --- a/scripts/katex.js +++ /dev/null @@ -1,10 +0,0 @@ -/* Render inline maths using KaTeX */ -var katex = require("katex"); -var fs = require("fs"); -var input = fs.readFileSync(0); - -var html = katex.renderToString(String.raw`${input}`, { - throwOnError: false -}); - -console.log(html) -- cgit v1.2.3