diff options
| author | Paul Buetow <paul@buetow.org> | 2023-05-25 20:08:41 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-05-25 20:08:41 +0300 |
| commit | 3eae6a19aafd77ef5c928d60621529b58797b2f6 (patch) | |
| tree | 3af8d524a9da1129260a765c1f5598c3203134da /lib/html.source.sh | |
| parent | f4e43219ae107b7ddbd8fbb1c7238d03530a8b11 (diff) | |
| parent | 92b8b8721700cd47d7fef2ba64f166f45c797ca2 (diff) | |
Merge branch 'develop' of codeberg.org:snonux/gemtexter into develop
Diffstat (limited to 'lib/html.source.sh')
| -rw-r--r-- | lib/html.source.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/html.source.sh b/lib/html.source.sh index 7056f24..b60ac75 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -4,6 +4,7 @@ html::encode () { s|\&|\&|g; s|<|\<|g; s|>|\>|g; + s|'\''|\'|g; ' <<< "$@" } @@ -70,7 +71,7 @@ html::make_link () { descr="$link" fi - echo "<a class='textlink' href='$link'>$descr</a><br />" + echo "<a class='textlink' href='$(html::encode "$link")'>$descr</a><br />" } html::process_inline () { @@ -214,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'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 />" |
