summaryrefslogtreecommitdiff
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
parent0a29784db9e3355e7b0980ff9adc8e527aa7b0b0 (diff)
AUTO not yet supported
-rw-r--r--README.md2
-rw-r--r--lib/html.source.sh22
2 files changed, 5 insertions, 19 deletions
diff --git a/README.md b/README.md
index f11957a..8db3e5d 100644
--- a/README.md
+++ b/README.md
@@ -122,7 +122,7 @@ The HTML output supports source code highlighting. The requirement is to have th
...
```
-Alternatively, you can set the language to `AUTO` to enable automatic language detection:
+Not yet supported, but syntax is there already: Alternatively, you can set the language to `AUTO` to enable automatic language detection:
```
```AUTO
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>||;'