From 77f1210c86000ca8f2aa40cb148820d3e0eb3ca8 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Mon, 23 Jan 2006 10:32:29 +0000 Subject: Preliminary support for multiple reader front-ends. * src/guile/skribilo.scm: Use `(skribilo reader)'. (skribilo-options): Added `--reader'. (skribilo): Read `--reader', parameterize `*document-reader*'. * src/guile/skribilo/evaluator.scm (evaluate-document-from-port): Have READER default to `*document-reader*'. (include-document): Likewise. * src/guile/skribilo/reader.scm: Load SRFIs 34, 35, and 39, as well as `(skribilo condition)'. Export `*document-reader*'. (&reader-search-error): New. (lookup-reader): Raise a `&reader-search-error' condition if NAME is not found. (*document-reader*): New. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-32 --- src/guile/skribilo.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/guile/skribilo.scm') diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm index 43885ee..285a92d 100644 --- a/src/guile/skribilo.scm +++ b/src/guile/skribilo.scm @@ -38,6 +38,7 @@ exec ${GUILE-guile} --debug -l $0 -c "(apply $main (cdr (command-line)))" "$@" (define-module (skribilo) :autoload (skribilo module) (make-run-time-module) :autoload (skribilo engine) (*current-engine*) + :autoload (skribilo reader) (*document-reader*) :use-module (skribilo utils syntax)) (use-modules (skribilo evaluator) @@ -80,6 +81,8 @@ specifications." `(define ,binding (quote ,(raw-options->getopt-long options)))) (define-options skribilo-options + (("reader" :alternate "R" :arg reader + (nothing))) (("target" :alternate "t" :arg target :help "sets the output format to ") (set! engine (string->symbol target))) @@ -194,6 +197,8 @@ specifications." Processes a Skribilo/Skribe source file and produces its output. + --reader=READER Use READER to parse the input file (by default, + the `skribe' reader is used) --target=ENGINE Use ENGINE as the underlying engine --help Give this help list @@ -381,6 +386,8 @@ Processes a Skribilo/Skribe source file and produces its output. (define-public (skribilo . args) (let* ((options (getopt-long (cons "skribilo" args) skribilo-options)) + (reader-name (string->symbol + (option-ref options 'reader "skribe"))) (engine (string->symbol (option-ref options 'target "html"))) (output-file (option-ref options 'output #f)) @@ -412,7 +419,8 @@ Processes a Skribilo/Skribe source file and produces its output. (lambda (file) (format #t "~~ loading `~a'...~%" file)))) - (parameterize ((*current-engine* engine) + (parameterize ((*document-reader* (make-reader reader-name)) + (*current-engine* engine) (*document-path* (cons load-path (*document-path*))) (*bib-path* (cons bib-path (*bib-path*))) (*source-path* (cons source-path -- cgit v1.2.3