aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Court`es2005-11-29 13:32:30 +0000
committerLudovic Court`es2005-11-29 13:32:30 +0000
commit3918fa2a728f00838ffda94ec6427b133c5abb68 (patch)
tree82dbc19796b8cf3f51486f3e6400967e45468a56 /src
parent4686c3d129e4ebb3edc97e53a20a5f9db682f993 (diff)
downloadskribilo-3918fa2a728f00838ffda94ec6427b133c5abb68.tar.gz
skribilo-3918fa2a728f00838ffda94ec6427b133c5abb68.tar.lz
skribilo-3918fa2a728f00838ffda94ec6427b133c5abb68.zip
Fixed `ref' and bibliography-related things.
* src/guile/skribilo.scm (main): Handle `--warning'. * src/guile/skribilo/biblio.scm: Export `skribe-open-bib-file' and `parse-bib'. (parse-bib): Use `%default-reader'. * src/guile/skribilo/evaluator.scm (%evaluate): Cleaned up. (skribe-eval-port): Likewise. * src/guile/skribilo/module.scm (load-file-with-read): Removed. (load-skribilo-file): Removed. (load-skribilo-modules): Removed. * src/guile/skribilo/package/slide.scm (ref): Temporarily commented out. * src/guile/skribilo/skribe/bib.scm: Use `(skribilo biblio)'. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-15
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo.scm3
-rw-r--r--src/guile/skribilo/biblio.scm41
-rw-r--r--src/guile/skribilo/evaluator.scm10
-rw-r--r--src/guile/skribilo/module.scm34
-rw-r--r--src/guile/skribilo/package/slide.scm75
-rw-r--r--src/guile/skribilo/skribe/bib.scm3
6 files changed, 79 insertions, 87 deletions
diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm
index de7dac2..a560b46 100644
--- a/src/guile/skribilo.scm
+++ b/src/guile/skribilo.scm
@@ -393,6 +393,7 @@ Processes a Skribilo/Skribe source file and produces its output.
(set-current-module user-module)))))
+
;;;; ======================================================================
;;;;
;;;; M A I N
@@ -405,6 +406,7 @@ Processes a Skribilo/Skribe source file and produces its output.
(option-ref options 'target "html")))
(output-file (option-ref options 'output #f))
(debugging-level (option-ref options 'debug "0"))
+ (warning-level (option-ref options 'warning "2"))
(load-path (option-ref options 'load-path "."))
(bib-path (option-ref options 'bib-path "."))
(preload '())
@@ -433,6 +435,7 @@ Processes a Skribilo/Skribe source file and produces its output.
(parameterize ((*current-engine* engine)
(*document-path* (cons load-path (*document-path*)))
(*bib-path* (cons bib-path (*bib-path*)))
+ (*warning* (string->number warning-level))
(*verbose* (let ((v (option-ref options
'verbose 0)))
(if (number? v) v
diff --git a/src/guile/skribilo/biblio.scm b/src/guile/skribilo/biblio.scm
index 045e3ae..cbb9202 100644
--- a/src/guile/skribilo/biblio.scm
+++ b/src/guile/skribilo/biblio.scm
@@ -25,10 +25,12 @@
:use-module (skribilo utils syntax) ;; `when', `unless'
:use-module (skribilo module)
:use-module (skribilo skribe bib) ;; `make-bib-entry'
+ :autoload (skribilo reader) (%default-reader)
:autoload (skribilo parameters) (*bib-path*)
:autoload (ice-9 format) (format)
:export (bib-table? make-bib-table default-bib-table
- bib-add!))
+ bib-add! bib-duplicate
+ skribe-open-bib-file parse-bib))
(set-current-reader %skribilo-module-reader)
@@ -92,24 +94,25 @@
;;;
;;; ======================================================================
(define (parse-bib table port)
- (if (not (bib-table? table))
- (skribe-error 'parse-bib "Illegal bibliography table" table)
- (let ((from (port-file-name port)))
- (let Loop ((entry (read port)))
- (unless (eof-object? entry)
- (cond
- ((and (list? entry) (> (length entry) 2))
- (let* ((kind (car entry))
- (key (format #f "~A" (cadr entry)))
- (fields (cddr entry))
- (old (hash-ref table key)))
- (if old
- (bib-duplicate ident from old)
- (hash-set! table key
- (make-bib-entry kind key fields from)))
- (Loop (read port))))
- (else
- (%bib-error 'bib-parse entry))))))))
+ (let ((read %default-reader)) ;; FIXME: We should use a fluid
+ (if (not (bib-table? table))
+ (skribe-error 'parse-bib "Illegal bibliography table" table)
+ (let ((from (port-filename port)))
+ (let Loop ((entry (read port)))
+ (unless (eof-object? entry)
+ (cond
+ ((and (list? entry) (> (length entry) 2))
+ (let* ((kind (car entry))
+ (key (format #f "~A" (cadr entry)))
+ (fields (cddr entry))
+ (old (hash-ref table key)))
+ (if old
+ (bib-duplicate ident from old)
+ (hash-set! table key
+ (make-bib-entry kind key fields from)))
+ (Loop (read port))))
+ (else
+ (%bib-error 'bib-parse entry)))))))))
;;; ======================================================================
diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm
index 73f7db0..e4ef208 100644
--- a/src/guile/skribilo/evaluator.scm
+++ b/src/guile/skribilo/evaluator.scm
@@ -55,15 +55,15 @@
;;;
(define (%evaluate expr)
(let ((result (eval expr (current-module))))
- (if (or (ast? result) (markup? result))
+
+ (if (ast? result)
(let ((file (source-property expr 'filename))
(line (source-property expr 'line))
(column (source-property expr 'column)))
-; (format #t "~%* source props for `~a': ~a~%"
-; result (source-properties expr))
(slot-set! result 'loc
(make <location>
:file file :line line :pos column))))
+
result))
@@ -93,9 +93,7 @@
(let ((e (if (symbol? engine) (find-engine engine) engine)))
(debug-item "e=" e)
(if (not (engine? e))
- (begin
- (format #t "engine: ~a~%" e)
- (skribe-error 'skribe-eval-port "cannot find engine" engine))
+ (skribe-error 'skribe-eval-port "cannot find engine" engine)
(let loop ((exp (reader port)))
(with-debug 10 'skribe-eval-port
(debug-item "exp=" exp))
diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm
index 2418a2c..66f4940 100644
--- a/src/guile/skribilo/module.scm
+++ b/src/guile/skribilo/module.scm
@@ -146,38 +146,4 @@ execution of Skribilo/Skribe code."
%skribilo-user-module)
-;; FIXME: This will eventually be replaced by the per-module reader thing in
-;; Guile.
-(define-public (load-file-with-read file read module)
- (with-debug 5 'load-file-with-read
- (debug-item "loading " file)
-
- (with-input-from-file (search-path %load-path file)
- (lambda ()
-; (format #t "load-file-with-read: ~a~%" read)
- (let loop ((sexp (read))
- (result #f))
- (if (not (eof-object? sexp))
- (begin
-; (format #t "preparing to evaluate `~a'~%" sexp)
- (primitive-eval sexp)
- (loop (read)))))))))
-
-(define-public (load-skribilo-file file reader-name)
- (load-file-with-read file (make-reader reader-name) (current-module)))
-
-(define*-public (load-skribe-modules :optional (debug? #f))
- "Load the core Skribe modules, both in the @code{(skribilo skribe)}
-hierarchy and in @code{(run-time-module)}."
- (for-each (lambda (mod)
- (format #t "~~ loading skribe module `~a'...~%" mod)
- (load-skribilo-file (string-append "skribilo/skribe/"
- mod ".scm")
- 'skribe)
- (module-use! (run-time-module)
- (resolve-module `(skribilo skribe
- ,(string->symbol mod)))))
- %skribe-core-modules))
-
-
;;; module.scm ends here
diff --git a/src/guile/skribilo/package/slide.scm b/src/guile/skribilo/package/slide.scm
index 37ee054..f5f0011 100644
--- a/src/guile/skribilo/package/slide.scm
+++ b/src/guile/skribilo/package/slide.scm
@@ -119,33 +119,52 @@
;*---------------------------------------------------------------------*/
(define %slide-old-ref ref)
-(define-markup (ref #!rest opt #!key (slide #f))
- (if (not slide)
- (apply %slide-old-ref opt)
- (new unresolved
- (proc (lambda (n e env)
- (cond
- ((eq? slide 'next)
- (let ((c (assq n %slide-the-slides)))
- (if (pair? c)
- (handle (cadr c))
- #f)))
- ((eq? slide 'prev)
- (let ((c (assq n (reverse %slide-the-slides))))
- (if (pair? c)
- (handle (cadr c))
- #f)))
- ((number? slide)
- (let loop ((s %slide-the-slides))
- (cond
- ((null? s)
- #f)
- ((= slide (markup-option (car s) :number))
- (handle (car s)))
- (else
- (loop (cdr s))))))
- (else
- #f)))))))
+;; Extend the definition of `ref'.
+;; FIXME: This technique breaks `ref' for some reason.
+; (set! ref
+; (lambda args
+; ;; Filter out ARGS and look for a `:slide' keyword argument.
+; (let loop ((slide #f)
+; (opt '())
+; (args args))
+; (if (null? args)
+; (set! opt (reverse! opt))
+; (let ((s? (eq? (car args) :slide)))
+; (loop (if s? (cadr args) #f)
+; (if s? opt (cons (car args) opt))
+; (if s? (cddr args) (cdr args)))))
+
+; (format (current-error-port)
+; "slide.scm:ref: slide=~a opt=~a~%" slide opt)
+
+; (if (not slide)
+; (apply %slide-old-ref opt)
+; (new unresolved
+; (proc (lambda (n e env)
+; (cond
+; ((eq? slide 'next)
+; (let ((c (assq n %slide-the-slides)))
+; (if (pair? c)
+; (handle (cadr c))
+; #f)))
+; ((eq? slide 'prev)
+; (let ((c (assq n (reverse %slide-the-slides))))
+; (if (pair? c)
+; (handle (cadr c))
+; #f)))
+; ((number? slide)
+; (let loop ((s %slide-the-slides))
+; (cond
+; ((null? s)
+; #f)
+; ((= slide (markup-option
+; (car s) :number))
+; (handle (car s)))
+; (else
+; (loop (cdr s))))))
+; (else
+; #f)))))))))
+
;*---------------------------------------------------------------------*/
;* slide-pause ... */
@@ -368,6 +387,8 @@
(define &latex-play #f)
(define &latex-play* #f)
+;;; FIXME: We shouldn't load `latex.scm' from here. Instead, we should
+;;; register a hook on its load.
(let ((le (find-engine 'latex)))
;; slide-vspace
(markup-writer 'slide-vspace le
diff --git a/src/guile/skribilo/skribe/bib.scm b/src/guile/skribilo/skribe/bib.scm
index 0a80ec9..2bc2238 100644
--- a/src/guile/skribilo/skribe/bib.scm
+++ b/src/guile/skribilo/skribe/bib.scm
@@ -19,7 +19,8 @@
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;; USA.
-(define-skribe-module (skribilo skribe bib))
+(define-skribe-module (skribilo skribe bib)
+ :use-module (skribilo biblio))
;;; Author: Manuel Serrano
;;; Commentary: