Fixing plain text HTML output.

master
Thomas Hintz 9 years ago
parent c65df73681
commit bda58b585e

@ -1,4 +1,4 @@
(import chicken scheme)
(import chicken scheme data-structures)
(use colorize irregex srfi-13 files)
(define *file* (cadr (argv)))
@ -65,10 +65,17 @@
((html) 'html)
(else #f)))
;; based on string-translate* example from CHICKEN Scheme docs
(define (text->html text)
(string-translate*
text
'(("<" . "&lt;") (">" . "&gt;") ("\"" . "&quot;")
(" " . "&nbsp;") ("'" . "&#x27;")) ))
(let ((type (or (guess-type-by-emacs-major-mode-variable *file-contents*)
(guess-type-by-file-extension *file*))))
(if (not type)
(begin (display *file-contents*) (exit 0))
(begin (display (text->html *file-contents*)) (exit 0))
(begin
(display
"<style>

Loading…
Cancel
Save