From 8de14180fa2e4aa3cbd8cd85f8080985a59557f9 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Wed, 15 Jun 2005 14:04:36 +0000 Subject: 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 --- src/common/api.scm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/common') 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)))) ;*---------------------------------------------------------------------*/ -- cgit v1.2.3