@@ -180,9 +180,9 @@ local function scanParents(doc) for i, p in ipairs(doc.parents) do -- TODO figure out a way to ref the embedding section - local o,i,s = checkFromSec(nil, p) + local o,i,s = checkFromSec(doc.defined_in_parent_section, p) if o or s then return o,i,s end end -- breadth-first search for i, p in ipairs(doc.parents) do @@ -214,9 +214,9 @@ o,i,s = scanParents(self.doc) if o or s then return o,i,s end - self:fail("ID ā€œ%sā€ does not name an object or section", id) + self:fail("ID ā€œ%sā€ does not name an object or section %s", id, self.invocation or "NIL") end }; } @@ -345,8 +345,9 @@ newdoc.meta = self.meta newdoc.ext = self.ext newdoc.enc = self.enc newdoc.stage = self.stage + newdoc.defined_in_parent_section = ctx.sec -- vars are handled through proper recursion across all parents and -- are intentionally excluded here; subdocs can have their own vars -- without losing access to parent vars local nctx = ctx:clone()