summaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtès2012-11-20 23:18:05 +0100
committerLudovic Courtès2012-11-20 23:18:21 +0100
commit5a6bebf5847259c8fb8259411cd2f125cb1324bc (patch)
tree2842d02a750fdeffd8e8fc20270bf1a682555efc /src/guile
parent67ef7c2829bba39aca0c18415219556a10a085ac (diff)
downloadskribilo-5a6bebf5847259c8fb8259411cd2f125cb1324bc.tar.gz
skribilo-5a6bebf5847259c8fb8259411cd2f125cb1324bc.tar.lz
skribilo-5a6bebf5847259c8fb8259411cd2f125cb1324bc.zip
html: Fix footnote handling for single-page documents.
* src/guile/skribilo/engine/html.scm (&html-generic-document)[ftnote](body): Rewrite using `match'. Deal with the case where `container-env-get' returns #f. Append FOOTNOTES to the result of `container-env-get' when it's not. The latter fixes a problem whereby footnotes would not appear on single-page documents. Reported and analyzed by Klaus Schilling <schilling.klaus@web.de>.
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/engine/html.scm31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 5dad3bc..f628bfa 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -39,6 +39,7 @@
:autoload (skribilo sui) (document-sui)
:autoload (ice-9 rdelim) (read-line)
:autoload (ice-9 regex) (regexp-substitute/global)
+ :use-module (ice-9 match)
:use-module (srfi srfi-1)
:use-module (srfi srfi-13)
@@ -1205,20 +1206,24 @@
(body
;; Collect the footnotes of all the sub-containers that
;; are to be output in the same file.
- (let ((subsections
- (find-down (lambda (s)
+ (match (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)))))))))
+ n)
+ ((containers ...)
+ (reverse
+ (let loop ((subsections (cons n containers))
+ (footnotes '()))
+ (match subsections
+ ((subsections ...)
+ (fold loop footnotes subsections))
+ (()
+ footnotes)
+ (container
+ (append footnotes
+ (or (container-env-get container
+ 'footnote-env)
+ '())))))))
+ (_ #f)))))
(page (new markup
(markup '&html-page)
(ident (string-append id "-page"))