diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/skribilo.scm | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/doc/skribilo.scm b/doc/skribilo.scm index e65afe7..4058e62 100644 --- a/doc/skribilo.scm +++ b/doc/skribilo.scm @@ -31,6 +31,7 @@ #:use-module (skribilo ast) #:use-module (skribilo engine) #:use-module (skribilo lib) + #:use-module (skribilo output) #:use-module (skribilo writer) #:use-module (skribilo package base) #:use-module (skribilo parameters) @@ -340,6 +341,23 @@ are a list of <record-field> objects." (texi-fragment->stexi (function-docstring function))))))) +(define (node->html-tag tag node) + "Output starting HTML @var{tag} of @var{node}." + (display + (format "<~a ~a>" + tag + (string-join (map (match-lambda + ((key . value) + (format "~a=\"~a\"" key value))) + (append (if (and (markup? node) + (markup-ident node)) + (list (cons "id" (markup-ident node))) + (list)) + (if (and (markup? node) + (markup-class node)) + (list (cons "class" (markup-class node))) + (list)))))))) + ;; HTML engine customizations (let ((html-engine (find-engine 'html))) (engine-custom-set! html-engine 'css "/style.css") @@ -351,4 +369,25 @@ are a list of <record-field> objects." (markup-option markup #:long) (markup-option markup #:short) (markup-option markup #:long)) - (current-output-port))))) + (current-output-port)))) + ;; The skribilo HTML engine description markup writer does not print + ;; the id attribute. Override it so that it does. TODO: Push this + ;; fix to skribilo upstream. + (markup-writer 'description html-engine + #:options '(#:symbol) + #:before (lambda (node engine) + (node->html-tag "dl" node)) + #:action (lambda (node engine) + (for-each (lambda (item) + (for-each (lambda (key) + (node->html-tag "dt" item) + (output key engine) + (display "</dt>")) + (match (markup-option item #:key) + ((keys ...) keys) + (key (list key)))) + (node->html-tag "dd" item) + (output (markup-body item) engine) + (display "</dd>\n")) + (markup-body node))) + #:after "</dl>")) |