diff --git a/pandoc.gauche.scm b/pandoc.gauche.scm new file mode 100644 index 0000000..e354c70 --- /dev/null +++ b/pandoc.gauche.scm @@ -0,0 +1,7 @@ +(define (run-read-write args input-port read-output) + (call-with-process-io + args + (lambda (from-sub to-sub) + (copy-port input-port to-sub) + (close-output-port to-sub) + (read-output from-sub)))) diff --git a/pandoc.sld b/pandoc.sld new file mode 100644 index 0000000..100940a --- /dev/null +++ b/pandoc.sld @@ -0,0 +1,20 @@ +(define-library (pandoc) + (export pandoc-command-line + pandoc-port->json + pandoc-port->sxml + pandoc-file->json + pandoc-file->sxml) + (import (scheme base) + (scheme file) + (scheme write)) + (cond-expand + (gauche (import (only (srfi 180) json-read) + (only (gauche base) copy-port) + (only (gauche process) call-with-process-io)))) + (begin + (define pandoc-command-line (make-parameter (list "pandoc"))) + (define (call-with-binary-input-file filename proc) + (call-with-port (open-binary-input-file filename) proc))) + (cond-expand + (gauche (include "pandoc.gauche.scm"))) + (include "pandoc.r5rs.scm")) diff --git a/test.gauche.scm b/test.gauche.scm new file mode 100644 index 0000000..2cb0431 --- /dev/null +++ b/test.gauche.scm @@ -0,0 +1,12 @@ +(import (scheme base) (scheme write)) +(import (rename (only (gauche base) pprint) (pprint pretty-print)) + (rename (only (sxml serializer) srl:sxml->html) (srl:sxml->html sxml->html)) + (pandoc)) + +(display (sxml->html (pandoc-file->sxml 'gfm "test/CharEq.md"))) +(newline) +(newline) +(display (sxml->html (pandoc-file->sxml 'gfm "test/VoidValue.md"))) +(newline) +(newline) +(pretty-print (pandoc-file->json 'gfm "test/VoidValue.md"))