From 0a29784db9e3355e7b0980ff9adc8e527aa7b0b0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 9 Jul 2025 00:17:11 +0300 Subject: fix: unbound variable in html::source_highlight --- lib/html.source.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/html.source.sh') diff --git a/lib/html.source.sh b/lib/html.source.sh index 8dab622..78b486e 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -129,7 +129,6 @@ html::theme::webfonts () { html::source_highlight () { local -r bare_text="$1"; shift local -r language="$1"; shift - local tmp_file='' if [[ -z "$language" || -z "$SOURCE_HIGHLIGHT" ]]; then echo '
'
@@ -142,13 +141,14 @@ html::source_highlight () {
         fi
 
         if [[ "$language" == "AUTO" ]]; then
-            tmp_file=$(mktemp)
-            trap 'rm -f "$tmp_file"' RETURN
+            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
-- 
cgit v1.2.3