From 2bd2e05538f77a1a82f5c2552da5eb4bce092c59 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 25 Aug 2024 23:33:04 +0300 Subject: remove deprecated html variant (the prev default one) and bump major gemtexter version --- gemtexter | 9 +--- gemtexter-paul.buetow.org.conf | 1 - gemtexter-snonux.foo.conf | 1 - gemtexter.conf | 1 - lib/html.source.sh | 106 ++++++++++++++++------------------------- 5 files changed, 41 insertions(+), 77 deletions(-) diff --git a/gemtexter b/gemtexter index 8b9438b..da7ba2c 100755 --- a/gemtexter +++ b/gemtexter @@ -5,7 +5,7 @@ declare -r ARG="$1"; shift declare CONTENT_FILTER="$1"; shift -declare -r VERSION=2.2.0 +declare -r VERSION=3.0.0 declare -r VERSION_DESCR='develop' declare -r GEMTEXTER="Gemtexter $VERSION-$VERSION_DESCR" declare -r DATE_FORMAT='--iso-8601=seconds' @@ -28,7 +28,6 @@ test -z "$GIT_COMMIT_MESSAGE" && GIT_COMMIT_MESSAGE='' test -z "$LOG_VERBOSE" && LOG_VERBOSE='' test -z "$PRE_GENERATE_HOOK" && PRE_GENERATE_HOOK='' test -z "$POST_PUBLISH_HOOK" && POST_PUBLISH_HOOK='' -test -z "$HTML_VARIANT" && HTML_VARIANT='' test -z "$MASTODON_URI" && MASTODON_URI='' test -z "$SOURCE_HIGHLIGHT_CSS" && SOURCE_HIGHLIGHT_CSS='' @@ -42,12 +41,6 @@ else source ./gemtexter.conf fi -if [[ -z "$HTML_VARIANT" ]]; then - export HTML_VARIANT_TO_USE=default -else - export HTML_VARIANT_TO_USE="$HTML_VARIANT" -fi - source ./lib/assert.source.sh source ./lib/atomfeed.source.sh source ./lib/gemfeed.source.sh diff --git a/gemtexter-paul.buetow.org.conf b/gemtexter-paul.buetow.org.conf index 7a80fe6..29875a2 100644 --- a/gemtexter-paul.buetow.org.conf +++ b/gemtexter-paul.buetow.org.conf @@ -10,7 +10,6 @@ declare -xr CONTENT_BASE_DIR=../paul.buetow.org-content declare -xr HTML_HEADER=./extras/html/header.html.part declare -xr HTML_FOOTER=./extras/html/footer.html.part declare -xr HTML_CSS_STYLE=./extras/html/style-business.css -declare -xr HTML_VARIANT=exact declare -xr HTML_WEBFONT_TEXT=./extras/html/fonts/Lato/Lato-Regular.ttf declare -xr HTML_WEBFONT_HEADING=./extras/html/fonts/Abril_Fatface/AbrilFatface-Regular.ttf declare -xr HTML_WEBFONT_CODE=./extras/html/fonts/hack/Hack-Regular.ttf diff --git a/gemtexter-snonux.foo.conf b/gemtexter-snonux.foo.conf index 23a3ad4..da30a99 100644 --- a/gemtexter-snonux.foo.conf +++ b/gemtexter-snonux.foo.conf @@ -9,7 +9,6 @@ declare -xr CONTENT_BASE_DIR=../snonux.foo-content declare -xr HTML_HEADER=./extras/html/header.html.part declare -xr HTML_FOOTER=./extras/html/footer.html.part declare -xr HTML_CSS_STYLE=./extras/html/style.css -declare -xr HTML_VARIANT=exact declare -xr HTML_WEBFONT_TEXT=./extras/html/fonts/roboto-slab/RobotoSlab-Regular.ttf declare -xr HTML_WEBFONT_CODE=./extras/html/fonts/hack/Hack-Regular.ttf declare -xr HTML_WEBFONT_HANDNOTES=./extras/html/fonts/khand/khand.ttf diff --git a/gemtexter.conf b/gemtexter.conf index 70ff853..80538b6 100644 --- a/gemtexter.conf +++ b/gemtexter.conf @@ -10,7 +10,6 @@ declare -xr POST_PUBLISH_HOOK=./post_publish_hook.sh declare -xr HTML_HEADER=./extras/html/header.html.part declare -xr HTML_FOOTER=./extras/html/footer.html.part declare -xr HTML_CSS_STYLE=./extras/html/style.css -declare -xr HTML_VARIANT=exact declare -xr HTML_WEBFONT_TEXT=./extras/html/fonts/Lato/Lato-Regular.ttf declare -xr HTML_WEBFONT_HEADING=./extras/html/fonts/Abril_Fatface/AbrilFatface-Regular.ttf declare -xr HTML_WEBFONT_CODE=./extras/html/fonts/hack/Hack-Regular.ttf diff --git a/lib/html.source.sh b/lib/html.source.sh index 540762d..832bada 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -12,14 +12,10 @@ html::encode () { html::make_paragraph () { local -r text="$1"; shift - if [ "$HTML_VARIANT_TO_USE" = exact ]; then - if [ -n "$text" ]; then - echo "$(html::encode "$text")
" - else - echo '
' - fi - elif [ -n "$text" ]; then - echo "

$(html::encode "$text")

" + if [ -n "$text" ]; then + echo "$(html::encode "$text")
" + else + echo '
' fi } @@ -29,21 +25,13 @@ html::make_heading () { local -r level="$1"; shift local -r id="$(generate::internal_link_id "$text")" - if [ "$HTML_VARIANT_TO_USE" = exact ]; then - echo "$(html::encode "$text")
" - else - echo "$(html::encode "$text")
" - fi + echo "$(html::encode "$text")
" } # Make a HTML quotation html::make_quote () { local -r quote="${1/> }" - if [ "$HTML_VARIANT_TO_USE" = exact ]; then - echo "$(html::encode "$quote")
" - else - echo "

$(html::encode "$quote")

" - fi + echo "$(html::encode "$quote")
" } # Make a HTML image @@ -177,11 +165,7 @@ html::fromgmi () { echo "
  • $(html::list::encode "${line/\* /}")
  • " | html::process_inline else is_list=no - if [ "$HTML_VARIANT_TO_USE" = exact ]; then - echo "
    " - else - echo "" - fi + echo "
    " fi continue @@ -232,24 +216,49 @@ $line" done } -# Test default HTML variant. -html::test::default () { +html::test () { + local line='Hello world! This is a paragraph.' + assert::equals "$(html::make_paragraph "$line")" "Hello world! This is a paragraph.
    " + + line='' + assert::equals "$(html::make_paragraph "$line")" '
    ' + + line='Foo &<>& Bar!' + assert::equals "$(html::make_paragraph "$line")" "Foo &<>& Bar!
    " + + line='echo foo 2>&1' + assert::equals "$(html::make_paragraph "$line")" "echo foo 2>&1
    " + + line='# Header 1' + local id='header-1' + assert::equals "$(html::make_heading "$line" 1)" "

    Header 1


    " + + line='## Header 2' + id='header-2' + assert::equals "$(html::make_heading "$line" 2)" "

    Header 2


    " + + line='### Header 3' + id='header-3' + assert::equals "$(html::make_heading "$line" 3)" "

    Header 3


    " + + line='> This is a quote' + assert::equals "$(html::make_quote "$line")" "This is a quote
    " MASTODON_URI='' - local line='Hello world! This is a paragraph.' - assert::equals "$(html::make_paragraph "$line")" '

    Hello world! This is a paragraph.

    ' + line='Hello world! This is a paragraph.' + assert::equals "$(html::make_paragraph "$line")" 'Hello world! This is a paragraph.
    ' line='' - assert::equals "$(html::make_paragraph "$line")" '' + assert::equals "$(html::make_paragraph "$line")" '
    ' line='Foo &<>& Bar!' - assert::equals "$(html::make_paragraph "$line")" '

    Foo &<>& Bar!

    ' + assert::equals "$(html::make_paragraph "$line")" 'Foo &<>& Bar!
    ' line='echo foo 2>&1' - assert::equals "$(html::make_paragraph "$line")" '

    echo foo 2>&1

    ' + assert::equals "$(html::make_paragraph "$line")" 'echo foo 2>&1
    ' line='> This is a quote' - assert::equals "$(html::make_quote "$line")" "

    This is a quote

    " + assert::equals "$(html::make_quote "$line")" "This is a quote
    " line='Testing: `hello_world.sh --debug` :-) `another one`!' assert::equals "$(echo "$line" | html::process_inline)" \ @@ -312,38 +321,3 @@ fi assert::contains "$(html::fromgmi <<< "$input_block")" 'GNU source-highlight' fi } - -# Test exact HTML variant. -html::test::exact () { - local line='Hello world! This is a paragraph.' - assert::equals "$(html::make_paragraph "$line")" "Hello world! This is a paragraph.
    " - - line='' - assert::equals "$(html::make_paragraph "$line")" '
    ' - - line='Foo &<>& Bar!' - assert::equals "$(html::make_paragraph "$line")" "Foo &<>& Bar!
    " - - line='echo foo 2>&1' - assert::equals "$(html::make_paragraph "$line")" "echo foo 2>&1
    " - - line='# Header 1' - local id='header-1' - assert::equals "$(html::make_heading "$line" 1)" "

    Header 1


    " - - line='## Header 2' - id='header-2' - assert::equals "$(html::make_heading "$line" 2)" "

    Header 2


    " - - line='### Header 3' - id='header-3' - assert::equals "$(html::make_heading "$line" 3)" "

    Header 3


    " - - line='> This is a quote' - assert::equals "$(html::make_quote "$line")" "This is a quote
    " -} - -html::test () { - HTML_VARIANT_TO_USE=default html::test::default - HTML_VARIANT_TO_USE=exact html::test::exact -} -- cgit v1.2.3