Index: cortav.lua ================================================================== --- cortav.lua +++ cortav.lua @@ -179,11 +179,11 @@ end 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 local o,i,s = scanParents(p) @@ -213,11 +213,11 @@ end 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 }; } ct.sec = declare { @@ -344,10 +344,11 @@ local newdoc = ct.doc.mk(self) 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() nctx:init(newdoc, ctx.src) Index: render/html.lua ================================================================== --- render/html.lua +++ render/html.lua @@ -772,13 +772,13 @@ span_renderers['line-break'] = function(sp,b,s) return elt('br') end function span_renderers.macro(m,b,s) - local macroname = plainrdr.htmlSpan( - ct.parse_span(m.macro, b.origin), b,s) - local r = b.origin:ref(macroname) +-- local macroname = plainrdr.htmlSpan( +-- ct.parse_span(m.macro, b.origin), b,s) + local r = b.origin:ref(m.macro) if type(r) ~= 'string' then b.origin:fail('%s is an object, not a reference', r.id) end local mctx = b.origin:clone() mctx.invocation = m