summaryrefslogtreecommitdiff
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
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.
-rw-r--r--NEWS4
-rw-r--r--src/guile/skribilo/engine/html.scm38
2 files changed, 40 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 514541f..42cb606 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009 Ludovic Courtès <ludo@gnu.org>
** Using `(image :url ...)' with `lout' yields a warning, not an error
** New `rss-2' input syntax, for RSS 2.0 feeds
** HTML engine: footnotes now yield hyperlinks back to the call site
+** HTML engine: footnotes are properly printed for same-file chapters
+
+Previously, footnotes would not get printed in the case of chapters that
+are not output in a separate file.
* New in Skribilo 0.9.1
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"))