Welcome to the CHICKEN Scheme pasting service
cgit about-filter pasted by Kooda on Tue Mar 8 16:44:20 2016
#!/bin/sh #| exec csi -s "$0" "$@" |# (use srfi-1 lowdown) (define (text->html) (write-string (string-append "<pre>\n" (read-string) "\n</pre>\n"))) (define args (command-line-arguments)) (define filename (car args)) (define extension (let ((l (string-split filename "."))) (and (pair? (cdr l)) (cadr l)))) (cond ((equal? extension "md") (markdown->html (current-input-port))) (else (text->html)))
Simplified cgit about filter with HTML escaping added by sjamaan on Tue Mar 8 17:06:32 2016
#!/usr/local/chickens/spiffy/bin/csi -s (use lowdown files data-structures) ;; Avoid unnecessarily loading Spiffy again ;; (this must be as fast as possible) (define (htmlize str) (string-translate* str '(("<" . "<") (">" . ">") ("\"" . """) ("'" . "'") ("&" . "&")))) (define (text->html) (write-string (string-append "<pre>\n" (htmlize (read-string)) "\n</pre>\n"))) (define file (car (command-line-arguments))) (if (equal? (pathname-extension file) "md") (markdown->html (current-input-port)) (text->html))