X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=helpers.sh;fp=helpers.sh;h=c90e077dc9a37dc444c9a2d778d045fcc1c11e20;hb=58272f437f554daa14ac1dfdf9902d48c17841bf;hp=0000000000000000000000000000000000000000;hpb=41db49b35f4622e7caa7aecd9b814d8a760fc259;p=redo-blog diff --git a/helpers.sh b/helpers.sh new file mode 100644 index 0000000..c90e077 --- /dev/null +++ b/helpers.sh @@ -0,0 +1,19 @@ +#!/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" +}