Add Gauche wrapper

This commit is contained in:
Lassi Kortela 2021-08-24 21:03:49 +03:00
parent ec5cfa689b
commit 0279505d2c
3 changed files with 39 additions and 0 deletions

7
pandoc.gauche.scm Normal file
View File

@ -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))))

20
pandoc.sld Normal file
View File

@ -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"))

12
test.gauche.scm Normal file
View File

@ -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"))