From 0177f9d40b7eb0dd33138923927b4d117a26c394 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 9 Jul 2025 00:34:38 +0300 Subject: AUTO not yet supported --- lib/html.source.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/html.source.sh b/lib/html.source.sh index 78b486e..3c2a3dc 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -141,24 +141,10 @@ html::source_highlight () { fi if [[ "$language" == "AUTO" ]]; then - local tmp_file - tmp_file="/tmp/gemtexter-source-highlight-$(date +%s%N)" - printf %s "$bare_text" > "$tmp_file" - - local output - # redirect stderr to avoid printing the error message - output=$($SOURCE_HIGHLIGHT --infer-lang --failsafe -i "$tmp_file" "$style_css" 2>/dev/null) - rm -f "$tmp_file" - - # if output is same as input, highlighting failed - # also check if output is empty, which also means failure - if [[ "$output" == "$bare_text" || -z "$output" ]]; then - echo '
'
-                html::encode "$bare_text"
-                echo '
' - else - echo "$output" | $SED 's|||; s|||;' - fi + log WARN "GNU Source Highlight auto detection not yet supported!" + echo '
'
+            html::encode "$bare_text"
+            echo '
' else $SOURCE_HIGHLIGHT --src-lang="$language" "$style_css" <<< "$bare_text" | $SED 's|||; s|||;' -- cgit v1.2.3