From e9509518623d016880392237a298d4561a3b6a0b Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Mon, 31 Oct 2005 16:03:18 +0000 Subject: Removed useless files, integrated packages. * src/guile/skribilo/packages: New directory and files. * bin: Removed. * skr: Removed (files moved to `src/guile/skribilo/packages'). * skribe: Removed. * doc/skr/env.skr (*courtes-mail*): New. * doc/user/user.skb: Removed postal addresses, added my name. * src/guile/skribilo/engine/lout.scm: Uncommented the slide-related markup writers. * src/guile/skribilo/evaluator.scm (%evaluate): Try weird things with source properties. * src/guile/skribilo/reader/skribe.scm: Comply with the new guile-reader API. * src/guile/skribilo/types.scm: Removed the special `initialize' method for ASTs which was supposed to set their location. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-7 --- doc/skr/env.skr | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/skr') diff --git a/doc/skr/env.skr b/doc/skr/env.skr index 09d5146..463b997 100644 --- a/doc/skr/env.skr +++ b/doc/skr/env.skr @@ -11,6 +11,7 @@ (define *serrano-url* "http://www.inria.fr/mimosa/Manuel.Serrano") (define *serrano-mail* "Manuel.Serrano@sophia.inria.fr") +(define *courtes-mail* "ludovic.courtes@laas.fr") (define *html-url* "http://www.w3.org/TR/html4") (define *html-form* "interact/forms.html") (define *emacs-url* "http://www.gnu.org/software/emacs") -- cgit v1.2.3 From f553cb65b157b6df9563cefa593902d59301461b Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Tue, 1 Nov 2005 16:19:34 +0000 Subject: Changes related to source-highlighting and to the manual. * src/guile/skribilo/engine/lout.scm (lout-make-doc-cover-sheet): Fixed the definition of MULTI-COLUMN? (fixes a bug when producing multi-column documents). (lout-definitions): `@SkribeLeaders' renamed to `@SkribiloLeaders'. * doc/skr/api.skr (api-search-definition): Fixed calls to `format'. * doc/skr/manual.skr (keyword): Use `write' instead of `keyword->string'. * doc/user/start.skb: Cosmetic changes. * src/guile/skribilo/coloring/lisp.scm: First stab at its adaptation. * src/guile/skribilo/coloring/xml.scm: Rewritten "by hand". * src/guile/skribilo/evaluator.scm (skribe-include): Removed debugging statements. * src/guile/skribilo/lib.scm (new): Added a trick such that users of this macro don't have to use `(oop goops)' and `(skribilo types)'. (date): New procedure. * src/guile/skribilo/module.scm (*skribe-core-modules*): Renamed to `%skribe-core-modules'. (%skribe-core-modules): Removed `(oop goops)'. Added `(skribilo source)', `(skribilo coloring lisp)' and `(skribilo coloring xml)'. * src/guile/skribilo/skribe/api.scm (footnote): Fixed. * src/guile/skribilo/source.scm: Cosmetic changes. * src/guile/skribilo/types.scm: Export `language-extractor' and `language-fontifier'. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-11 --- ChangeLog | 52 +++++++++++++++ doc/skr/api.skr | 7 ++- doc/skr/manual.skr | 4 +- doc/user/start.skb | 4 +- src/guile/skribilo/coloring/lisp.scm | 113 +++++++++++++++++---------------- src/guile/skribilo/coloring/xml.scm | 119 ++++++++++++++++++++++------------- src/guile/skribilo/engine/lout.scm | 11 ++-- src/guile/skribilo/evaluator.scm | 8 +-- src/guile/skribilo/lib.scm | 36 +++++++---- src/guile/skribilo/module.scm | 15 +++-- src/guile/skribilo/skribe/api.scm | 10 +-- src/guile/skribilo/source.scm | 23 +++---- src/guile/skribilo/types.scm | 6 +- 13 files changed, 250 insertions(+), 158 deletions(-) (limited to 'doc/skr') diff --git a/ChangeLog b/ChangeLog index cc89110..6d3e667 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,58 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2005-11-01 16:19:34 GMT Ludovic Courtes patch-11 + + Summary: + Changes related to source-highlighting and to the manual. + Revision: + skribilo--devel--1.2--patch-11 + + * src/guile/skribilo/engine/lout.scm (lout-make-doc-cover-sheet): Fixed + the definition of MULTI-COLUMN? (fixes a bug when producing + multi-column documents). + (lout-definitions): `@SkribeLeaders' renamed to `@SkribiloLeaders'. + + * doc/skr/api.skr (api-search-definition): Fixed calls to `format'. + + * doc/skr/manual.skr (keyword): Use `write' instead of `keyword->string'. + + * doc/user/start.skb: Cosmetic changes. + + * src/guile/skribilo/coloring/lisp.scm: First stab at its adaptation. + + * src/guile/skribilo/coloring/xml.scm: Rewritten "by hand". + + * src/guile/skribilo/evaluator.scm (skribe-include): Removed debugging + statements. + + * src/guile/skribilo/lib.scm (new): Added a trick such that users of this + macro don't have to use `(oop goops)' and `(skribilo types)'. + (date): New procedure. + + * src/guile/skribilo/module.scm (*skribe-core-modules*): Renamed to + `%skribe-core-modules'. + (%skribe-core-modules): Removed `(oop goops)'. Added `(skribilo + source)', `(skribilo coloring lisp)' and `(skribilo coloring xml)'. + + * src/guile/skribilo/skribe/api.scm (footnote): Fixed. + + * src/guile/skribilo/source.scm: Cosmetic changes. + + * src/guile/skribilo/types.scm: Export `language-extractor' and + `language-fontifier'. + + modified files: + ChangeLog doc/skr/api.skr doc/skr/manual.skr + doc/user/start.skb src/guile/skribilo/coloring/lisp.scm + src/guile/skribilo/coloring/xml.scm + src/guile/skribilo/engine/lout.scm + src/guile/skribilo/evaluator.scm src/guile/skribilo/lib.scm + src/guile/skribilo/module.scm + src/guile/skribilo/skribe/api.scm + src/guile/skribilo/source.scm src/guile/skribilo/types.scm + + 2005-10-31 23:26:24 GMT Ludovic Courtes patch-10 Summary: diff --git a/doc/skr/api.skr b/doc/skr/api.skr index a27c3a4..504dd5a 100644 --- a/doc/skr/api.skr +++ b/doc/skr/api.skr @@ -62,14 +62,15 @@ (let ((f (find-file/path file *skribe-source-path*))) (if (not (string? f)) (skribe-error 'api-search-definition - (format "Can't find source file `~a' in path" file) + (format #t "can't find source file `~a' in path" file) *skribe-source-path*) (with-input-from-file f (lambda () (let loop ((exp (read))) (if (eof-object? exp) - (skribe-error 'api-search-definition - (format "Can't find `~a' definition" id) + (skribe-error 'api-search-definition + (format #t + "can't find `~a' definition" id) file) (or (pred id exp) (loop (read)))))))))) diff --git a/doc/skr/manual.skr b/doc/skr/manual.skr index 1982237..30b2fcd 100644 --- a/doc/skr/manual.skr +++ b/doc/skr/manual.skr @@ -123,7 +123,9 @@ (markup '&source-key) (body (cond ((keyword? arg) - (keyword->string arg)) + (with-output-to-string + (lambda () + (write arg)))) ((symbol? arg) (string-append ":" (symbol->string arg))) (else diff --git a/doc/user/start.skb b/doc/user/start.skb index d437b3a..d478a7e 100644 --- a/doc/user/start.skb +++ b/doc/user/start.skb @@ -147,7 +147,8 @@ often need to generate some repetitive text. Skribe programming skills can be used to ease the construction of such documents as illustrated below. ,(disp (itemize - (map (lambda (x) (item [The square of ,(bold x) is ,(bold (* x x))])) + (map (lambda (x) + (item [The square of ,(bold x) is ,(bold (* x x))])) '(1 2 3 4 5 6 7 8 9)))) This text has been generated with the following piece of code ,(prgm :language skribe [ @@ -191,6 +192,5 @@ In order to compile to various formats one must type in:]) ,(disp :verb #t [ $ skribe file.skb -o file.html ,(char 35) ,(it "This produces an HTML file.") $ skribe file.skb -o file.tex ,(char 35) ,(it "This produces a TeX file.") -$ skribe file.skb -o file.man ,(char 35) ,(it "This produces a man page.") $ skribe file.skb -o file.info ,(char 35) ,(it "This produces an info page.") $ skribe file.skb -o file.mgp ,(char 35) ,(it "This produces a MagicPoint document")])])) diff --git a/src/guile/skribilo/coloring/lisp.scm b/src/guile/skribilo/coloring/lisp.scm index 53cf670..ad02431 100644 --- a/src/guile/skribilo/coloring/lisp.scm +++ b/src/guile/skribilo/coloring/lisp.scm @@ -1,46 +1,46 @@ ;;;; -;;;; lisp.stk -- Lisp Family Fontification -;;;; +;;;; lisp.scm -- Lisp Family Fontification +;;;; ;;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI -;;;; -;;;; +;;;; Copyright © 2005 Ludovic Courtès +;;;; +;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2 of the License, or ;;;; (at your option) any later version. -;;;; +;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this program; if not, write to the Free Software -;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. -;;;; +;;;; ;;;; Author: Erick Gallesio [eg@essi.fr] ;;;; Creation date: 16-Oct-2003 22:17 (eg) ;;;; Last file update: 28-Oct-2004 21:14 (eg) ;;;; -(require "lex-rt") ;; to avoid module problems +(define-module (skribilo coloring lisp) + :use-module (skribilo source) + :use-module (skribilo lib) + :use-module (skribilo runtime) + :export (skribe scheme stklos bigloo lisp)) -(define-module (skribilo lisp) - :export (skribe scheme stklos bigloo lisp) - :import (skribe source)) -(include "lisp-lex.stk") ;; SILex generated - -(define *bracket-highlight* #f) -(define *class-highlight* #f) -(define *the-keys* #f) +(define *bracket-highlight* (make-fluid)) +(define *class-highlight* (make-fluid)) +(define *the-keys* (make-fluid)) -(define *lisp-keys* #f) -(define *scheme-keys* #f) -(define *skribe-keys* #f) -(define *stklos-keys* #f) -(define *lisp-keys* #f) +(define *lisp-keys* (make-fluid)) +(define *scheme-keys* (make-fluid)) +(define *skribe-keys* (make-fluid)) +(define *stklos-keys* (make-fluid)) +(define *lisp-keys* (make-fluid)) ;;; @@ -57,17 +57,17 @@ (define (lisp-family-fontifier s) - (let ((lex (lisp-lex (open-input-string s)))) - (let Loop ((token (lexer-next-token lex)) + (let ((lisp-input (open-input-string s))) + (let loop ((token (read lisp-input)) (res '())) - (if (eq? token 'eof) + (if (eof-object? token) (reverse! res) - (Loop (lexer-next-token lex) + (loop (read lisp-input) (cons token res)))))) ;;;; ====================================================================== ;;;; -;;;; LISP +;;;; LISP ;;;; ;;;; ====================================================================== (define (lisp-extractor iport def tab) @@ -77,17 +77,17 @@ (lambda (exp) (match-case exp (((or defun defmacro) ?fun ?- . ?-) - (and (eq? def fun) exp)) + (and (eq? def fun) exp)) ((defvar ?var . ?-) - (and (eq? var def) exp)) + (and (eq? var def) exp)) (else - #f))))) + #f))))) (define (init-lisp-keys) (unless *lisp-keys* (set! *lisp-keys* (append ;; key - (map (lambda (x) (cons x '&source-keyword)) + (map (lambda (x) (cons x '&source-keyword)) '(setq if let let* letrec cond case else progn lambda)) ;; define (map (lambda (x) (cons x '&source-define)) @@ -95,9 +95,9 @@ *lisp-keys*) (define (lisp-fontifier s) - (fluid-let ((*the-keys* (init-lisp-keys)) - (*bracket-highlight* #f) - (*class-highlight* #f)) + (with-fluids ((*the-keys* (init-lisp-keys)) + (*bracket-highlight* #f) + (*class-highlight* #f)) (lisp-family-fontifier s))) @@ -109,7 +109,7 @@ ;;;; ====================================================================== ;;;; -;;;; SCHEME +;;;; SCHEME ;;;; ;;;; ====================================================================== (define (scheme-extractor iport def tab) @@ -130,7 +130,7 @@ (unless *scheme-keys* (set! *scheme-keys* (append ;; key - (map (lambda (x) (cons x '&source-keyword)) + (map (lambda (x) (cons x '&source-keyword)) '(set! if let let* letrec quote cond case else begin do lambda)) ;; define (map (lambda (x) (cons x '&source-define)) @@ -139,11 +139,11 @@ (define (scheme-fontifier s) - (fluid-let ((*the-keys* (init-scheme-keys)) - (*bracket-highlight* #f) - (*class-highlight* #f)) + (with-fluids ((*the-keys* (init-scheme-keys)) + (*bracket-highlight* #f) + (*class-highlight* #f)) (lisp-family-fontifier s))) - + (define scheme (new language @@ -153,7 +153,7 @@ ;;;; ====================================================================== ;;;; -;;;; STKLOS +;;;; STKLOS ;;;; ;;;; ====================================================================== (define (stklos-extractor iport def tab) @@ -164,11 +164,11 @@ (match-case exp (((or define define-generic define-method define-macro) (?fun . ?-) . ?-) - (and (eq? def fun) exp)) + (and (eq? def fun) exp)) (((or define define-module) (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) + (and (eq? var def) exp)) (else - #f))))) + #f))))) (define (init-stklos-keys) @@ -192,9 +192,9 @@ (define (stklos-fontifier s) - (fluid-let ((*the-keys* (init-stklos-keys)) - (*bracket-highlight* #t) - (*class-highlight* #t)) + (with-fluids ((*the-keys* (init-stklos-keys)) + (*bracket-highlight* #t) + (*class-highlight* #t)) (lisp-family-fontifier s))) @@ -206,7 +206,7 @@ ;;;; ====================================================================== ;;;; -;;;; SKRIBE +;;;; SKRIBE ;;;; ;;;; ====================================================================== (define (skribe-extractor iport def tab) @@ -250,12 +250,12 @@ (map (lambda (x) (cons x '&source-define)) '(define-markup))))) *skribe-keys*) - + (define (skribe-fontifier s) - (fluid-let ((*the-keys* (init-skribe-keys)) - (*bracket-highlight* #t) - (*class-highlight* #t)) + (with-fluids ((*the-keys* (init-skribe-keys)) + (*bracket-highlight* #t) + (*class-highlight* #t)) (lisp-family-fontifier s))) @@ -267,7 +267,7 @@ ;;;; ====================================================================== ;;;; -;;;; BIGLOO +;;;; BIGLOO ;;;; ;;;; ====================================================================== (define (bigloo-extractor iport def tab) @@ -279,15 +279,14 @@ (((or define define-inline define-generic define-method define-macro define-expander) (?fun . ?-) . ?-) - (and (eq? def fun) exp)) + (and (eq? def fun) exp)) (((or define define-struct define-library) (and (? symbol?) ?var) . ?-) - (and (eq? var def) exp)) + (and (eq? var def) exp)) (else - #f))))) + #f))))) (define bigloo (new language (name "bigloo") (fontifier scheme-fontifier) (extractor bigloo-extractor))) - diff --git a/src/guile/skribilo/coloring/xml.scm b/src/guile/skribilo/coloring/xml.scm index d71e98c..e3db36f 100644 --- a/src/guile/skribilo/coloring/xml.scm +++ b/src/guile/skribilo/coloring/xml.scm @@ -1,53 +1,82 @@ -;;;; -;;;; xml.stk -- XML Fontification stuff -;;;; -;;;; Copyright © 2003 Erick Gallesio - I3S-CNRS/ESSI -;;;; -;;;; -;;;; This program is free software; you can redistribute it and/or modify -;;;; it under the terms of the GNU General Public License as published by -;;;; the Free Software Foundation; either version 2 of the License, or -;;;; (at your option) any later version. -;;;; -;;;; This program is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;;; GNU General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU General Public License -;;;; along with this program; if not, write to the Free Software -;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -;;;; USA. -;;;; -;;;; Author: Erick Gallesio [eg@essi.fr] -;;;; Creation date: 16-Oct-2003 22:33 (eg) -;;;; Last file update: 28-Dec-2003 17:33 (eg) -;;;; - - -;(require "lex-rt") ;; to avoid module problems - - -(define-module (skribilo xml) - :export (xml)) - -(use-modules (skribilo source)) - -(include "xml-lex.stk") ;; SILex generated - -(define (xml-fontifier s) - (let ((lex (xml-lex (open-input-string s)))) - (let Loop ((token (lexer-next-token lex)) - (res '())) - (if (eq? token 'eof) - (reverse! res) - (Loop (lexer-next-token lex) - (cons token res)))))) +;;; xml.scm -- XML syntax highlighting. +;;; +;;; Copyright 2005 Ludovic Courtès +;;; +;;; +;;; This program is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 2 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +(define-module (skribilo coloring xml) + :export (xml) + :use-module (skribilo source) + :use-module (skribilo lib) + :use-module (ice-9 rdelim) + :use-module (ice-9 regex)) + + +(define %comment-rx (make-regexp "" regexp/extended)) + +(define (xml-fontifier str) + (let loop ((start 0) + (result '())) + (if (>= start (string-length str)) + (reverse! result) + (case (string-ref str start) + ((#\") + (let ((end (string-index str start #\"))) + (if (not end) + (skribe-error 'xml-fontifier + "unterminated XML string" + (string-drop str start)) + (loop end + (cons (new markup + (markup '&source-string) + (body (substring str start end))) + result))))) + ((#\<) + (let ((end (string-index str #\> start))) + (if (not end) + (skribe-error 'xml-fontifier + "unterminated XML tag" + (string-drop str start)) + (let ((comment? (regexp-exec %comment-rx + (substring str start end)))) + (loop end + (cons (if comment? + (new markup + (markup '&source-comment) + (body (substring str start end))) + (new markup + (markup '&source-module) + (body (substring str start end)))) + result)))))) + + (else + (loop (+ 1 start) + (if (or (null? result) + (not (string? (car result)))) + (cons (string (string-ref str start)) result) + (cons (string-append (car result) + (string (string-ref str start))) + (cdr result))))))))) + + (define xml (new language (name "xml") (fontifier xml-fontifier) (extractor #f))) +;;; xml.scm ends here diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index b466ac1..36df9f9 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -384,10 +384,10 @@ " @PageMark @Tag\n" "}\n\n" - "# @SkribeLeaders is used in `toc'\n" + "# @SkribiloLeaders is used in `toc'\n" "# (this is mostly copied from the expert's guide)\n" - "def @SkribeLeaders { " - ,leader " |" ,leader-space " @SkribeLeaders }\n\n")))) + "def @SkribiloLeaders { " + ,leader " |" ,leader-space " @SkribiloLeaders }\n\n")))) (define (lout-make-doc-cover-sheet doc engine) ;; Create a cover sheet for node `doc' which is a doc-style Lout document. @@ -397,7 +397,8 @@ (author (markup-option doc :author)) (date-line (engine-custom engine 'date-line)) (cover-sheet? (engine-custom engine 'cover-sheet?)) - (multi-column? (> 1 (engine-custom engine 'column-number)))) + (multi-column? (> (engine-custom engine 'column-number) 1))) + (if multi-column? ;; In single-column document, `@FullWidth' yields a blank page. (display "\n@FullWidth {")) @@ -1205,7 +1206,7 @@ (entry-proc node engine) (display " &1rt @OneCol { ") - (printf " @SkribeLeaders & @PageOf { ~a }" + (printf " @SkribiloLeaders & @PageOf { ~a }" (lout-tagify (markup-ident node))) (display " &0io } }") diff --git a/src/guile/skribilo/evaluator.scm b/src/guile/skribilo/evaluator.scm index 974d72a..def3280 100644 --- a/src/guile/skribilo/evaluator.scm +++ b/src/guile/skribilo/evaluator.scm @@ -175,16 +175,14 @@ path)) (when (> *skribe-verbose* 0) (format (current-error-port) " [including file: ~S]\n" path)) + (with-input-from-file path (lambda () (let Loop ((exp (%default-reader (current-input-port))) (res '())) - (format (current-error-port) "exp=~a~%" exp) (if (eof-object? exp) - (begin - (format (current-error-port) "include: eof reached~%") - (if (and (pair? res) (null? (cdr res))) + (if (and (pair? res) (null? (cdr res))) (car res) - (reverse! res))) + (reverse! res)) (Loop (%default-reader (current-input-port)) (cons (%evaluate exp) res)))))))) diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm index d916db4..2961fc6 100644 --- a/src/guile/skribilo/lib.scm +++ b/src/guile/skribilo/lib.scm @@ -1,5 +1,5 @@ ;;; -;;; lib.stk -- Utilities +;;; lib.scm -- Utilities ;;; ;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI ;;; @@ -18,11 +18,6 @@ ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;; USA. -;;; -;;; Author: Erick Gallesio [eg@essi.fr] -;;; Creation date: 11-Aug-2003 20:29 (eg) -;;; Last file update: 27-Oct-2004 12:41 (eg) -;;; (read-set! keywords 'prefix) @@ -59,7 +54,9 @@ hashtable->list skribe-read - find-runtime-type) + find-runtime-type + + date) :export-syntax (new define-markup define-simple-markup define-simple-container define-processor-markup @@ -73,6 +70,8 @@ :use-module (skribilo vars) :use-module (srfi srfi-1) + :use-module ((srfi srfi-19) :renamer (symbol-prefix-proc 's19:)) ;; date + :use-module (oop goops) :use-module (ice-9 optargs)) @@ -81,11 +80,20 @@ ;;; ;;; NEW ;;; + +(define %types-module (resolve-module '(skribilo types))) + (define-macro (new class . parameters) - `(make ,(string->symbol (format #f "<~a>" class)) - ,@(apply append (map (lambda (x) - `(,(symbol->keyword (car x)) ,(cadr x))) - parameters)))) + ;; Thanks to the trick below, modules don't need to import `(oop goops)' + ;; and `(skribilo types)' in order to make use of `new'. + (let* ((class-name (symbol-append '< class '>)) + (actual-class (module-ref %types-module class-name))) + `(let ((make ,make) + (,class-name ,actual-class)) + (make ,class-name + ,@(apply append (map (lambda (x) + `(,(symbol->keyword (car x)) ,(cadr x))) + parameters)))))) ;;; ;;; DEFINE-MARKUP @@ -387,3 +395,9 @@ (define-macro (when condition . exprs) `(if ,condition (begin ,@exprs))) + +(define (date) + (s19:date->string (s19:current-date) "~c")) + + +;;; lib.scm ends here diff --git a/src/guile/skribilo/module.scm b/src/guile/skribilo/module.scm index 1a8f622..bb0c5ad 100644 --- a/src/guile/skribilo/module.scm +++ b/src/guile/skribilo/module.scm @@ -42,7 +42,6 @@ '((srfi srfi-1) ;; lists (srfi srfi-13) ;; strings ;(srfi srfi-19) ;; date and time - (oop goops) ;; `make' (ice-9 optargs) ;; `define*' (ice-9 and-let-star) ;; `and-let*' (ice-9 receive) ;; `receive' @@ -60,9 +59,13 @@ (skribilo output) (skribilo evaluator) (skribilo color) - (skribilo debug))) + (skribilo debug) + (skribilo source) ;; `source-read-lines', `source-fontify', etc. + (skribilo coloring lisp) ;; `skribe', `scheme', `lisp' + (skribilo coloring xml) ;; `xml' + )) -(define *skribe-core-modules* +(define %skribe-core-modules '("utils" "api" "bib" "index" "param" "sui")) (define-macro (define-skribe-module name . options) @@ -81,7 +84,7 @@ ,(string->symbol mod)))) (and (not (equal? m name)) m))) - *skribe-core-modules*))))) + %skribe-core-modules))))) ;; Make it available to the top-level module. @@ -106,7 +109,7 @@ execution of Skribilo/Skribe code." (map (lambda (mod) `(skribilo skribe ,(string->symbol mod))) - *skribe-core-modules*))) + %skribe-core-modules))) (set-module-name! the-module '(skribilo-user)) the-module)) @@ -152,7 +155,7 @@ hierarchy and in @code{(run-time-module)}." (module-use! (run-time-module) (resolve-module `(skribilo skribe ,(string->symbol mod))))) - *skribe-core-modules*)) + %skribe-core-modules)) ;;; module.scm ends here diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm index d66b3b4..34528ac 100644 --- a/src/guile/skribilo/skribe/api.scm +++ b/src/guile/skribilo/skribe/api.scm @@ -274,8 +274,8 @@ (new unresolved (proc (lambda (n e env) (resolve-counter n env - 'footnote #t))))) - ,@(the-options opts :ident :class))))) + 'footnote #t)))))) + ,@(the-options opts :ident :class)))) (body (the-body opts)))) ;*---------------------------------------------------------------------*/ @@ -466,9 +466,9 @@ "start line > stop line" (format #f "~a/~a" start stop))) ((and language (not (language? language))) - (skribe-error 'source "Illegal language" language)) + (skribe-error 'source "illegal language" language)) ((and tab (not (integer? tab))) - (skribe-error 'source "Illegal tab" tab)) + (skribe-error 'source "illegal tab" tab)) (file (let ((s (if (not definition) (source-read-lines file start stop tab) @@ -489,7 +489,7 @@ ;*---------------------------------------------------------------------*/ (define-markup (language #!key name (fontifier #f) (extractor #f)) (if (not (string? name)) - (skribe-type-error 'language "Illegal name, " name "string") + (skribe-type-error 'language "illegal name" name "string") (new language (name name) (fontifier fontifier) diff --git a/src/guile/skribilo/source.scm b/src/guile/skribilo/source.scm index c682687..e03deae 100644 --- a/src/guile/skribilo/source.scm +++ b/src/guile/skribilo/source.scm @@ -1,7 +1,8 @@ ;;;; -;;;; source.stk -- Skibe SOURCE implementation stuff +;;;; source.scm -- Highlighting source files. ;;;; ;;;; Copyright © 2003-2004 Erick Gallesio - I3S-CNRS/ESSI +;;;; Copyright © 2005 Ludovic Courtès ;;;; ;;;; ;;;; This program is free software; you can redistribute it and/or modify @@ -19,24 +20,16 @@ ;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. ;;;; -;;;; Author: Erick Gallesio [eg@essi.fr] -;;;; Creation date: 3-Sep-2003 12:22 (eg) -;;;; Last file update: 27-Oct-2004 20:09 (eg) -;;;; (define-module (skribilo source) :export (source-read-lines source-read-definition source-fontify) - :use-module (skribilo vars)) - - -;; Temporary solution -(define (language-extractor lang) - (slot-ref lang 'extractor)) + :use-module (skribilo types) + :use-module (skribilo vars) + :use-module (skribilo lib) + :use-module (ice-9 rdelim)) -(define (language-fontifier lang) - (slot-ref lang 'fontifier)) ;*---------------------------------------------------------------------*/ @@ -172,7 +165,7 @@ (if (= i j) (reverse! r) (reverse! (cons (substring str j i) r)))) - ((char=? (string-ref str i) #\Newline) + ((char=? (string-ref str i) #\newline) (loop (+ i 1) (+ i 1) (if (= i j) @@ -180,7 +173,7 @@ (cons* 'eol (substring str j i) r)))) ((and (char=? (string-ref str i) #\cr) (< (+ i 1) l) - (char=? (string-ref str (+ i 1)) #\Newline)) + (char=? (string-ref str (+ i 1)) #\newline)) (loop (+ i 2) (+ i 2) (if (= i j) diff --git a/src/guile/skribilo/types.scm b/src/guile/skribilo/types.scm index c6188b6..ac1edc4 100644 --- a/src/guile/skribilo/types.scm +++ b/src/guile/skribilo/types.scm @@ -43,7 +43,7 @@ container-ident container-body document? document-ident document-body document-options document-end - language? + language? language-extractor language-fontifier location? ast-location location-file location-line location-pos @@ -283,8 +283,8 @@ ;;; ====================================================================== (define-class () (name :init-keyword :name :init-value #f :getter langage-name) - (fontifier :init-keyword :fontifier :init-value #f :getter langage-fontifier) - (extractor :init-keyword :extractor :init-value #f :getter langage-extractor)) + (fontifier :init-keyword :fontifier :init-value #f :getter language-fontifier) + (extractor :init-keyword :extractor :init-value #f :getter language-extractor)) (define (language? obj) (is-a? obj )) -- cgit v1.2.3