diff options
author | Arun Isaac | 2023-08-28 18:47:20 +0100 |
---|---|---|
committer | Arun Isaac | 2023-08-29 17:08:46 +0100 |
commit | 2e9463b564e2dad6a03eaf32ad8d789d7f812e24 (patch) | |
tree | fafc2f343eefa910ac8549c837d3646705a70955 | |
parent | 09499acd48b979dd05ebb45d5ac024b14d30d8f1 (diff) | |
download | skribilo-2e9463b564e2dad6a03eaf32ad8d789d7f812e24.tar.gz skribilo-2e9463b564e2dad6a03eaf32ad8d789d7f812e24.tar.lz skribilo-2e9463b564e2dad6a03eaf32ad8d789d7f812e24.zip |
html: Implement section titles without HTML tables.
* src/guile/skribilo/engine/html.scm (html-section-title): Implement
without HTML tables, using CSS only.
-rw-r--r-- | src/guile/skribilo/engine/html.scm | 74 |
1 files changed, 34 insertions, 40 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm index 01fb583..496f384 100644 --- a/src/guile/skribilo/engine/html.scm +++ b/src/guile/skribilo/engine/html.scm @@ -1433,52 +1433,46 @@ ignored, return #f." (define (html-section-title node engine) (let* ((title (markup-option node :title)) (number (markup-option node :number)) - (c (markup-class node)) + (class (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 + (title-background (engine-custom engine + (symbol-append kind '-title-background))) + (title-foreground (engine-custom engine + (symbol-append kind '-title-foreground))) + (title-start (engine-custom engine + (symbol-append kind '-title-start))) + (title-stop (engine-custom engine + (symbol-append kind '-title-stop))) + (number-separator (engine-custom engine + (symbol-append kind '-title-number-separator)))) + ;; section title in comments (display "<!-- ") (output title html-title-engine) (display " -->\n") - (html-open 'a - `((name . ,(string-canonicalize ident)))) - (html-close 'a) - (if c - (html-open 'div - `((class . ,(string-append c "-title")))) - (html-open 'div - `((class . ,(string-append "skribilo-" (markup-markup node) "-title"))))) - (when (html-color-spec? tbg) - (html-open 'table - '((width . "100%"))) - (html-open 'tr) - (html-open 'td - `((bgcolor . ,tbg)))) - (display tstart) - (if tfg - (html-open 'font - `((color . ,tfg)))) - (if number - (begin - (output (html-container-number node engine) - engine) - (output nsep engine))) + ;; div wrapping the title + (html-open 'div + `((class . ,(if class + (string-append class "-title") + (string-append "skribilo-" kind "-title"))) + (id . ,(string-canonicalize ident)) + (style . ,(style-declaration + `((color . ,(and (html-color-spec? title-foreground) + title-foreground)) + (background-color . ,(and (html-color-spec? title-background) + title-background))))))) + ;; title start string + (display title-start) + ;; section number if enabled + (when number + (output (html-container-number node engine) + engine) + (output number-separator engine)) + ;; the title itself (output title engine) - (if tfg - (html-close 'font)) - (display tstop) - (when (and (string? tbg) (> (string-length tbg) 0)) - (html-close 'td) - (html-close 'tr) - (html-close 'table)) - (html-close 'div) - ((html-markup-class "div") node engine)) - (newline)) + ;; title stop string + (display title-stop) + (html-close 'div))) ;*---------------------------------------------------------------------*/ ;* section ... @label section@ */ |