summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Court`es2005-06-15 14:04:36 +0000
committerLudovic Court`es2005-06-15 14:04:36 +0000
commit8de14180fa2e4aa3cbd8cd85f8080985a59557f9 (patch)
tree96350851a6559fc27425bae583487876d4a765c7
parent7ad6b0a5a2936cb7b63314d4b24e8b87f9d34315 (diff)
downloadskribilo-8de14180fa2e4aa3cbd8cd85f8080985a59557f9.tar.gz
skribilo-8de14180fa2e4aa3cbd8cd85f8080985a59557f9.tar.lz
skribilo-8de14180fa2e4aa3cbd8cd85f8080985a59557f9.zip
Various bugfixes; added `:label' to `footnote'.
* src/common/api.scm: For chapters, sections, subsections and subsubsections, make the default value of `ident' a random name produced by `gensym'. This allows to avoid name clashes. (footnote): Renamed `:number' to `:label'. Allow users to pass either a boolean, a string, or a number. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-3
-rw-r--r--src/common/api.scm26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/common/api.scm b/src/common/api.scm
index 397ba09..eb657c7 100644
--- a/src/common/api.scm
+++ b/src/common/api.scm
@@ -139,7 +139,7 @@
title (html-title #f) (file #f) (toc #t) (number #t))
(new container
(markup 'chapter)
- (ident (or ident (ast->string title)))
+ (ident (or ident (symbol->string (gensym 'chapter))))
(class class)
(required-options '(:title :file :toc :number))
(options `((:toc ,toc)
@@ -179,7 +179,7 @@
title (file #f) (toc #t) (number #t))
(new container
(markup 'section)
- (ident (or ident (ast->string title)))
+ (ident (or ident (symbol->string (gensym 'section))))
(class class)
(required-options '(:title :toc :file :toc :number))
(options `((:number ,(section-number number 'section))
@@ -206,7 +206,7 @@
title (file #f) (toc #t) (number #t))
(new container
(markup 'subsection)
- (ident (or ident (ast->string title)))
+ (ident (or ident (symbol->string (gensym 'subsection))))
(class class)
(required-options '(:title :toc :file :number))
(options `((:number ,(section-number number 'subsection))
@@ -230,7 +230,7 @@
title (file #f) (toc #f) (number #t))
(new container
(markup 'subsubsection)
- (ident (or ident (ast->string title)))
+ (ident (or ident (symbol->string (gensym 'subsubsection))))
(class class)
(required-options '(:title :toc :number :file))
(options `((:number ,(section-number number 'subsubsection))
@@ -247,17 +247,23 @@
;* footnote ... */
;*---------------------------------------------------------------------*/
(define-markup (footnote #!rest opts
- #!key (ident #f) (class "footnote") (number #f))
+ #!key (ident #f) (class "footnote") (label #t))
+ ;; The `:label' option used to be called `:number'.
(new container
(markup 'footnote)
(ident (symbol->string (gensym 'footnote)))
(class class)
(required-options '())
- (options `((:number
- ,(new unresolved
- (proc (lambda (n e env)
- (resolve-counter n env 'footnote #t)))))
- ,@(the-options opts :ident :class)))
+ (options `((:label
+ ,(cond ((string? label) label)
+ ((number? label) label)
+ ((not label) label)
+ (else
+ (new unresolved
+ (proc (lambda (n e env)
+ (resolve-counter n env
+ 'footnote #t)))))
+ ,@(the-options opts :ident :class)))))
(body (the-body opts))))
;*---------------------------------------------------------------------*/