From dae5a0dcbbc8920c9642c4f10c8e400db871d7e3 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 26 Aug 2023 02:38:25 +0100 Subject: html: Avoid single letter variable names. * src/guile/skribilo/engine/html.scm: Replace single letter variable names n and e with node and engine respectively. --- src/guile/skribilo/engine/html.scm | 1070 +++++++++++++++++++----------------- 1 file changed, 555 insertions(+), 515 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm index 088d168..6b33f51 100644 --- a/src/guile/skribilo/engine/html.scm +++ b/src/guile/skribilo/engine/html.scm @@ -86,7 +86,7 @@ (set! table (cons (cons base 1) table)) 1)))) (format #f "~a-~a.~a" base n suf))) - (lambda (node e) + (lambda (node engine) (let ((f (markup-option node filename)) (file (markup-option node :file))) (cond @@ -96,13 +96,13 @@ file) ((or file (and (is-markup? node 'chapter) - (engine-custom e 'chapter-file)) + (engine-custom engine 'chapter-file)) (and (is-markup? node 'section) - (engine-custom e 'section-file)) + (engine-custom engine 'section-file)) (and (is-markup? node 'subsection) - (engine-custom e 'subsection-file)) + (engine-custom engine 'subsection-file)) (and (is-markup? node 'subsubsection) - (engine-custom e 'subsubsection-file))) + (engine-custom engine 'subsubsection-file))) (let* ((b (or (and (string? (*destination-file*)) (file-prefix (*destination-file*))) "")) @@ -117,7 +117,7 @@ (else (let ((p (ast-parent node))) (if (container? p) - (let ((file (html-file p e))) + (let ((file (html-file p engine))) (if (string? file) (begin (markup-option-add! node filename file) @@ -459,9 +459,10 @@ ;*---------------------------------------------------------------------*/ ;* html-file ... */ ;*---------------------------------------------------------------------*/ -(define (html-file n e) - (let ((proc (or (engine-custom e 'file-name-proc) html-file-default))) - (proc n e))) +(define (html-file node engine) + (let ((proc (or (engine-custom engine 'file-name-proc) + html-file-default))) + (proc node engine))) ;*---------------------------------------------------------------------*/ ;* html-title-engine ... */ @@ -476,12 +477,12 @@ ;*---------------------------------------------------------------------*/ ;* html-browser-title ... */ ;*---------------------------------------------------------------------*/ -(define (html-browser-title n) - (and (markup? n) - (or (markup-option n :html-title) - (if (document? n) - (markup-option n :title) - (html-browser-title (ast-parent n)))))) +(define (html-browser-title node) + (and (markup? node) + (or (markup-option node :html-title) + (if (document? node) + (markup-option node :title) + (html-browser-title (ast-parent node)))))) ;*---------------------------------------------------------------------*/ @@ -489,7 +490,7 @@ ;* ------------------------------------------------------------- */ ;* Returns a string representing the container number */ ;*---------------------------------------------------------------------*/ -(define (html-container-number c e) +(define (html-container-number c engine) (define (html-number n proc) (cond ((string? n) @@ -502,11 +503,11 @@ ""))) (define (html-chapter-number c) (html-number (markup-option c :number) - (engine-custom e 'chapter-number->string))) + (engine-custom engine 'chapter-number->string))) (define (html-section-number c) (let ((p (ast-parent c)) (s (html-number (markup-option c :number) - (engine-custom e 'section-number->string)))) + (engine-custom engine 'section-number->string)))) (cond ((is-markup? p 'chapter) (string-append (html-chapter-number p) "." s)) @@ -515,7 +516,7 @@ (define (html-subsection-number c) (let ((p (ast-parent c)) (s (html-number (markup-option c :number) - (engine-custom e 'subsection-number->string)))) + (engine-custom engine 'subsection-number->string)))) (cond ((is-markup? p 'section) (string-append (html-section-number p) "." s)) @@ -524,7 +525,7 @@ (define (html-subsubsection-number c) (let ((p (ast-parent c)) (s (html-number (markup-option c :number) - (engine-custom e 'subsubsection-number->string)))) + (engine-custom engine 'subsubsection-number->string)))) (cond ((is-markup? p 'subsection) (string-append (html-subsection-number p) "." s)) @@ -608,9 +609,9 @@ unspecified or #f values are ignored." ;* html-markup-class ... */ ;*---------------------------------------------------------------------*/ (define (html-markup-class m) - (lambda (n e) + (lambda (node engine) (html-open m - `((class . ,(markup-class n)))))) + `((class . ,(markup-class node)))))) ;*---------------------------------------------------------------------*/ ;* html-color-spec? ... */ @@ -626,23 +627,23 @@ unspecified or #f values are ignored." (markup-writer 'document :options '(:title :author :ending :html-title :env :keywords) - :action (lambda (n e) - (let* ((id (markup-ident n)) + :action (lambda (node engine) + (let* ((id (markup-ident node)) (title (new markup (markup '&html-document-title) - (parent n) + (parent node) (ident (string-append id "-title")) - (class (markup-class n)) - (options `((author ,(markup-option n :author)))) - (body (markup-option n :title))))) + (class (markup-class node)) + (options `((author ,(markup-option node :author)))) + (body (markup-option node :title))))) ;; Record the file name, for use by `html-file-default'. - (markup-option-add! n :file (*destination-file*)) - (&html-generic-document n title e))) + (markup-option-add! node :file (*destination-file*)) + (&html-generic-document node title engine))) - :after (lambda (n e) - (if (engine-custom e 'emit-sui) - (document-sui n e)))) + :after (lambda (node engine) + (if (engine-custom engine 'emit-sui) + (document-sui node engine)))) ;*---------------------------------------------------------------------*/ ;* &html-html ... */ @@ -657,14 +658,14 @@ unspecified or #f values are ignored." ;* &html-head ... */ ;*---------------------------------------------------------------------*/ (markup-writer '&html-head - :before (lambda (n e) + :before (lambda (node engine) (html-open 'head) (html-open 'meta `((http-equiv . "Content-Type") (content . "text/html;") (charset . ,(engine-custom (find-engine 'html) 'charset)))) - (let ((head (engine-custom e 'head))) + (let ((head (engine-custom engine 'head))) (when head (display head) (newline)))) @@ -675,19 +676,19 @@ unspecified or #f values are ignored." ;*---------------------------------------------------------------------*/ (markup-writer '&html-meta :before "string (or (markup-body n) '())))) - (output (keyword-list->comma-separated kw*) e))) + :action (lambda (node engine) + (let ((kw* (map ast->string (or (markup-body node) '())))) + (output (keyword-list->comma-separated kw*) engine))) :after "\">\n") ;*---------------------------------------------------------------------*/ ;* &html-body ... */ ;*---------------------------------------------------------------------*/ (markup-writer '&html-body - :before (lambda (n e) - (let ((bg (engine-custom e 'background))) + :before (lambda (node engine) + (let ((bg (engine-custom engine 'background))) (html-open 'body - `((class . ,(markup-class n)) + `((class . ,(markup-class node)) (bgcolor . ,(and (html-color-spec? bg) bg)))))) :after "\n") @@ -696,7 +697,7 @@ unspecified or #f values are ignored." ;* &html-page ... */ ;*---------------------------------------------------------------------*/ (markup-writer '&html-page - :action (lambda (n e) + :action (lambda (node engine) (define (html-margin m fn size bg fg cla) (html-open 'td `((align . "left") @@ -716,26 +717,27 @@ unspecified or #f values are ignored." ((string? fn) (format #t "" fn))) (if (procedure? m) - (evaluate-document (m n e) e) - (output m e)) + (evaluate-document (m node engine) + engine) + (output m engine)) (if (or (string? fg) (string? fn)) (html-close 'font)) (html-close 'div) (html-close 'td)) - (let ((body (markup-body n)) - (lm (engine-custom e 'left-margin)) - (lmfn (engine-custom e 'left-margin-font)) - (lms (engine-custom e 'left-margin-size)) - (lmbg (engine-custom e 'left-margin-background)) - (lmfg (engine-custom e 'left-margin-foreground)) - (rm (engine-custom e 'right-margin)) - (rmfn (engine-custom e 'right-margin-font)) - (rms (engine-custom e 'right-margin-size)) - (rmbg (engine-custom e 'right-margin-background)) - (rmfg (engine-custom e 'right-margin-foreground))) + (let ((body (markup-body node)) + (lm (engine-custom engine 'left-margin)) + (lmfn (engine-custom engine 'left-margin-font)) + (lms (engine-custom engine 'left-margin-size)) + (lmbg (engine-custom engine 'left-margin-background)) + (lmfg (engine-custom engine 'left-margin-foreground)) + (rm (engine-custom engine 'right-margin)) + (rmfn (engine-custom engine 'right-margin-font)) + (rms (engine-custom engine 'right-margin-size)) + (rmbg (engine-custom engine 'right-margin-background)) + (rmfg (engine-custom engine 'right-margin-foreground))) (cond ((and lm rm) - (let* ((ep (engine-custom e 'margin-padding)) + (let* ((ep (engine-custom engine 'margin-padding)) (ac (if (number? ep) ep 0))) (html-open 'table `((cellpadding . ,ac) @@ -749,7 +751,7 @@ unspecified or #f values are ignored." (html-close 'tr) (html-close 'table)) (lm - (let* ((ep (engine-custom e 'margin-padding)) + (let* ((ep (engine-custom engine 'margin-padding)) (ac (if (number? ep) ep 0))) (html-open 'table `((cellpadding . ,ac) @@ -774,80 +776,81 @@ unspecified or #f values are ignored." (else (html-open 'div '((class . "skribilo-body"))) - (output body e) + (output body engine) (html-close 'div)))))) ;*---------------------------------------------------------------------*/ ;* &html-generic-header ... */ ;*---------------------------------------------------------------------*/ -(define (&html-generic-header n e) - (let* ((ic (engine-custom e 'favicon)) - (id (markup-ident n))) +(define (&html-generic-header node engine) + (let* ((ic (engine-custom engine 'favicon)) + (id (markup-ident node))) (unless (string? id) (skribe-error '&html-generic-header (format #f "Invalid identifier '~a'" id) - n)) + node)) ;; title (output (new markup (markup '&html-header-title) - (parent n) + (parent node) (ident (string-append id "-title")) - (class (markup-class n)) - (body (markup-body n))) - e) + (class (markup-class node)) + (body (markup-body node))) + engine) ;; favicon (output (new markup (markup '&html-header-favicon) - (parent n) + (parent node) (ident (string-append id "-favicon")) (body (cond ((string? ic) ic) ((procedure? ic) - (ic id e)) + (ic id engine)) (else #f)))) - e) + engine) ;; style (output (new markup (markup '&html-header-style) - (parent n) + (parent node) (ident (string-append id "-style")) - (class (markup-class n))) - e) + (class (markup-class node))) + engine) ;; css (output (new markup (markup '&html-header-css) - (parent n) + (parent node) (ident (string-append id "-css")) - (body (let ((c (engine-custom e 'css))) + (body (let ((c (engine-custom engine 'css))) (if (string? c) (list c) c)))) - e) + engine) ;; javascript (output (new markup (markup '&html-header-javascript) - (parent n) + (parent node) (ident (string-append id "-javascript"))) - e))) + engine))) (markup-writer '&html-header-title :before "" - :action (lambda (n e) - (output (markup-body n) html-title-engine)) + :action (lambda (node engine) + (output (markup-body node) + html-title-engine)) :after "\n") (markup-writer '&html-header-favicon - :action (lambda (n e) - (let ((i (markup-body n))) + :action (lambda (node engine) + (let ((i (markup-body node))) (when i (html-open 'link `((rel . "shortcut icon") (href . ,i))))))) (markup-writer '&html-header-css - :action (lambda (n e) - (let ((css (markup-body n))) + :action (lambda (node engine) + (let ((css (markup-body node))) (when (pair? css) (for-each (lambda (css) (html-open 'link @@ -858,8 +861,8 @@ unspecified or #f values are ignored." (markup-writer '&html-header-style :before " \n") (markup-writer '&html-header-javascript - :action (lambda (n e) - (when (engine-custom e 'javascript) + :action (lambda (node engine) + (when (engine-custom engine 'javascript) (html-open 'script '((language . "JavaScript") (type . "text/javascript"))) @@ -906,7 +909,7 @@ unspecified or #f values are ignored." (display " }\n") (display " -->\n") (html-close 'script)) - (let* ((ejs (engine-custom e 'js)) + (let* ((ejs (engine-custom engine 'js)) (js (cond ((string? ejs) (list ejs)) @@ -936,26 +939,26 @@ unspecified or #f values are ignored." ;*---------------------------------------------------------------------*/ (markup-writer '&html-ending :before "
" - :action (lambda (n e) - (let ((body (markup-body n))) + :action (lambda (node engine) + (let ((body (markup-body node))) (if body - (output body e) + (output body engine) (evaluate-document (list "(made with " (ref :text "skribilo" :url (skribilo-url)) ")") - e)))) + engine)))) :after "
\n") ;*---------------------------------------------------------------------*/ ;* &html-generic-title ... */ ;*---------------------------------------------------------------------*/ -(define (&html-generic-title n e) - (let* ((title (markup-body n)) - (authors (markup-option n 'author)) - (tbg (engine-custom e 'title-background)) - (tfg (engine-custom e 'title-foreground)) - (tfont (engine-custom e 'title-font))) +(define (&html-generic-title node engine) + (let* ((title (markup-body node)) + (authors (markup-option node 'author)) + (tbg (engine-custom engine 'title-background)) + (tfg (engine-custom engine 'title-foreground)) + (tfont (engine-custom engine 'title-font))) (when title (html-open 'table `((width . "100%") @@ -979,17 +982,17 @@ unspecified or #f values are ignored." (begin (format #t "" tfont) (html-open 'strong) - (output title e) + (output title engine) (html-close 'strong) (html-close 'font)) (begin (html-open 'div '((class . "skribilo-title"))) - (output title e) + (output title engine) (html-close 'div)))) (if (not authors) (display "\n") - (html-title-authors authors e)) + (html-title-authors authors engine)) (if (string? tfg) (html-close 'font)) (html-close 'td) @@ -1010,8 +1013,8 @@ unspecified or #f values are ignored." ;* &html-footnotes */ ;*---------------------------------------------------------------------*/ (markup-writer '&html-footnotes - :before (lambda (n e) - (let ((footnotes (markup-body n))) + :before (lambda (node engine) + (let ((footnotes (markup-body node))) (when (pair? footnotes) (html-open 'div '((class . "skribilo-footnote"))) @@ -1019,8 +1022,8 @@ unspecified or #f values are ignored." '((width . "20%") (size . "2") (align . "left")))))) - :action (lambda (n e) - (let ((footnotes (markup-body n))) + :action (lambda (node engine) + (let ((footnotes (markup-body node))) (for-each (lambda (fn) (html-open 'div '((class . "footnote"))) @@ -1040,7 +1043,7 @@ unspecified or #f values are ignored." (html-close 'small) (html-close 'sup) (html-close 'a) - (output (markup-body fn) e) + (output (markup-body fn) engine) (html-close 'div)) footnotes) (when (pair? footnotes) @@ -1049,7 +1052,7 @@ unspecified or #f values are ignored." ;*---------------------------------------------------------------------*/ ;* html-title-authors ... */ ;*---------------------------------------------------------------------*/ -(define (html-title-authors authors e) +(define (html-title-authors authors engine) (define (html-authorsN authors cols first) (define (make-row authors . opt) (tr (map (lambda (v) @@ -1078,14 +1081,14 @@ unspecified or #f values are ignored." (cons (make-row (list (car authors)) :colspan cols) (make-rows (cdr authors))) (make-rows authors))) - e)) + engine)) (cond ((pair? authors) (html-open 'center) (let ((len (length authors))) (case len ((1) - (output (car authors) e)) + (output (car authors) engine)) ((2 3) (html-authorsN authors len #f)) ((4) @@ -1094,32 +1097,32 @@ unspecified or #f values are ignored." (html-authorsN authors 3 #t)))) (html-close 'center)) (else - (html-title-authors (list authors) e)))) + (html-title-authors (list authors) engine)))) ;*---------------------------------------------------------------------*/ ;* author ... */ ;*---------------------------------------------------------------------*/ (markup-writer 'author :options '(:name :title :affiliation :email :url :address :phone :photo :align) - :before (lambda (n e) + :before (lambda (node engine) (html-open 'table - `((class . ,(markup-class n)))) + `((class . ,(markup-class node)))) (html-open 'tbody)) - :action (lambda (n e) - (let ((name (markup-option n :name)) - (title (markup-option n :title)) - (affiliation (markup-option n :affiliation)) - (email (markup-option n :email)) - (url (markup-option n :url)) - (address (markup-option n :address)) - (phone (markup-option n :phone)) - (nfn (engine-custom e 'author-font)) - (align (markup-option n :align))) - (define (row n) + :action (lambda (node engine) + (let ((name (markup-option node :name)) + (title (markup-option node :title)) + (affiliation (markup-option node :affiliation)) + (email (markup-option node :email)) + (url (markup-option node :url)) + (address (markup-option node :address)) + (phone (markup-option node :phone)) + (nfn (engine-custom engine 'author-font)) + (align (markup-option node :align))) + (define (row node) (html-open 'tr) (html-open 'td `((align . ,align))) - (output n e) + (output node engine) (html-close 'td) (html-close 'tr)) ;; name @@ -1127,7 +1130,7 @@ unspecified or #f values are ignored." (html-open 'td `((align . ,align))) (if nfn (format #t "\n" nfn)) - (output name e) + (output name engine) (if nfn (html-close 'font)) (html-close 'td) (html-close 'tr) @@ -1151,21 +1154,21 @@ unspecified or #f values are ignored." ;*---------------------------------------------------------------------*/ (markup-writer 'author :options '(:name :title :affiliation :email :url :address :phone :photo :align) - :predicate (lambda (n e) (markup-option n :photo)) - :before (lambda (n e) + :predicate (lambda (node engine) (markup-option node :photo)) + :before (lambda (node engine) (html-open 'table - `((class . ,(markup-class n)))) + `((class . ,(markup-class node)))) (html-open 'tbody) (html-open 'tr)) - :action (lambda (n e) - (let ((photo (markup-option n :photo))) + :action (lambda (node engine) + (let ((photo (markup-option node :photo))) (html-open 'td) - (output photo e) + (output photo engine) (html-close 'td) (html-open 'td) - (markup-option-add! n :photo #f) - (output n e) - (markup-option-add! n :photo photo) + (markup-option-add! node :photo #f) + (output node engine) + (markup-option-add! node :photo photo) (html-close 'td))) :after "\n") @@ -1174,7 +1177,7 @@ unspecified or #f values are ignored." ;*---------------------------------------------------------------------*/ (markup-writer 'toc :options 'all - :action (lambda (n e) + :action (lambda (node engine) (define (col n) (let loop ((i 0)) (if (< i n) @@ -1186,7 +1189,7 @@ unspecified or #f values are ignored." (match fe ((c ch ...) (let ((id (markup-ident c)) - (f (html-file c e))) + (f (html-file c engine))) (unless (string? id) (skribe-error 'toc (format #f "invalid identifier '~a'" id) @@ -1198,7 +1201,7 @@ unspecified or #f values are ignored." (html-open 'td '((valign . "top") (align . "left"))) - (display (html-container-number c e)) + (display (html-container-number c engine)) (html-close 'td) ;; title (html-open 'td @@ -1211,18 +1214,20 @@ unspecified or #f values are ignored." "" (strip-ref-base (or f (*destination-file*) ""))) (string-canonicalize id))))) - (output (markup-option c :title) e) + (output (markup-option c :title) engine) (html-close 'a) (html-close 'td) (html-close 'tr) ;; the children - (for-each (lambda (n) (toc-entry n (+ 1 level))) ch))))) - - (let* ((c (markup-option n :chapter)) - (s (markup-option n :section)) - (ss (markup-option n :subsection)) - (sss (markup-option n :subsubsection)) - (b (markup-body n)) + (for-each (lambda (node) + (toc-entry node (+ 1 level))) + ch))))) + + (let* ((c (markup-option node :chapter)) + (s (markup-option node :section)) + (ss (markup-option node :subsection)) + (sss (markup-option node :subsubsection)) + (b (markup-body node)) (bb (if (handle? b) (handle-ast b) b))) @@ -1239,69 +1244,75 @@ unspecified or #f values are ignored." (and ss (is-markup? x 'subsection)) (and s (is-markup? x 'section)) (and c (is-markup? x 'chapter)) - (markup-option n (symbol->keyword - (markup-markup x)))))) + (markup-option node + (symbol->keyword + (markup-markup x)))))) (container-body bb)))) ;; avoid to produce an empty table (unless (null? lst) (html-open 'table - `((class . ,(markup-class n)) + `((class . ,(markup-class node)) (cellspacing . "1") (cellpadding . "1") (width . "100%"))) (html-open 'tbody) - (for-each (lambda (n) (toc-entry n 0)) lst) + (for-each (lambda (node) + (toc-entry node 0)) + lst) (html-close 'tbody) (html-close 'table))))))) -(define (sections-in-same-file? n1 n2 e) - ;; Return #t when N1 and N2 are to be output in the same file according to - ;; E's settings. - (and (container? n1) (container? n2) - (equal? (html-file n1 e) (html-file n2 e)))) +(define (sections-in-same-file? node1 node2 engine) + ;; Return #t when NODE1 and NODE2 are to be output in the same file + ;; according to E's settings. + (and (container? node1) + (container? node2) + (equal? (html-file node1 engine) + (html-file node2 engine)))) ;*---------------------------------------------------------------------*/ ;* &html-generic-document ... */ ;*---------------------------------------------------------------------*/ -(define (&html-generic-document n title e) +(define (&html-generic-document node title engine) (define (set-output-encoding) ;; Make sure the output is suitably encoded. - (and=> (engine-custom e 'charset) + (and=> (engine-custom engine 'charset) (lambda (charset) (set-port-encoding! (current-output-port) charset) (set-port-conversion-strategy! (current-output-port) 'error)))) - (let* ((id (markup-ident n)) + (let* ((id (markup-ident node)) (header (new markup (markup '&html-chapter-header) (ident (string-append id "-header")) - (class (markup-class n)) - (parent n) - (body (html-browser-title n)))) + (class (markup-class node)) + (parent node) + (body (html-browser-title node)))) (meta (new markup (markup '&html-meta) (ident (string-append id "-meta")) - (class (markup-class n)) - (parent n) - (body (markup-option (ast-document n) :keywords)))) + (class (markup-class node)) + (parent node) + (body (markup-option (ast-document node) + :keywords)))) (head (new markup (markup '&html-head) (ident (string-append id "-head")) - (class (markup-class n)) - (parent n) + (class (markup-class node)) + (parent node) (body (list header meta)))) (ftnote (new markup (markup '&html-footnotes) (ident (string-append id "-footnote")) - (class (markup-class n)) - (parent n) + (class (markup-class node)) + (parent node) (body ;; Collect the footnotes of all the sub-containers that ;; are to be output in the same file. (match (find-down (lambda (s) - (sections-in-same-file? s n e)) - n) + (sections-in-same-file? s node engine)) + node) ((containers ...) (reverse (let loop ((subsections containers) @@ -1318,57 +1329,58 @@ unspecified or #f values are ignored." (page (new markup (markup '&html-page) (ident (string-append id "-page")) - (class (markup-class n)) - (parent n) - (body (list (markup-body n) ftnote)))) + (class (markup-class node)) + (parent node) + (body (list (markup-body node) + ftnote)))) (ending (new markup (markup '&html-ending) (ident (string-append id "-ending")) - (class (markup-class n)) - (parent n) - (body (or (markup-option n :ending) - (let ((p (ast-document n))) + (class (markup-class node)) + (parent node) + (body (or (markup-option node :ending) + (let ((p (ast-document node))) (and p (markup-option p :ending))))))) (body (new markup (markup '&html-body) (ident (string-append id "-body")) - (class (markup-class n)) - (parent n) + (class (markup-class node)) + (parent node) (body (list title page ending)))) (html (new markup (markup '&html-html) (ident (string-append id "-html")) - (class (markup-class n)) - (parent n) + (class (markup-class node)) + (parent node) (body (list head body))))) ;; No file must be opened for documents. These files are ;; directly opened by Skribe - (if (document? n) + (if (document? node) (begin (set-output-encoding) - (output html e)) - (parameterize ((*destination-file* (html-file n e))) + (output html engine)) + (parameterize ((*destination-file* (html-file node engine))) (with-output-to-file (*destination-file*) (lambda () (set-output-encoding) - (output html e))))))) + (output html engine))))))) ;*---------------------------------------------------------------------*/ ;* &html-generic-subdocument ... */ ;*---------------------------------------------------------------------*/ -(define (&html-generic-subdocument n e) - (let* ((p (ast-document n)) - (id (markup-ident n)) - (ti (let* ((nb (html-container-number n e)) - (tc (markup-option n :title)) +(define (&html-generic-subdocument node engine) + (let* ((p (ast-document node)) + (id (markup-ident node)) + (ti (let* ((nb (html-container-number node engine)) + (tc (markup-option node :title)) (ti (if (document? p) (list (markup-option p :title) - (engine-custom e 'file-title-separator) + (engine-custom engine 'file-title-separator) tc) tc)) (sep (engine-custom - e - (symbol-append (markup-markup n) + engine + (symbol-append (markup-markup node) '-title-number-separator))) (nti (and tc (if (and nb (not (equal? nb ""))) @@ -1377,26 +1389,26 @@ unspecified or #f values are ignored." ti) ti)))) (new markup - (markup (symbol-append '&html- (markup-markup n) '-title)) + (markup (symbol-append '&html- (markup-markup node) '-title)) (ident (string-append id "-title")) - (parent n) + (parent node) (options '((author ()))) (body nti))))) - (case (markup-markup n) + (case (markup-markup node) ((chapter) - (skribe-message " [~s chapter: ~a]\n" (engine-ident e) id)) + (skribe-message " [~s chapter: ~a]\n" (engine-ident engine) id)) ((section) - (skribe-message " [~s section: ~a]\n" (engine-ident e) id))) - (&html-generic-document n ti e))) + (skribe-message " [~s section: ~a]\n" (engine-ident engine) id))) + (&html-generic-document node ti engine))) ;*---------------------------------------------------------------------*/ ;* chapter ... @label chapter@ */ ;*---------------------------------------------------------------------*/ (markup-writer 'chapter :options '(:title :number :file :toc :html-title :env) - :before (lambda (n e) - (let ((title (markup-option n :title)) - (ident (markup-ident n))) + :before (lambda (node engine) + (let ((title (markup-option node :title)) + (ident (markup-ident node))) (display "\n") @@ -1405,35 +1417,37 @@ unspecified or #f values are ignored." (html-close 'a) (html-open 'center) (html-open 'h1 - `((class . ,(markup-class n)))) - (output (html-container-number n e) e) + `((class . ,(markup-class node)))) + (output (html-container-number node engine) + engine) (display " ") - (output (markup-option n :title) e) + (output (markup-option node :title) + engine) (html-close 'h1) (html-close 'center)))) ;; This writer is invoked only for chapters rendered inside separate files! (markup-writer 'chapter :options '(:title :number :file :toc :html-title :env) - :predicate (lambda (n e) - (or (markup-option n :file) - (engine-custom e 'chapter-file))) + :predicate (lambda (node engine) + (or (markup-option node :file) + (engine-custom engine 'chapter-file))) :action &html-generic-subdocument) ;*---------------------------------------------------------------------*/ ;* html-section-title ... */ ;*---------------------------------------------------------------------*/ -(define (html-section-title n e) - (let* ((title (markup-option n :title)) - (number (markup-option n :number)) - (c (markup-class n)) - (ident (markup-ident n)) - (kind (markup-markup n)) - (tbg (engine-custom e (symbol-append kind '-title-background))) - (tfg (engine-custom e (symbol-append kind '-title-foreground))) - (tstart (engine-custom e (symbol-append kind '-title-start))) - (tstop (engine-custom e (symbol-append kind '-title-stop))) - (nsep (engine-custom e (symbol-append kind '-title-number-separator)))) +(define (html-section-title node engine) + (let* ((title (markup-option node :title)) + (number (markup-option node :number)) + (c (markup-class node)) + (ident (markup-ident node)) + (kind (markup-markup node)) + (tbg (engine-custom engine (symbol-append kind '-title-background))) + (tfg (engine-custom engine (symbol-append kind '-title-foreground))) + (tstart (engine-custom engine (symbol-append kind '-title-start))) + (tstop (engine-custom engine (symbol-append kind '-title-stop))) + (nsep (engine-custom engine (symbol-append kind '-title-number-separator)))) ;; the section header (display "