From ce8f50fbd147864d795eb3d4869ce01ed82dcb1a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 26 May 2009 18:33:59 +0200 Subject: Fix node binding in sub-documents returned from unresolved nodes. * src/guile/skribilo/resolve.scm (do-resolve!): Bind sub-nodes of RES in the innermost document rather than in the root document. * tests/resolve.test ("resolved nested document bindings"): New test. --- tests/resolve.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/resolve.test b/tests/resolve.test index bfbdd27..027b191 100644 --- a/tests/resolve.test +++ b/tests/resolve.test @@ -174,6 +174,24 @@ (and (is-markup? x 'chapter) (eq? (ast-document x) sub)))))) +(test-assert "resolved nested document bindings" + ;; Prior to 0.9.2, nodes of a sub-document returned by an `unresolved' node + ;; would be bound in the root document. + (let* ((doc (document #:title "Doc" + (resolve (lambda (n e env) + (document #:title "Nested Doc" + (chapter #:ident "inner"))))))) + (resolve! doc %engine '()) + (and (not (document-lookup-node doc "inner")) + (let* ((sub (car (markup-body doc))) + (ch (car (markup-body sub))) + (x (document-lookup-node sub "inner"))) + (and (document? sub) + (is-markup? x 'chapter) + (eq? x ch) + (eq? (ast-parent x) sub) + (eq? (ast-document x) sub)))))) + (test-end "resolve") -- cgit v1.2.3