X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=processor%2F.meta%2Fhelpers.sh;fp=processor%2F.meta%2Fhelpers.sh;h=0000000000000000000000000000000000000000;hb=b86576c5f61cff36c80c9e0efd9d77f50dac745b;hp=20905ab6a9e5f06eb01763088ad2e4310784fabb;hpb=c67421732e148c768cc83395c143480b2b9b6106;p=redo-blog diff --git a/processor/.meta/helpers.sh b/processor/.meta/helpers.sh deleted file mode 100644 index 20905ab..0000000 --- a/processor/.meta/helpers.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -escape_html() { - out=`python3 -c 'import sys, html; print(html.escape(sys.argv[1]))' "$1"` - printf "%s" "$out" -} - -read_and_escape_file() { - in=`cat "$1"` - escape_html "$in" -} - -escape_url() { - out=`python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$1"` - printf "%s" "$out" -} - -get_basepath() { - url_file="$1"url - redo-ifchange "$url_file" - base_url=`cat "$url_file" | head -1` - url_protocol=`echo $base_url | cut -d ':' -f 1` - url_basepath=`echo $base_url | cut -d '/' -f 3-` - url_basepath_escaped=`escape_url "$url_basepath"` - basepath="$url_protocol""://""$url_basepath_escaped" - echo "$basepath" -} - -get_source_file() { - md_file="../${1%.*}.md" - rst_file="../${1%.*}.rst" - if [ -f "$rst_file" ]; then - src_file="$rst_file" - elif [ -f "$md_file" ]; then - src_file="$md_file" - else - exit 1 - fi - redo-ifchange "$src_file" - printf "$src_file" -}