summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/engine/html.scm38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 0fded86..9f969c5 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -39,6 +39,7 @@
:autoload (ice-9 rdelim) (read-line)
:autoload (ice-9 regex) (regexp-substitute/global)
+ :use-module (srfi srfi-1)
:use-module (srfi srfi-13)
:use-module (srfi srfi-14)
:use-module (srfi srfi-39)
@@ -1137,6 +1138,23 @@
(display "</tbody>\n</table>\n")))))))
+(define (section-in-separate-file? n e)
+ ;; Return true if N, a node (chapter, section, etc.), is to be put in a
+ ;; separate file, according to the customs of engine E.
+ (and (container? n)
+ (not (document? n))
+ (or (markup-option n :file)
+ (let ((kind (markup-markup n)))
+ (engine-custom e (string->symbol
+ (string-append (symbol->string kind)
+ "-file")))))))
+
+(define (section-in-current-file? n e)
+ ;; Return true if N is to be output in the current file, or in the main
+ ;; file.
+ (and (container? n)
+ (not (section-in-separate-file? n e))))
+
;*---------------------------------------------------------------------*/
;* &html-generic-document ... */
;*---------------------------------------------------------------------*/
@@ -1165,8 +1183,24 @@
(ident (string-append id "-footnote"))
(class (markup-class n))
(parent n)
- (body (reverse!
- (container-env-get n 'footnote-env)))))
+
+ (body
+ ;; Collect the footnotes of all the sub-containers that
+ ;; are to be output in the same file.
+ (let ((subsections
+ (find-down (lambda (s)
+ (section-in-current-file? s e))
+ n)))
+ (reverse
+ (let loop ((subsections (cons n subsections))
+ (footnotes '()))
+ (cond ((pair? subsections)
+ (fold loop footnotes subsections))
+ ((null? subsections)
+ footnotes)
+ (else
+ (container-env-get subsections
+ 'footnote-env)))))))))
(page (new markup
(markup '&html-page)
(ident (string-append id "-page"))