From 468af210d5bb490a7a737d4e840eb0f53caef7a3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 30 Jan 2008 19:13:06 +0100 Subject: web-book2: Cosmetic changes. * src/guile/skribilo/package/web-book2.scm (%small-toc-class): New. (make-small-toc): New `e' argument. [enclose]: New. Use HTML
, preferably. --- src/guile/skribilo/package/web-book2.scm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/guile') diff --git a/src/guile/skribilo/package/web-book2.scm b/src/guile/skribilo/package/web-book2.scm index 978d012..8b50e99 100644 --- a/src/guile/skribilo/package/web-book2.scm +++ b/src/guile/skribilo/package/web-book2.scm @@ -49,26 +49,36 @@ ;;; Small table-of-contents. ;;; +(define %small-toc-class + "small-toc") + (define (section? n) (and (container? n) (memq (markup-markup n) '(chapter section subsection subsubsection)))) -(define (make-small-toc n) +(define (make-small-toc n e) ;; Return a small table of contents, for use at the beginning of chapter N. + (define enclose + (if (engine-format? "html" e) + (lambda (toc) + (! (format #f "\n
\n$1\n
" %small-toc-class) + toc)) + (lambda (toc) + (p :class %small-toc-class toc)))) + (define (make-uplink) (let ((parent (ast-parent n))) (and parent (ref :handle (handle parent) - :text (list "<< up to ``" - (markup-option parent :title) - "''"))))) + :text (list (symbol "uparrow") " " + (markup-option parent :title)))))) (let ((kids (filter section? (markup-body n)))) - (p :class "small-toc" + (enclose (list (and (not (null? kids)) - (list "Table of Contents" + (list "Contents" (itemize (map (lambda (section) (item (ref :handle (handle section) @@ -105,7 +115,7 @@ (cons (resolve (lambda (n e env) (let ((p (ast-parent n))) (and (in-file-of-its-own? p e) - (make-small-toc p))))) + (make-small-toc p e))))) (the-body args)))) (apply real-markup args))))) -- cgit v1.2.3