Hell,
I have this simple document from the documentation
(document #:title "Some Title"
(chapter #:title "The Chapter"
(p "The paragraph... "
"Text consists of "
"a list of strings.")))
contained in a file called 'test.scm'.
I have this Guile script (compile.scm) that is intended to process documents
like
'test.scm'
#! /usr/local/bin/guile -s
!#
(use-modules (skribilo engine) ;; provides `find-engine'
(skribilo evaluator) ;; provides `evaluate-document'
(skribilo package base) ;; provides `chapter', etc.
(skribilo utils syntax) ;; `set-correct-file-encoding!'
(srfi srfi-1)
(ice-9 rdelim)) ;read-line
(let* (;; infile, outfile, engine
(infile (list-ref (command-line) 1))
(outfile (list-ref (command-line) 2))
(eng (string->symbol (list-ref (command-line) 3)))
(e (find-engine eng))
;; The (document ...) bit wast pasted in from the file
;; It compiles fine using this text
;; There must be something odd about the (document ...) returned by
with-input-from-file...
(result (with-input-from-file infile
(lambda ()
(set-correct-file-encoding!)
(let loop ((line (read-line))
(result '()))
(if (eof-object? line)
(string-join (reverse result)
(string #\newline))
(loop (read-line)
(cons line result)))))))
(d result))
;; "Evaluate" the document to a file.
(with-output-to-file (string-append outfile "." (symbol->string eng))
(lambda ()
(evaluate-document d e))))
When I invoke 'compile.scm' like this:
./compile.scm test.scm test context
the output document (test.context) looks like this:
(document \type{#}:title "Some Title"
(chapter \type{#}:title "The Chapter"
(p "The paragraph... "
"Text consists of "
"a list of strings.")))
rather than being a context document written by Skribilo.
Can someone please tell me how to get this to work?
Thanks,
Roger
_______________________________________________
Skribilo-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/skribilo-users