pandoc/pandoc.chicken.scm

54 lines
1.3 KiB
Scheme
Raw Normal View History

2021-08-24 13:47:07 -04:00
(module pandoc
2021-09-05 05:50:52 -04:00
(#;export
pandoc-json->sxml
2021-08-24 13:47:07 -04:00
pandoc-port->json
pandoc-port->sxml
2021-09-05 05:50:52 -04:00
2021-08-24 13:47:07 -04:00
pandoc-file->json
2021-09-01 05:18:13 -04:00
pandoc-file->sxml
2021-09-05 05:50:52 -04:00
pandoc-files->json
pandoc-files->sxml
pandoc-bytevector->json
pandoc-bytevector->sxml
pandoc-bytevectors->json
pandoc-bytevectors->sxml
pandoc-string->json
pandoc-string->sxml
pandoc-strings->json
pandoc-strings->sxml)
2021-08-24 13:47:07 -04:00
(import (scheme)
(chicken base)
2021-09-05 05:50:52 -04:00
(only (scheme base)
bytevector
bytevector-append
read-bytevector
string->utf8)
2021-08-24 13:47:07 -04:00
(only (chicken io) read-byte write-byte)
2021-09-05 05:50:52 -04:00
(only (chicken port) copy-port with-input-from-string)
2021-08-24 13:47:07 -04:00
(only (chicken process) process process-wait)
(only (scsh-process) run/port)
(only (medea) read-json))
2021-08-24 13:47:07 -04:00
2021-09-05 05:50:52 -04:00
(define (read-bytevector-all port)
(let loop ((whole (bytevector)))
(let ((part (read-bytevector 1000 port)))
(if (eof-object? part) whole
(loop (bytevector-append whole part))))))
2021-08-24 13:47:07 -04:00
(define (call-with-binary-input-file filename proc)
(let ((port (open-input-file filename #:binary)))
(dynamic-wind (lambda () #f)
(lambda () (proc port))
(lambda () (close-input-port port)))))
(include "pandoc.r5rs.scm"))