diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2022-01-05 16:55:59 +0100 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2022-01-05 16:55:59 +0100 |
commit | be1a57a5e1f84fe3d738207dbae220666a352089 (patch) | |
tree | cd4f692accd53010a75552b1cc6f04cebd7248dd | |
parent | 1c5ce25395046190d9a07bc62b96754c0cb6e47d (diff) | |
download | rgoncalves.se-be1a57a5e1f84fe3d738207dbae220666a352089.tar.gz |
bin/func: Serialize h1 html id for w3c validator
-rw-r--r-- | bin/func | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |