|
|
|
@ -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
|
|
|
|
|
'(("<" . "<") (">" . ">") ("\"" . """)
|
|
|
|
|
(" " . " ") ("'" . "'")) ))
|
|
|
|
|
|
|
|
|
|
(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>
|
|
|
|
|