30 lines
751 B
Bash
30 lines
751 B
Bash
#! /bin/bash
|
|
|
|
if ! which tpl; then
|
|
go install github.com/bluebrown/go-template-cli/cmd/tpl@latest
|
|
fi &> /dev/null
|
|
if ! which gojq; then
|
|
go install github.com/itchyny/gojq@latest
|
|
fi &> /dev/null
|
|
|
|
html_escape_str() {
|
|
local str="$1"
|
|
for i in $(seq 0 $(("${#str}"-1))); do
|
|
LC_CTYPE=C printf '&#%d;' "'"${1:i:1}
|
|
done
|
|
}
|
|
html_escape_str contact@blapointe.com
|
|
|
|
while sleep 1; do
|
|
cat ./homebrew.yaml \
|
|
| sed "s/@/$(html_escape_str @ | sed 's/\&/\\\&/g')/g" \
|
|
| sed "s/mailto:/$(html_escape_str mailto: | sed 's/\&/\\\&/g')/g" \
|
|
| sed "s/tel:/$(html_escape_str tel: | sed 's/\&/\\\&/g')/g" \
|
|
| gojq --yaml-input . \
|
|
| tpl --file homebrew.tmpl \
|
|
> ./homebrew.html.2
|
|
mv ./homebrew.html.2 ./homebrew.html
|
|
date
|
|
done
|
|
|