From 49c1436c37a015d8e47cdc1c29f120cb42d0eb17 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 15 Jul 2023 14:04:54 +0300 Subject: Mastadon verification support --- lib/html.source.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/html.source.sh b/lib/html.source.sh index b60ac75..371866a 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -71,7 +71,12 @@ html::make_link () { descr="$link" fi - echo "$descr
" + local mastadon_verify='' + if [[ "$link" = "$MASTADON_URI" ]]; then + mastadon_verify=" rel='me'" + fi + + echo "$descr
" } html::process_inline () { @@ -192,6 +197,8 @@ $line" # Test default HTML variant. html::test::default () { + MASTADON_URI='' + local line='Hello world! This is a paragraph.' assert::equals "$(html::make_paragraph "$line")" '

Hello world! This is a paragraph.

' @@ -227,6 +234,13 @@ html::test::default () { assert::equals "$(generate::make_link html "$line")" \ "Description of the link
" + # Test Mastadon verification. + MASTADON_URI='https://fosstodon.org/@snonux' + line='=> https://fosstodon.org/@snonux Me at Mastadon' + assert::equals "$(generate::make_link html "$line")" \ + "Me at Mastadon
" + MASTADON_URI='' + line='=> http://example.org/image.png' assert::equals "$(generate::make_link html "$line")" \ "
" @@ -235,6 +249,7 @@ html::test::default () { assert::equals "$(generate::make_link html "$line")" \ "Image description
" + local input_block='``` this is -- cgit v1.2.3