aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès2012-05-26 16:36:56 +0200
committerLudovic Courtès2012-05-28 23:54:16 +0200
commit429523231bb3c64b16df3c1ff2d53418be98a199 (patch)
treed95c00310830a08f70407f6adaacecaf8fd22087 /doc
parentfb99e3705b8f94a289fd2fedb9fa4f0bcfe74cf3 (diff)
downloadskribilo-429523231bb3c64b16df3c1ff2d53418be98a199.tar.gz
skribilo-429523231bb3c64b16df3c1ff2d53418be98a199.tar.lz
skribilo-429523231bb3c64b16df3c1ff2d53418be98a199.zip
doc: Improve Info rendering.
* doc/modules/skribilo/documentation/api.scm (ie)[doc-markup]: Use a justifier to output the markup prototypes slightly indented. Prepend "-- Markup: ". (doc-markup-proto): When using the `info' engine, annihilate `code' and `bold'. * doc/modules/skribilo/documentation/manual.scm (param): When using the `info' engine, render parameters as uppercase, without `code'.
Diffstat (limited to 'doc')
-rw-r--r--doc/modules/skribilo/documentation/api.scm57
-rw-r--r--doc/modules/skribilo/documentation/manual.scm6
2 files changed, 41 insertions, 22 deletions
diff --git a/doc/modules/skribilo/documentation/api.scm b/doc/modules/skribilo/documentation/api.scm
index ee1f341..d4f0781 100644
--- a/doc/modules/skribilo/documentation/api.scm
+++ b/doc/modules/skribilo/documentation/api.scm
@@ -29,6 +29,7 @@
:use-module (skribilo lib) ;; `define-markup'
:use-module (skribilo utils compat)
:use-module (skribilo utils syntax)
+ :use-module (skribilo utils justify) ; for `info'
:use-module (skribilo package base)
:use-module (skribilo documentation manual)
@@ -192,13 +193,19 @@ def @SkribiloExample named @Title {} right x {
(let ((protos (markup-option n 'prototypes))
(opts (markup-option n 'options))
(params (markup-option n 'parameters))
- (see (markup-option n 'see-also)))
+ (see (markup-option n 'see-also))
+ (margin *margin*))
(output (linebreak) e)
- (for-each (lambda (p)
- (output (list (linebreak) p) e))
- protos)
- (output (linebreak) e)
+ (with-justification
+ (make-justifier (- (justification-width) 2) 'left)
+ (lambda ()
+ (for-each (lambda (p)
+ (output "-- Markup: " e)
+ (output p e))
+ protos))
+ (+ *margin* 1))
+
(and (pair? opts)
(output
(description
@@ -229,7 +236,7 @@ def @SkribiloExample named @Title {} right x {
;; Since Emacs' Info reader automatically precedes each
;; *Note with "see ", just write "Also" instead of "See
;; also".
- (output (list "Also, " (punctuate see)) e))
+ (output (cons "Also, " (punctuate see)) e))
(output (linebreak) e)))))
@@ -489,30 +496,38 @@ def @SkribiloExample named @Title {} right x {
;* doc-markup-proto ... */
;*---------------------------------------------------------------------*/
(define (doc-markup-proto id options formals rest)
+ (define bold*
+ (if (engine-format? "info")
+ list
+ bold))
+ (define code*
+ (if (engine-format? "info")
+ list
+ code))
(define (option opt)
(if (pair? opt)
(if (eq? (cadr opt) #f)
(list " [" (keyword (car opt)) "]")
(list " [" (keyword (car opt)) " "
- (code (exp->skribe (cadr opt))) "]"))
+ (code* (exp->skribe (cadr opt))) "]"))
(list " " (keyword opt))))
(define (formal f)
(list " " (param f)))
- (code (list (bold "(") (bold :class 'api-proto-ident
- (format #f "~a" id)))
- (map option (sort options
- (lambda (s1 s2)
+ (code* (list (bold* "(") (bold* :class 'api-proto-ident
+ (format #f "~a" id)))
+ (map option (sort options
+ (lambda (s1 s2)
(cond
- ((and (pair? s1) (not (pair? s2)))
- #f)
- ((and (pair? s2) (not (pair? s1)))
- #t)
- (else
- #t)))))
- (if (pair? formals)
- (map formal formals))
- (if rest (list " " (param rest)))
- (bold ")")))
+ ((and (pair? s1) (not (pair? s2)))
+ #f)
+ ((and (pair? s2) (not (pair? s1)))
+ #t)
+ (else
+ #t)))))
+ (if (pair? formals)
+ (map formal formals))
+ (if rest (list " " (param rest)))
+ (bold* ")")))
;*---------------------------------------------------------------------*/
;* doc-markup ... */
diff --git a/doc/modules/skribilo/documentation/manual.scm b/doc/modules/skribilo/documentation/manual.scm
index 29a4ab3..8a86216 100644
--- a/doc/modules/skribilo/documentation/manual.scm
+++ b/doc/modules/skribilo/documentation/manual.scm
@@ -267,7 +267,11 @@
((keyword? arg)
(keyword arg))
((symbol? arg)
- (code (symbol->string arg)))
+ (resolve (lambda (n e env)
+ (let ((arg (symbol->string arg)))
+ (if (engine-format? "info" e)
+ (string-upcase arg)
+ (code arg))))))
(else
arg)))