summaryrefslogtreecommitdiff
path: root/lib/html.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-09 00:34:38 +0300
committerPaul Buetow <paul@buetow.org>2025-07-09 00:34:38 +0300
commit0177f9d40b7eb0dd33138923927b4d117a26c394 (patch)
tree8369bdeec50d1860267494ad71aaaac7a3a4c209 /lib/html.source.sh
parent0a29784db9e3355e7b0980ff9adc8e527aa7b0b0 (diff)
AUTO not yet supported
Diffstat (limited to 'lib/html.source.sh')
-rw-r--r--lib/html.source.sh22
1 files changed, 4 insertions, 18 deletions
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 '<pre>'
- html::encode "$bare_text"
- echo '</pre>'
- else
- echo "$output" | $SED 's|<tt>||; s|</tt>||;'
- fi
+ log WARN "GNU Source Highlight auto detection not yet supported!"
+ echo '<pre>'
+ html::encode "$bare_text"
+ echo '</pre>'
else
$SOURCE_HIGHLIGHT --src-lang="$language" "$style_css" <<< "$bare_text" |
$SED 's|<tt>||; s|</tt>||;'