aboutsummaryrefslogtreecommitdiffstats
path: root/bin/func
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2022-01-05 16:55:59 +0100
committerRomain Gonçalves <me@rgoncalves.se>2022-01-05 16:55:59 +0100
commitbe1a57a5e1f84fe3d738207dbae220666a352089 (patch)
treecd4f692accd53010a75552b1cc6f04cebd7248dd /bin/func
parent1c5ce25395046190d9a07bc62b96754c0cb6e47d (diff)
downloadrgoncalves.se-be1a57a5e1f84fe3d738207dbae220666a352089.tar.gz
bin/func: Serialize h1 html id for w3c validator
Diffstat (limited to 'bin/func')
-rw-r--r--bin/func7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/func b/bin/func
index 62d65a0..f637749 100644
--- a/bin/func
+++ b/bin/func
@@ -22,6 +22,10 @@ date_default_timezone="+0200"
uname=$(uname)
+__to_html_id() {
+ cat /dev/stdin | sed 's/ /%20/g'
+}
+
__get_value() {
# 1: filename
# 2: Attribute name
@@ -202,9 +206,10 @@ __generate_metadata() {
if [ "${_show_title}" = "" ]; then
_title=$(__get_value_title "${1}")
+ _title_id=$(echo ${_title} | __to_html_id)
cat <<-EOF
- <h1 id=\"${_title}\">
+ <h1 id="${_title_id}">
${_title}
</h1>
EOF
remember that computers suck.