summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-05-08 01:00:53 +0300
committerPaul Buetow <paul@buetow.org>2023-05-08 01:00:53 +0300
commit92b8b8721700cd47d7fef2ba64f166f45c797ca2 (patch)
treee2a65622215ec7685d85e149445c5956c9830de2
parentb9a748dafccc7f28aa695d3590be952560eedb35 (diff)
test the proper encoding of ' as well
-rw-r--r--lib/html.source.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/html.source.sh b/lib/html.source.sh
index 8f057a0..b60ac75 100644
--- a/lib/html.source.sh
+++ b/lib/html.source.sh
@@ -71,7 +71,7 @@ html::make_link () {
descr="$link"
fi
- echo "<a class='textlink' href='$($SED 's/'\''/\&#39;/g' <<< "$link")'>$descr</a><br />"
+ echo "<a class='textlink' href='$(html::encode "$link")'>$descr</a><br />"
}
html::process_inline () {
@@ -215,6 +215,10 @@ html::test::default () {
assert::equals "$(generate::make_link html "$line")" \
"<a class='textlink' href='https://example.org'>https://example.org</a><br />"
+ line="=> https://example.org/foo'bar"
+ assert::equals "$(generate::make_link html "$line")" \
+ "<a class='textlink' href='https://example.org/foo&#39;bar'>https://example.org/foo'bar</a><br />"
+
line='=> index.html'
assert::equals "$(generate::make_link html "$line")" \
"<a class='textlink' href='index.html'>index.html</a><br />"