cortav  Diff

Differences From Artifact [ea1fbe20dd]:

To Artifact [49893a127f]:


   177    177   					end
   178    178   				end
   179    179   			end
   180    180   
   181    181   			local function scanParents(doc)
   182    182   				for i, p in ipairs(doc.parents) do
   183    183   					-- TODO figure out a way to ref the embedding section
   184         -					local o,i,s = checkFromSec(nil, p)
          184  +					local o,i,s = checkFromSec(doc.defined_in_parent_section, p)
   185    185   					if o or s then return o,i,s end
   186    186   				end
   187    187   				-- breadth-first search
   188    188   				for i, p in ipairs(doc.parents) do
   189    189   					local o,i,s = scanParents(p)
   190    190   					if o or s then return o,i,s end
   191    191   				end
................................................................................
   211    211   					end
   212    212   				end
   213    213   			end
   214    214   
   215    215   			o,i,s = scanParents(self.doc)
   216    216   			if o or s then return o,i,s end
   217    217   
   218         -			self:fail("ID ā€œ%sā€ does not name an object or section", id)
          218  +			self:fail("ID ā€œ%sā€ does not name an object or section %s", id, self.invocation or "NIL")
   219    219   		end
   220    220   	};
   221    221   }
   222    222   
   223    223   ct.sec = declare {
   224    224   	ident = 'section';
   225    225   	mk = function() return {
................................................................................
   342    342   			-- sets up a doc/ctx pair for a subdocument embedded in the source
   343    343   			-- of a gretaer document, pointing subdoc props to global tables/values
   344    344   			local newdoc = ct.doc.mk(self)
   345    345   			newdoc.meta = self.meta
   346    346   			newdoc.ext = self.ext
   347    347   			newdoc.enc = self.enc
   348    348   			newdoc.stage = self.stage
          349  +			newdoc.defined_in_parent_section = ctx.sec
   349    350   			-- vars are handled through proper recursion across all parents and
   350    351   			-- are intentionally excluded here; subdocs can have their own vars
   351    352   			-- without losing access to parent vars
   352    353   			local nctx = ctx:clone()
   353    354   			nctx:init(newdoc, ctx.src)
   354    355   			nctx.line = ctx.line
   355    356   			nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1