cortav  Check-in [c50482b020]

Overview
Comment:beginning to hack in fixes to the hideously broken refid resolver
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c50482b020228959e5c60d1dc5421242dce90d71d3190931fdbf8755538ce4ec
User & Date: lexi on 2022-09-30 21:15:02
Other Links: manifest | tags
Context
2022-12-14
08:43
add workaround for broken luac check-in: f673b2abfe user: lexi tags: trunk
2022-09-30
21:15
beginning to hack in fixes to the hideously broken refid resolver check-in: c50482b020 user: lexi tags: trunk
20:15
let the flayings commence check-in: 89a6dd28ef user: lexi tags: trunk
Changes

Modified cortav.lua from [ea1fbe20dd] to [49893a127f].

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
342
343
344
345
346
347
348

349
350
351
352
353
354
355
					end
				end
			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)
					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)
					if o or s then return o,i,s end
				end
................................................................................
					end
				end
			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)
		end
	};
}

ct.sec = declare {
	ident = 'section';
	mk = function() return {
................................................................................
			-- sets up a doc/ctx pair for a subdocument embedded in the source
			-- of a gretaer document, pointing subdoc props to global tables/values
			local newdoc = ct.doc.mk(self)
			newdoc.meta = self.meta
			newdoc.ext = self.ext
			newdoc.enc = self.enc
			newdoc.stage = self.stage

			-- 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)
			nctx.line = ctx.line
			nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1







|







 







|







 







>







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
...
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
					end
				end
			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(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)
					if o or s then return o,i,s end
				end
................................................................................
					end
				end
			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 %s", id, self.invocation or "NIL")
		end
	};
}

ct.sec = declare {
	ident = 'section';
	mk = function() return {
................................................................................
			-- sets up a doc/ctx pair for a subdocument embedded in the source
			-- of a gretaer document, pointing subdoc props to global tables/values
			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)
			nctx.line = ctx.line
			nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1

Modified render/html.lua from [cebff10c4b] to [e9754e6e72].

770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
		end

		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)
			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
			local ir = ct.parse_span(r, mctx)
			-- even though this happens at render time, it really shouldn't;







|
|
|







770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
		end

		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(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
			local ir = ct.parse_span(r, mctx)
			-- even though this happens at render time, it really shouldn't;