summaryrefslogtreecommitdiff
path: root/doc/modules
diff options
context:
space:
mode:
authorLudovic Courtès2008-01-28 17:21:05 +0100
committerLudovic Courtès2008-01-28 17:21:05 +0100
commitab9575332feb5dee3f1ca408214feec3a18c7ea8 (patch)
tree475fa9e44e054f0183d9179a414fe50cce195374 /doc/modules
parentdc850910150673f6c7ece322ff6e39ce70c70cbe (diff)
downloadskribilo-ab9575332feb5dee3f1ca408214feec3a18c7ea8.tar.gz
skribilo-ab9575332feb5dee3f1ca408214feec3a18c7ea8.tar.lz
skribilo-ab9575332feb5dee3f1ca408214feec3a18c7ea8.zip
doc: Provide nicer `doc-markup' output for `lout'.
* doc/modules/skribilo/documentation/api.scm: New lout customization. (punctuate): New. (doc-markup)[doc-markup.lout]: New. Use it.
Diffstat (limited to 'doc/modules')
-rw-r--r--doc/modules/skribilo/documentation/api.scm102
1 files changed, 101 insertions, 1 deletions
diff --git a/doc/modules/skribilo/documentation/api.scm b/doc/modules/skribilo/documentation/api.scm
index 1426521..0a52300 100644
--- a/doc/modules/skribilo/documentation/api.scm
+++ b/doc/modules/skribilo/documentation/api.scm
@@ -1,6 +1,6 @@
;;; api.scm -- The style for documenting Scheme APIs.
;;;
-;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2006, 2007, 2008 Ludovic Courtès <ludo@gnu.org>
;;; Copyright 2003, 2004 Manuel Serrano
;;;
;;;
@@ -85,6 +85,70 @@
(output n e tro)))))
;*---------------------------------------------------------------------*/
+;* Lout configuration */
+;*---------------------------------------------------------------------*/
+(let ((le (find-engine 'lout)))
+
+ (let ((defs (engine-custom le 'inline-definitions-proc)))
+ (engine-custom-set! le 'inline-definitions-proc
+ (lambda (e)
+ (string-append (defs e) "\n"
+ "def @DocHeading right x\n{\n"
+ "{ Helvetica Base } @Font x\n}\n"))))
+
+ (markup-writer 'doc-markup
+ :action (lambda (n e)
+ (let ((protos (markup-option n 'prototypes))
+ (opts (markup-option n 'options))
+ (params (markup-option n 'parameters))
+ (see (markup-option n 'see-also)))
+ ;;(format #t "\n@LP\n@DocHeading { Prototype }\n@LP\n")
+ (format #t "\n@LP\n{ oragged nohyphen } @Break { ")
+ (for-each (lambda (p)
+ (output (! "\n@LP\n$1" p) e))
+ protos)
+ (format #t "\n} @LP\n\n")
+ (and (pair? opts)
+ (for-each (lambda (o)
+ (let ((name (list-ref o 0))
+ (engines (list-ref o 1))
+ (desc (list-ref o 2)))
+ (output (list (! "\n|2fx { ")
+ (! "\n{ $1 } @Right { $2 }"
+ (tt name) (sf engines))
+ (! "\n@LP\n|2fx { $1 } }\n@LP\n"
+ desc))
+ e)))
+ opts))
+ (and (pair? params)
+ (for-each (lambda (p)
+ (let ((name (car p))
+ (desc (cdr p)))
+ (output (list (! "\n|2fx { ")
+ (! "\n{ $1 }" (tt name))
+ (! "\n@LP\n|2fx { $1 } }\n@LP\n"
+ desc))
+ e)))
+ params))
+
+ (and (pair? see)
+ (output (! "@LP\n|2fx { See also { $1 } }\n"
+ (punctuate see))
+ e))
+
+ (format #t "\n@LP\n")))))
+
+(define (punctuate lst)
+ ;; Punctuate words (ASTs) listed in LST.
+ (or (null? lst)
+ (reverse (cons "."
+ (cdr (fold (lambda (word result)
+ (cons* ", " word result))
+ '()
+ lst))))))
+
+
+;*---------------------------------------------------------------------*/
;* api-search-definition ... */
;* ------------------------------------------------------------- */
;* Find a definition inside a source file. */
@@ -561,6 +625,36 @@
(subsubsection :title "See also" :number #f :toc #f
(p so)
(! "\\noindent"))))))
+ (define (doc-markup.lout)
+ (let ((df (map (lambda (f)
+ (cons (param (car f)) (cadr f)))
+ dformals))
+ (dr (if (pair? drest)
+ (list (cons (param (cadr (car drest)))
+ (caddr (car drest))))
+ '()))
+ (do (map (lambda (f)
+ (list (param (car f))
+ (opt-engine-support (car f))
+ (cadr f)))
+ doptions))
+ (so (map (lambda (x)
+ (let ((s (symbol->string x)))
+ (list
+ (ref :mark s :page #t
+ :text (code s))
+ " ")))
+ see-also)))
+ (new container
+ (markup 'doc-markup)
+ (ident (gensym "doc-markup"))
+ (class #f)
+ (loc &invocation-location)
+ (options `((prototypes ,p+)
+ (options ,do)
+ (parameters ,(append df dr))
+ (see-also ,so))))))
+
;; check all the descriptions
(doc-check-arguments id formals dformals)
(doc-check-arguments id options doptions)
@@ -581,6 +675,8 @@
(cond
((engine-format? "latex")
(doc-markup.latex))
+ ((engine-format? "lout")
+ (doc-markup.lout))
(else
(center (doc-markup.html)))))))))
@@ -630,3 +726,7 @@
(td :align 'left :valign 'top (cadr r))))
(filter cadr args)))))))))
+
+;;; Local Variables:
+;;; coding: latin-1
+;;; End: