diff options
Diffstat (limited to 'md.sh')
-rwxr-xr-x | md.sh | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -5,8 +5,9 @@ set -e # ./md.sh <target dir> # ./md.sh <input md> <output html> # -# target dir: input `src.md`, output `index.html` -# dependencies: lowdown, fzf, python (for now) +# input: <target dir>/src.md ; ./md-header ; ./md-footer +# output: <target dir>/index.html +# dependencies: lowdown, fzf, ./urlencode # Copyright 2019-2020 DistressNetwork° <uplink@distress.network> # @@ -57,8 +58,8 @@ unesc() { sed -e 's;\\\&;\&;g' -e 's/\\\;/;/g' } -encode() ( # TODO: python't - python -c "import urllib, sys; print urllib.quote(sys.argv[1])" "$1" +encode() ( + ./urlencode ) decode() { @@ -118,7 +119,7 @@ tmp=$(mktemp -p /tmp) # using a tempfile, more convenient for storage and operat TOCLIST=$(grep -e '^#' $IN | sed -e 's; ;- ;' -e 's;^#;;' -e 's;#; ;g') # headers from source as md list echo "$TOCLIST" | while IFS='' read -r data ; do # encode headers as urls - HEADER=$(echo "$data" | sed 's/^[[:space:]-]*//' | encode "$(cat /dev/stdin)") ; + HEADER=$(echo "$data" | sed 's/^[[:space:]-]*//' | encode) ; echo "$data" | sed "s/^\([[:space:]-]*\)\(.*\)$/\1${HEADER}/" >> $tmp ; done |