summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtès2009-01-07 01:35:04 +0100
committerLudovic Courtès2009-01-07 01:35:04 +0100
commitd05d352ea3e8af3dbd53a021f83532198cd5cce6 (patch)
tree847c5b16ad217c6022110616ce3b6efe5c7335f8 /src
parentfd9a9dc8ff1c4b7e77a28b4556e62620d15b1293 (diff)
downloadskribilo-d05d352ea3e8af3dbd53a021f83532198cd5cce6.tar.gz
skribilo-d05d352ea3e8af3dbd53a021f83532198cd5cce6.tar.lz
skribilo-d05d352ea3e8af3dbd53a021f83532198cd5cce6.zip
html: Fix footnote output for chapters that are not in a separate file.
* src/guile/skribilo/engine/html.scm (section-in-separate-file?, section-in-current-file?): New. (&html-generic-document)[ftnotes]: Collect the footnotes not only of N but also those of all its sub-containers that are to be output in the same file. This fixes a bug where chapters that are not output in the same file don't get their footnotes printed. Reported by Klaus Schilling <schilling.klaus@web.de>. * NEWS: Update.
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"))