aboutsummaryrefslogtreecommitdiff
path: root/tw/system/lud.scm
diff options
context:
space:
mode:
authorTimo Wilken2024-01-11 15:28:09 +0100
committerTimo Wilken2024-01-11 15:30:32 +0100
commitda53c5172df28f3f2203f84ee1009b464f3542ef (patch)
tree34731c27a97e52c6b640707aad8417ec67484f40 /tw/system/lud.scm
parentcde8ac06cb933bf115c8a0c1a8c6c1448ea21ef0 (diff)
Escape HTML properly when processing plaintext READMEs
Diffstat (limited to 'tw/system/lud.scm')
-rw-r--r--tw/system/lud.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/tw/system/lud.scm b/tw/system/lud.scm
index ab484648..7d41eae0 100644
--- a/tw/system/lud.scm
+++ b/tw/system/lud.scm
@@ -131,7 +131,8 @@ that I just want to host somewhere.")
;; See also /gnu/store/...-cgit-1.2.3/lib/cgit/filters/.
(readme ":README.md")
- (extra-options '("readme=:README.org" "readme=:README")) ; alternative readmes
+ (extra-options ; alternative readmes
+ '("readme=:README.org" "readme=:README.html" "readme=:README"))
(about-filter
(program-file "cgit-about-filter"
(with-extensions (list guile-commonmark)
@@ -144,9 +145,19 @@ that I just want to host somewhere.")
(cond
((string-suffix? ".md" file-name)
(sxml->xml (commonmark->sxml)))
+ ((string-suffix? ".html" file-name)
+ (dump-port (current-input-port) (current-output-port)))
(else
(display "<pre>")
- (dump-port (current-input-port) (current-output-port))
+ (do ((ch (read-char) (read-char)))
+ ((eof-object? ch))
+ (case ch
+ ((#\") (display "&quot;"))
+ ((#\') (display "&apos;"))
+ ((#\&) (display "&amp;"))
+ ((#\<) (display "&lt;"))
+ ((#\>) (display "&gt;"))
+ (else => write-char)))
(display "</pre>"))))))))
(nginx