home · contact · privacy
Merge branch 'master' of github.com:plomlompom/redo-blog
[redo-blog] / processor / helpers.sh
1 #!/bin/sh
2
3 escape_html()
4 {
5 out=`python3 -c 'import sys, html; print(html.escape(sys.argv[1]))' "$1"`
6 printf "%s" "$out"
7 }
8
9 read_and_escape_file()
10 {
11 in=`cat "$1"`
12 escape_html "$in"
13 }
14
15 escape_url()
16 {
17 out=`python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$1"`
18 printf "%s" "$out"
19 }