From 8bdcb386f3ce26a9031ca123b4d43af0b5a3721a Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Wed, 18 Jan 2006 23:22:29 +0000 Subject: More fixes in the hope to get the manual compiled. * doc/skr/api.skr (define-markup?): Accept `define-public'. (define-markup-options): Accept any kind of `define' symbol. (define-markup-rest): Likewise. * doc/user/bib.skb (bibliography): Use `src/bib1.sbib'. (bib-table?): Provide a definition. (default-bib-table): Likewise. (make-bib-table): Likewise. (bibliography): Fixed a `ref'. (example): Fixed file name. This example does not work yet. * doc/user/footnote.skb (footnote): Documented `label', removed `number'. * doc/user/table.skb (th): Documented `rowspan'. * src/guile/skribilo.scm (skribilo-options): Added `-S'/`--source-path'. Honor it. * src/guile/skribilo/coloring/lisp.scm: Use `(ice-9 match)'. Rewrote all the `match-case' code into corresponding `match' statements. (definition-search): Fixed, using `source-property' and `port-line'. Does not work yet due to a bug in guile-reader's source position recording (shows 1 line earlier). Added a READ parameter. * src/guile/skribilo/skribe/api.scm: Mark SYMBOL as replaced instead of blindly overriding the core binding. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-28 --- ChangeLog | 42 ++++++++++++++++ doc/skr/api.skr | 8 +-- doc/user/bib.skb | 19 +++---- doc/user/footnote.skb | 5 +- doc/user/table.skb | 1 + src/guile/skribilo.scm | 6 ++- src/guile/skribilo/coloring/lisp.scm | 96 +++++++++++++++++++----------------- src/guile/skribilo/skribe/api.scm | 34 ++++++------- 8 files changed, 134 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8b3268..ff76aec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,48 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2006-01-18 23:22:29 GMT Ludovic Courtes patch-28 + + Summary: + More fixes in the hope to get the manual compiled. + Revision: + skribilo--devel--1.2--patch-28 + + * doc/skr/api.skr (define-markup?): Accept `define-public'. + (define-markup-options): Accept any kind of `define' symbol. + (define-markup-rest): Likewise. + + * doc/user/bib.skb (bibliography): Use `src/bib1.sbib'. + (bib-table?): Provide a definition. + (default-bib-table): Likewise. + (make-bib-table): Likewise. + (bibliography): Fixed a `ref'. + (example): Fixed file name. This example does not work yet. + + * doc/user/footnote.skb (footnote): Documented `label', removed + `number'. + + * doc/user/table.skb (th): Documented `rowspan'. + + * src/guile/skribilo.scm (skribilo-options): Added `-S'/`--source-path'. + Honor it. + + * src/guile/skribilo/coloring/lisp.scm: Use `(ice-9 match)'. Rewrote all + the `match-case' code into corresponding `match' statements. + (definition-search): Fixed, using `source-property' and `port-line'. + Does not work yet due to a bug in guile-reader's source position + recording (shows 1 line earlier). Added a READ parameter. + + * src/guile/skribilo/skribe/api.scm: Mark SYMBOL as replaced instead of + blindly overriding the core binding. + + modified files: + ChangeLog doc/skr/api.skr doc/user/bib.skb + doc/user/footnote.skb doc/user/table.skb + src/guile/skribilo.scm src/guile/skribilo/coloring/lisp.scm + src/guile/skribilo/skribe/api.scm + + 2006-01-18 22:16:43 GMT Ludovic Courtes patch-27 Summary: diff --git a/doc/skr/api.skr b/doc/skr/api.skr index 6d0c5bd..ec51e95 100644 --- a/doc/skr/api.skr +++ b/doc/skr/api.skr @@ -105,7 +105,7 @@ ;*---------------------------------------------------------------------*/ (define (define-markup? id o) (match o - (((or 'define-markup 'define 'define-inline) + (((or 'define-markup 'define 'define-public 'define-inline) ((? (lambda (x) (eq? x id))) . (? (lambda (x) (or (pair? x) (null? x))))) . _) @@ -185,7 +185,7 @@ ;*---------------------------------------------------------------------*/ (define (define-markup-options def) (match def - (('define-markup (args ___) _) + ((_ (args ___) _ ___) (if (not (list? args)) '() (let ((keys (memq #!key args))) @@ -197,7 +197,7 @@ (('define-simple-container _) '((ident #f) (class #f))) (else - (skribe-error 'define-markup-formals + (skribe-error 'define-markup-options "Illegal `define-markup' form" def)))) @@ -208,7 +208,7 @@ ;*---------------------------------------------------------------------*/ (define (define-markup-rest def) (match def - (('define-markup (args ___) _) + ((_ (args ___) _) (if (not (pair? args)) args (let ((l (last-pair args))) diff --git a/doc/user/bib.skb b/doc/user/bib.skb index c5357af..83e6360 100644 --- a/doc/user/bib.skb +++ b/doc/user/bib.skb @@ -9,7 +9,7 @@ ;* The Skribe index */ ;*=====================================================================*/ -(bibliography "user/src/bib1.sbib") +(bibliography "src/bib1.sbib") ;*---------------------------------------------------------------------*/ ;* Index */ @@ -51,8 +51,8 @@ if its argument is a bibliography table as returned by :see-also '(make-bib-table default-bib-table bibliography the-bibliography) :force-engines *api-engines* :common-args '() - :skribe-source? #f - :source "skribilo/biblio.scm") + :source #f ;;"skribilo/biblio.scm" + :def '(define-markup (bib-table? obj) ...)) (p [The function ,(code "default-bib-table") returns a global, pre-existing bibliography-table:]) @@ -61,8 +61,8 @@ bibliography-table:]) :see-also '(bib-table? make-bib-table bibliography the-bibliography) :force-engines *api-engines* :common-args '() - :skribe-source? #f - :source "skribilo/biblio.scm") + :source #f + :def '(define-markup (default-bib-table) ...)) (p [The function ,(code "make-bib-table") constructs a new bibliography-table:]) @@ -71,8 +71,8 @@ bibliography-table:]) :see-also '(bib-table? default-bib-table bibliography the-bibliography) :force-engines *api-engines* :common-args '() - :skribe-source? #f - :source "skribilo/biblio.scm")) + :source #f + :def '(define-markup (make-bib-table ident) ...))) ;*---------------------------------------------------------------------*/ ;* bibliography ... @label bibliography@ */ @@ -84,7 +84,7 @@ into the Skribe memory. An ,(emph "entry") is either a list representing one entry (such as an article or book reference) or a string which denotes a file name that contains several entries. All the entries loaded in memory are available for the function -,(ref :ident "ref" :node "references"). A bibliography database must be loaded +,(ref :ident "ref" :text "references"). A bibliography database must be loaded ,(emph "before") any reference is introduced. It is advised to place the ,(code "bibliography") Skribe function call before the call to the ,(markup-ref "document") function call.]) @@ -217,7 +217,8 @@ entries identifier. The last one sorts according to entries date.]) (example-produce (example :legend "Sorting bibliography entries" - (prgm :file "src/common/bib.scm" :definition 'bib-sort/idents))))) + (prgm :file "skribilo/skribe/bib.scm" + :definition 'bib-sort/idents))))) ;*---------------------------------------------------------------------*/ ;* skribebibtex */ diff --git a/doc/user/footnote.skb b/doc/user/footnote.skb index 96101f3..43d6c3f 100644 --- a/doc/user/footnote.skb +++ b/doc/user/footnote.skb @@ -18,7 +18,10 @@ the reference to the footnote.]) (doc-markup 'footnote - `((:number [The number of the footnote.]) + `((:label [This may be either a boolean (i.e., ,(code "#f") +or ,(code "#t")) indicating whether a footnote label should +automatically be produced, a string specifying a label to use (e.g., +,(code ["*"])), or a number.]) (#!rest text... [The text of the footnote.])) :see-also '(document chapter section)) diff --git a/doc/user/table.skb b/doc/user/table.skb index c726d44..a3cd75b 100644 --- a/doc/user/table.skb +++ b/doc/user/table.skb @@ -66,6 +66,7 @@ attribute is only supported by HTML engines supporting (:valign [The vertical alignment of the cell. The value can be ,(code "top"), ,(code "center"), ,(code "bottom").]) (:colspan [The number of columns that the cell expands to.]) + (:rowspan [The number of columns that the cell spans over.]) (#!rest node [The value of the cell.])) :writer-id 'tc :ignore-args '(m) diff --git a/src/guile/skribilo.scm b/src/guile/skribilo.scm index b9805b3..43885ee 100644 --- a/src/guile/skribilo.scm +++ b/src/guile/skribilo.scm @@ -87,7 +87,7 @@ specifications." (set! paths (cons path paths))) (("bib-path" :alternate "B" :arg path :help "adds to bibliography path") (skribe-bib-path-set! (cons path (skribe-bib-path)))) - (("S" :arg path :help "adds to source path") + (("source-path" :alternate "S" :arg path :help "adds to source path") (skribe-source-path-set! (cons path (skribe-source-path)))) (("P" :arg path :help "adds to image path") (skribe-image-path-set! (cons path (skribe-image-path)))) @@ -388,6 +388,7 @@ Processes a Skribilo/Skribe source file and produces its output. (warning-level (option-ref options 'warning "2")) (load-path (option-ref options 'load-path ".")) (bib-path (option-ref options 'bib-path ".")) + (source-path (option-ref options 'source-path ".")) (preload '()) (variants '()) @@ -414,6 +415,9 @@ 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*))) + (*source-path* (cons source-path + (append %load-path + (*source-path*)))) (*warning* (string->number warning-level)) (*verbose* (let ((v (option-ref options 'verbose 0))) diff --git a/src/guile/skribilo/coloring/lisp.scm b/src/guile/skribilo/coloring/lisp.scm index 589e70a..33ecc48 100644 --- a/src/guile/skribilo/coloring/lisp.scm +++ b/src/guile/skribilo/coloring/lisp.scm @@ -30,6 +30,7 @@ :use-module (skribilo source) :use-module (skribilo lib) :use-module (skribilo runtime) + :use-module (ice-9 match) :autoload (skribilo reader) (make-reader) :export (skribe scheme stklos bigloo lisp)) @@ -48,14 +49,16 @@ ;;; ;;; DEFINITION-SEARCH ;;; -(define (definition-search inp tab test) - (let Loop ((exp (%read inp))) +(define (definition-search inp read tab def?) + (let Loop ((exp (read inp))) (unless (eof-object? exp) - (if (test exp) - (let ((start (and (%epair? exp) (%epair-line exp))) - (stop (port-current-line inp))) - (source-read-lines (port-file-name inp) start stop tab)) - (Loop (%read inp)))))) + (if (def? exp) + (let ((start (and (pair? exp) (source-property exp 'line))) + (stop (port-line inp))) + (format (current-error-port) "READ-LINES: `~a' ~a->~a~%" + exp start stop) + (source-read-lines (port-filename inp) start stop tab)) + (Loop (read inp)))))) (define (lisp-family-fontifier s read) @@ -75,15 +78,15 @@ (define (lisp-extractor iport def tab) (definition-search iport + read tab (lambda (exp) - (match-case exp - (((or defun defmacro) ?fun ?- . ?-) - (and (eq? def fun) exp)) - ((defvar ?var . ?-) - (and (eq? var def) exp)) - (else - #f))))) + (match exp + (((or 'defun 'defmacro) fun _ . _) + (and (eq? def fun) exp)) + (('defvar var . _) + (and (eq? var def) exp)) + (else #f))))) (define (init-lisp-keys) (unless *lisp-keys* @@ -117,15 +120,15 @@ (define (scheme-extractor iport def tab) (definition-search iport + %skribilo-module-reader tab (lambda (exp) - (match-case exp - (((or define define-macro) (?fun . ?-) . ?-) - (and (eq? def fun) exp)) - ((define (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) - (else - #f))))) + (match exp + (((or 'define 'define-macro) (fun . _) . _) + (and (eq? def fun) exp)) + (('define (? symbol? var) . _) + (and (eq? var def) exp)) + (else #f))))) (define (init-scheme-keys) @@ -161,14 +164,15 @@ (define (stklos-extractor iport def tab) (definition-search iport + %skribilo-module-reader tab (lambda (exp) - (match-case exp - (((or define define-generic define-method define-macro) - (?fun . ?-) . ?-) - (and (eq? def fun) exp)) - (((or define define-module) (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) + (match exp + (((or 'define 'define-generic 'define-method 'define-macro) + (fun . _) . _) + (and (eq? def fun) exp)) + (((or 'define 'define-module) (? symbol? var) . _) + (and (eq? var def) exp)) (else #f))))) @@ -214,17 +218,18 @@ (define (skribe-extractor iport def tab) (definition-search iport + (make-reader 'skribe) tab (lambda (exp) - (match-case exp - (((or define define-macro define-markup) (?fun . ?-) . ?-) - (and (eq? def fun) exp)) - ((define (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) - ((markup-output (quote ?mk) . ?-) - (and (eq? mk def) exp)) - (else - #f))))) + (match exp + (((or 'define 'define-macro 'define-markup 'define-public) + (fun . _) . _) + (and (eq? def fun) exp)) + (('define (? symbol? var) . _) + (and (eq? var def) exp)) + (('markup-output (quote mk) . _) + (and (eq? mk def) exp)) + (else #f))))) (define (init-skribe-keys) @@ -275,17 +280,18 @@ (define (bigloo-extractor iport def tab) (definition-search iport + %skribilo-module-reader tab (lambda (exp) - (match-case exp - (((or define define-inline define-generic - define-method define-macro define-expander) - (?fun . ?-) . ?-) - (and (eq? def fun) exp)) - (((or define define-struct define-library) (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) - (else - #f))))) + (match exp + (((or 'define 'define-inline 'define-generic + 'define-method 'define-macro 'define-expander) + (fun . _) . _) + (and (eq? def fun) exp)) + (((or 'define 'define-struct 'define-library) + (? symbol? var) . _) + (and (eq? var def) exp)) + (else #f))))) (define bigloo (new language diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm index bf99868..c9606a0 100644 --- a/src/guile/skribilo/skribe/api.scm +++ b/src/guile/skribilo/skribe/api.scm @@ -1,7 +1,7 @@ -;;; api.scm +;;; api.scm -- The markup API of Skribe/Skribilo. ;;; ;;; Copyright 2003, 2004 Manuel Serrano -;;; Copyright 2005 Ludovic Courtès +;;; Copyright 2005, 2006 Ludovic Courtès ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -19,7 +19,8 @@ ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;; USA. -(define-skribe-module (skribilo skribe api)) +(define-skribe-module (skribilo skribe api) + :replace (symbol)) ;;; Author: Manuel Serrano ;;; Commentary: @@ -824,20 +825,19 @@ ;*---------------------------------------------------------------------*/ ;* symbol ... */ ;*---------------------------------------------------------------------*/ -(set! symbol - (lambda (symbol) - (let ((v (cond - ((symbol? symbol) - (symbol->string symbol)) - ((string? symbol) - symbol) - (else - (skribe-error 'symbol - "Illegal argument (symbol expected)" - symbol))))) - (new markup - (markup 'symbol) - (body v))))) +(define-markup (symbol symbol) + (let ((v (cond + ((symbol? symbol) + (symbol->string symbol)) + ((string? symbol) + symbol) + (else + (skribe-error 'symbol + "Illegal argument (symbol expected)" + symbol))))) + (new markup + (markup 'symbol) + (body v)))) ;*---------------------------------------------------------------------*/ ;* ! ... */ -- cgit v1.2.3