summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-08-25 23:33:04 +0300
committerPaul Buetow <paul@buetow.org>2024-08-25 23:33:04 +0300
commit2bd2e05538f77a1a82f5c2552da5eb4bce092c59 (patch)
treeb4598598333c70caabd8be4473a50a7d93865fcf
parent850dd62850a88832803e13a4ad963a0f455865cc (diff)
remove deprecated html variant (the prev default one) and bump major gemtexter version
-rwxr-xr-xgemtexter9
-rw-r--r--gemtexter-paul.buetow.org.conf1
-rw-r--r--gemtexter-snonux.foo.conf1
-rw-r--r--gemtexter.conf1
-rw-r--r--lib/html.source.sh106
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 "<span>$(html::encode "$text")</span><br />"
- else
- echo '<br />'
- fi
- elif [ -n "$text" ]; then
- echo "<p>$(html::encode "$text")</p>"
+ if [ -n "$text" ]; then
+ echo "<span>$(html::encode "$text")</span><br />"
+ else
+ echo '<br />'
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 "<h${level} style='display: inline' id='${id}'>$(html::encode "$text")</h${level}><br />"
- else
- echo "<h${level} id='${id}'>$(html::encode "$text")</h${level}><br />"
- fi
+ echo "<h${level} style='display: inline' id='${id}'>$(html::encode "$text")</h${level}><br />"
}
# Make a HTML quotation
html::make_quote () {
local -r quote="${1/> }"
- if [ "$HTML_VARIANT_TO_USE" = exact ]; then
- echo "<span class='quote'>$(html::encode "$quote")</span><br />"
- else
- echo "<p class='quote'><i>$(html::encode "$quote")</i></p>"
- fi
+ echo "<span class='quote'>$(html::encode "$quote")</span><br />"
}
# Make a HTML image
@@ -177,11 +165,7 @@ html::fromgmi () {
echo "<li>$(html::list::encode "${line/\* /}")</li>" | html::process_inline
else
is_list=no
- if [ "$HTML_VARIANT_TO_USE" = exact ]; then
- echo "</ul><br />"
- else
- echo "</ul>"
- fi
+ echo "</ul><br />"
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")" "<span>Hello world! This is a paragraph.</span><br />"
+
+ line=''
+ assert::equals "$(html::make_paragraph "$line")" '<br />'
+
+ line='Foo &<>& Bar!'
+ assert::equals "$(html::make_paragraph "$line")" "<span>Foo &amp;&lt;&gt;&amp; Bar!</span><br />"
+
+ line='echo foo 2>&1'
+ assert::equals "$(html::make_paragraph "$line")" "<span>echo foo 2&gt;&amp;1</span><br />"
+
+ line='# Header 1'
+ local id='header-1'
+ assert::equals "$(html::make_heading "$line" 1)" "<h1 style='display: inline' id='${id}'>Header 1</h1><br />"
+
+ line='## Header 2'
+ id='header-2'
+ assert::equals "$(html::make_heading "$line" 2)" "<h2 style='display: inline' id='${id}'>Header 2</h2><br />"
+
+ line='### Header 3'
+ id='header-3'
+ assert::equals "$(html::make_heading "$line" 3)" "<h3 style='display: inline' id='${id}'>Header 3</h3><br />"
+
+ line='> This is a quote'
+ assert::equals "$(html::make_quote "$line")" "<span class='quote'>This is a quote</span><br />"
MASTODON_URI=''
- local line='Hello world! This is a paragraph.'
- assert::equals "$(html::make_paragraph "$line")" '<p>Hello world! This is a paragraph.</p>'
+ line='Hello world! This is a paragraph.'
+ assert::equals "$(html::make_paragraph "$line")" '<span>Hello world! This is a paragraph.</span><br />'
line=''
- assert::equals "$(html::make_paragraph "$line")" ''
+ assert::equals "$(html::make_paragraph "$line")" '<br />'
line='Foo &<>& Bar!'
- assert::equals "$(html::make_paragraph "$line")" '<p>Foo &amp;&lt;&gt;&amp; Bar!</p>'
+ assert::equals "$(html::make_paragraph "$line")" '<span>Foo &amp;&lt;&gt;&amp; Bar!</span><br />'
line='echo foo 2>&1'
- assert::equals "$(html::make_paragraph "$line")" '<p>echo foo 2&gt;&amp;1</p>'
+ assert::equals "$(html::make_paragraph "$line")" '<span>echo foo 2&gt;&amp;1</span><br />'
line='> This is a quote'
- assert::equals "$(html::make_quote "$line")" "<p class='quote'><i>This is a quote</i></p>"
+ assert::equals "$(html::make_quote "$line")" "<span class='quote'>This is a quote</span><br />"
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")" "<span>Hello world! This is a paragraph.</span><br />"
-
- line=''
- assert::equals "$(html::make_paragraph "$line")" '<br />'
-
- line='Foo &<>& Bar!'
- assert::equals "$(html::make_paragraph "$line")" "<span>Foo &amp;&lt;&gt;&amp; Bar!</span><br />"
-
- line='echo foo 2>&1'
- assert::equals "$(html::make_paragraph "$line")" "<span>echo foo 2&gt;&amp;1</span><br />"
-
- line='# Header 1'
- local id='header-1'
- assert::equals "$(html::make_heading "$line" 1)" "<h1 style='display: inline' id='${id}'>Header 1</h1><br />"
-
- line='## Header 2'
- id='header-2'
- assert::equals "$(html::make_heading "$line" 2)" "<h2 style='display: inline' id='${id}'>Header 2</h2><br />"
-
- line='### Header 3'
- id='header-3'
- assert::equals "$(html::make_heading "$line" 3)" "<h3 style='display: inline' id='${id}'>Header 3</h3><br />"
-
- line='> This is a quote'
- assert::equals "$(html::make_quote "$line")" "<span class='quote'>This is a quote</span><br />"
-}
-
-html::test () {
- HTML_VARIANT_TO_USE=default html::test::default
- HTML_VARIANT_TO_USE=exact html::test::exact
-}