aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-05 16:15:20 -0300
committerEuAndreh <eu@euandre.org>2023-04-05 16:15:20 -0300
commitfcbc152cc14143a5a1538d3f77db05d1a3012ab0 (patch)
tree6f0043aad11edc46de7acc00842f80077c569fa7
parentv2: Support Atom feeds and collection translations (diff)
downloadeuandre.org-fcbc152cc14143a5a1538d3f77db05d1a3012ab0.tar.gz
euandre.org-fcbc152cc14143a5a1538d3f77db05d1a3012ab0.tar.xz
v2: src/bin/conf: s/escape/shesc/
-rwxr-xr-xv2/src/bin/conf14
1 files changed, 7 insertions, 7 deletions
diff --git a/v2/src/bin/conf b/v2/src/bin/conf
index ac02d98..ce44881 100755
--- a/v2/src/bin/conf
+++ b/v2/src/bin/conf
@@ -69,7 +69,7 @@ FILENAME="${1:-}"
eval "$(assert_arg "$FILENAME" 'FILENAME')"
-escape() {
+shesc() {
sed 's|\([`"$]\)|\\\1|g'
}
@@ -88,7 +88,7 @@ while read -r line; do
fi
KEY="$( printf '%s' "$line" | cut -d: -f1)"
- VALUE="$(printf '%s' "$line" | cut -d: -f2- | sed 's|^ ||' | escape)"
+ VALUE="$(printf '%s' "$line" | cut -d: -f2- | sed 's|^ ||' | shesc)"
printf 'export %s="%s"\n' "$KEY" "$VALUE"
done < "$FILENAME" | tee -a "$FILENAME".tmp
# shellcheck source=/dev/null
@@ -105,7 +105,7 @@ cat src/lib/base."${lang:?}".conf
. src/lib/base."$lang".conf
if [ -z "${title:-}" ]; then
title="${site_name:?}"
- printf 'export title="%s"\n' "$(printf '%s' "$title" | escape)"
+ printf 'export title="%s"\n' "$(printf '%s' "$title" | shesc)"
fi
if [ -n "${date:-}" ]; then
@@ -114,7 +114,7 @@ if [ -n "${date:-}" ]; then
formatted_date="$(LANG="$lang" date -ud "${date:?}" +"${date_fmt:?}")"
export formatted_date
- printf 'export date_html="%s"\n' "$(envsubst < src/lib/date."$lang".html | escape)"
+ printf 'export date_html="%s"\n' "$(envsubst < src/lib/date."$lang".html | shesc)"
echo "${FILENAME%.md}.xmlentry" > "$(dirname "$FILENAME")/$date_iso.sortdata"
touch "${FILENAME%.md}.sortref"
@@ -126,7 +126,7 @@ if [ -n "${update:-}" ]; then
formatted_update="$(LANG="$lang" date -ud "${update:?}" +"${date_fmt:?}")"
export formatted_update
- printf 'export update_html="%s"\n' "$(envsubst < src/lib/update."$lang".html | escape)"
+ printf 'export update_html="%s"\n' "$(envsubst < src/lib/update."$lang".html | shesc)"
printf 'export update_xml=" <updated>%s</updated>"\n' "$update_iso"
fi
@@ -135,7 +135,7 @@ fi
url_part="$(printf '%s' "${FILENAME%.md}.html" | sed "s|^$CONTENT_PREFIX||")"
title_uri="$(uri "$title")"
-printf 'export title_html="%s"\n' "$(printf '%s' "$title" | htmlesc | escape)"
+printf 'export title_html="%s"\n' "$(printf '%s' "$title" | htmlesc | shesc)"
printf 'export filename="%s"\n' "$FILENAME"
printf 'export url_part="%s"\n' "$url_part"
printf 'export url="%s"\n' "$(url-for "$url_part" | absolute)"
@@ -162,5 +162,5 @@ if [ "${layout:-}" = 'post' ]; then
export mailto_uri="$mailto_uri_prefix$title_uri"
export discussions_url="$discussions_url_prefix$title_uri"
export sourcecode_url="$sourcecode_url_prefix$FILENAME"
- printf 'export comment_html="%s"\n' "$(envsubst < src/lib/comment."$lang".html | escape)"
+ printf 'export comment_html="%s"\n' "$(envsubst < src/lib/comment."$lang".html | shesc)"
fi