From ae0bce11d0af4422096f6db8a857286ed26b07b5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 22 Apr 2018 18:07:46 +0200 Subject: doc: In HTML, use CSS to render 'doc-markup'. * doc/modules/skribilo/documentation/api.scm (he): Add writer for 'doc-markup'. (le): Add LE as an argument to 'markup-writer' where it was missing. (doc-markup): Remove 'doc-markup.html', and use 'doc-markup.generic' for HTML. --- doc/modules/skribilo/documentation/api.scm | 126 +++++++++++------------------ doc/user/skribilo.css | 36 ++++++++- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/doc/modules/skribilo/documentation/api.scm b/doc/modules/skribilo/documentation/api.scm index 73c8a43..7ac194f 100644 --- a/doc/modules/skribilo/documentation/api.scm +++ b/doc/modules/skribilo/documentation/api.scm @@ -68,7 +68,47 @@ :action (lambda (n e) (let ((c (engine-custom e 'title-background))) (markup-option-add! n :bg c) - (output n e tro))))) + (output n e tro)))) + + (markup-writer 'doc-markup he + :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))) + (display "
") + (for-each (lambda (p) + (output (! "\n
$1
" p) e)) + protos) + (for-each (match-lambda + ((name (engines ...) desc) + (output (! "\n
\ + $1 \ + $2 \ + $3
" + name desc engines) + e))) + (or opts '())) + + (for-each (match-lambda + ((param . desc) + (output (! "\n
\ + $1 \ + $2
" + param desc) + e))) + (or params '())) + + (when (pair? see) + (output (! "
\ +See also $1
" + (punctuate see)) + e)) + + (display "
\n"))))) ;*---------------------------------------------------------------------*/ ;* LaTeX configuration */ @@ -135,7 +175,7 @@ def @SkribiloExample named @Title {} right x { :before "\n{ Courier Base 9p } @Font { lines nohyphen 0.9fx } @Break lout @Space {\n" :after "\n} # @Break\n") - (markup-writer 'doc-markup + (markup-writer 'doc-markup le :action (lambda (n e) (let ((protos (markup-option n 'prototypes)) (opts (markup-option n 'options)) @@ -177,7 +217,7 @@ def @SkribiloExample named @Title {} right x { (display "\n@LP\n")))) - (markup-writer 'doc-engine + (markup-writer 'doc-engine le :action (lambda (n e) (let ((customs (markup-option n 'customs)) (defaults (markup-option n 'defaults))) @@ -652,78 +692,7 @@ def @SkribiloExample named @Title {} right x { (define-markup-formals def) dargs)) others od)))) - ;; doc table - (define (doc-markup.html) - (let ((df (map (lambda (f) - (tr :bg *prgm-skribe-color* - (td :colspan 2 :width 20. :align 'left - (param (car f)) ) - (td :align 'left :width 80. (cadr f)))) - dformals)) - (dr (and (pair? drest) - (tr :bg *prgm-skribe-color* - (td :align 'left - :valign 'top - :colspan 2 - :width 20. - (param (cadr (car drest)))) - (td :align 'left :width 80. - (caddr (car drest)))))) - (do (map (lambda (f) - (tr :bg *prgm-skribe-color* - (td :align 'left - :valign 'top - :width 10. - (param (car f))) - (td :align 'left - :valign 'top - :width 20. - (opt-engine-support (car f))) - (td :align 'left :width 70. (cadr f)))) - doptions)) - (so (map (lambda (x) - (let ((s (symbol->string x))) - (list - (ref :mark s :text (code s)) - " "))) - see-also))) - (table :&location &invocation-location - :border (if (engine-format? "latex") 1 0) - :width (if (engine-format? "latex") #f *prgm-width*) - `(,(tr :class 'api-table-prototype - (th :colspan 3 :align 'left :width *prgm-width* - "prototype")) - ,@(map (lambda (p) - (tr :bg *prgm-skribe-color* - (td :colspan 3 :width *prgm-width* - :align 'left p))) - p+) - ,@(if (pair? do) - `(,(tr :class 'api-table-header - (th :align 'left "option" - :width 10.) - (th :align 'center "engines" - :width 20.) - (th "description")) - ,@do) - '()) - ,@(if (or (pair? df) dr) - `(,(tr :class 'api-table-header - (th :colspan 2 - :align 'left - :width 30. - "argument") - (th "description")) - ,@(if (pair? df) df '()) - ,@(if dr (list dr) '())) - '()) - ,@(if (pair? so) - `(,(tr :class 'api-table-header - (th :colspan 3 :align 'left - (it "See also"))) - ,(tr :bg *prgm-skribe-color* - (td :colspan 3 :align 'left so))) - '()))))) + ;; doc enumerate (define (doc-markup.latex) (let ((df (map (lambda (f) @@ -810,11 +779,8 @@ def @SkribiloExample named @Title {} right x { (cond ((engine-format? "latex") (doc-markup.latex)) - ((or (engine-format? "lout") - (engine-format? "info")) - (doc-markup.generic)) - (else - (center (doc-markup.html))))))))) + (else + (doc-markup.generic)))))))) ;*---------------------------------------------------------------------*/ ;* doc-engine ... */ diff --git a/doc/user/skribilo.css b/doc/user/skribilo.css index df021ac..eb93784 100644 --- a/doc/user/skribilo.css +++ b/doc/user/skribilo.css @@ -153,7 +153,41 @@ table.toc { margin-left: 0em; margin-right: 3em; line-height: 1.5; -}; +} + +.skribilo-doc-markup { + border-top: 1px dotted #333; + background: #fef7f7; + border-radius: 0px 0px 10px 10px; + padding: 15px; +} + +.skribilo-api-prototype { + margin-bottom: 10px; +} + +.skribilo-api-option-name, +.skribilo-api-argument-name { + font-family: monospace, Courier; + font-size: 0.9em; + display: inline-block; + min-width: 120px; + vertical-align: top; +} +.skribilo-api-option-description { + display: inline-block; + max-width: 90%; +} +.skribilo-api-option-engines { + border-left: 1px dotted #333; + border-right: 1px dotted #333; + padding-left: 5px; + padding-right: 5px; + font-size: 0.9em; +} +.skribilo-api-see-also { + margin-top: 15px; +} /* Links. */ -- cgit v1.2.3