diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/guile/skribilo/engine/lout.scm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index 6be8546..a170d7c 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -1319,15 +1319,17 @@ :action (lambda (n e) (display "\n# toc\n") (if (markup-option n :chapter) - (let ((chapters (filter (lambda (n) - (or (is-markup? n 'chapter) - (is-markup? n 'slide))) - (markup-body (ast-document n))))) + (let* ((doc (or (ast-document n) + (*document-being-output*))) + (chapters (find-down (lambda (n) + (or (is-markup? n 'chapter) + (is-markup? n 'slide))) + doc))) (for-each (lambda (c) (let ((sections - (search-down (lambda (n) - (is-markup? n 'section)) - c))) + (find-down (lambda (n) + (is-markup? n 'section)) + c))) (lout-toc-entry c 0 e) (if (markup-option n :section) (for-each |