aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes2007-07-29 10:30:23 +0000
committerLudovic Courtes2007-07-29 10:30:23 +0000
commitff09ac326b8288098f780c07ce66ca6eb672618c (patch)
tree05acb7b4dd1320418612c5ac045b392fb35a9244
parent9e33c564d4bf526239c04d2de1f37bc0aaf92e5e (diff)
downloadskribilo-ff09ac326b8288098f780c07ce66ca6eb672618c.tar.gz
skribilo-ff09ac326b8288098f780c07ce66ca6eb672618c.tar.lz
skribilo-ff09ac326b8288098f780c07ce66ca6eb672618c.zip
Allow arbitrary keyword arguments in `define-markup'.
* src/guile/skribilo/lib.scm (define-markup)[fix-rest-arg]: Add `:allow-other-keys' so that package like `html-navtabs' can require extra keyword arguments. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-142
-rw-r--r--ChangeLog18
-rw-r--r--src/guile/skribilo/lib.scm41
2 files changed, 43 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index a5763e6..be0b17a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,24 @@
# arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2
#
+2007-07-29 10:30:23 GMT Ludovic Courtes <ludo@gnu.org> patch-142
+
+ Summary:
+ Allow arbitrary keyword arguments in `define-markup'.
+ Revision:
+ skribilo--devo--1.2--patch-142
+
+ * src/guile/skribilo/lib.scm (define-markup)[fix-rest-arg]: Add
+ `:allow-other-keys' so that package like `html-navtabs' can require
+ extra keyword arguments.
+
+ modified files:
+ ChangeLog src/guile/skribilo/lib.scm
+
+ new patches:
+ lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-126
+
+
2007-07-29 10:29:53 GMT Ludovic Courtes <ludo@gnu.org> patch-141
Summary:
diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm
index 3be013a..8c4c382 100644
--- a/src/guile/skribilo/lib.scm
+++ b/src/guile/skribilo/lib.scm
@@ -1,7 +1,7 @@
;;; lib.scm -- Utilities.
;;;
;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
-;;; Copyright 2005, 2007 Ludovic Courtès <ludovic.courtes@laas.fr>
+;;; Copyright 2005, 2007 Ludovic Courtès <ludo@gnu.org>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -73,29 +73,38 @@
(define-macro (define-markup bindings . body)
;; This is just an `(ice-9 optargs)' kind of `lambda*', with DSSSL
;; keyword-style conversion enabled. However, using `(ice-9 optargs)', the
- ;; `#:rest' argument can only appear last, which is not what Skribe/DSSSL
- ;; expect, hence `fix-rest-arg'.
+ ;; `:rest' argument can only appear last, which is not what Skribe/DSSSL
+ ;; expect, hence `fix-rest-arg'. In addition, all keyword arguments are
+ ;; allowed (hence `:allow-other-keys'); they are then checked by `verify'.
(define (fix-rest-arg args)
- (let loop ((args args)
- (result '())
- (rest-arg #f))
+ (let loop ((args args)
+ (result '())
+ (rest-arg '())
+ (has-keywords? #f))
(cond ((null? args)
- (if rest-arg
- (append (reverse result) rest-arg)
- (reverse result)))
+ (let ((result (if has-keywords?
+ (cons :allow-other-keys result)
+ result)))
+ (append! (reverse! result) rest-arg)))
((list? args)
- (let ((is-rest-arg? (eq? (car args) #:rest)))
- (loop (if is-rest-arg? (cddr args) (cdr args))
- (if is-rest-arg? result (cons (car args) result))
- (if is-rest-arg?
- (list (car args) (cadr args))
- rest-arg))))
+ (let ((is-rest-arg? (eq? (car args) :rest))
+ (is-keyword? (eq? (car args) :key)))
+ (if is-rest-arg?
+ (loop (cddr args)
+ result
+ (list (car args) (cadr args))
+ (or has-keywords? is-keyword?))
+ (loop (cdr args)
+ (cons (car args) result)
+ rest-arg
+ (or has-keywords? is-keyword?)))))
((pair? args)
(loop '()
(cons (car args) result)
- (list #:rest (cdr args)))))))
+ (list #:rest (cdr args))
+ has-keywords?)))))
(let ((name (car bindings))
(opts (cdr bindings)))