cortav  Diff

Differences From Artifact [49893a127f]:

To Artifact [1054336dd5]:


158
159
160
161
162
163
164





165
166
167
168





169
170
171
172
173
174
175
...
221
222
223
224
225
226
227

228
229
230
231
232
233
234
...
355
356
357
358
359
360
361

362
363
364
365
366
367
368
....
1004
1005
1006
1007
1008
1009
1010





























1011
1012
1013
1014
1015
1016
1017
				if not id:find'%.' then
					if sec then
						local rid = sec.refs[id]
						if rid then
							return rid, id, sec
						end
					end






					if doc.sections[id] then
						return nil, id, doc.sections[id]
					end





				else
					local secid, ref = string.match(id, "(.-)%.(.+)")
					local s
					s = s or doc.sections[secid]
					if s then
						if s.refs[ref] then
							return s.refs[ref], ref, s
................................................................................
}

ct.sec = declare {
	ident = 'section';
	mk = function() return {
		blocks = {};
		refs = {};

		depth = 0;
		kind = 'ordinary';
	} end;
	construct = function(self, id, depth)
		self.id = id
		self.depth = depth or self.depth
	end;
................................................................................
			nctx.line = ctx.line
			nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1
			return newdoc, nctx
		end;
	};
	mk = function(...) return {
		sections = {};

		secorder = {};
		embed = {};
		meta = {};
		vars = {};
		parents = {...};
		ext = {
			inhibit = {};
................................................................................
ct.directives = {
	author = dsetmeta;
	license = dsetmeta;
	keywords = dsetmeta;
	desc = dsetmeta;
	when = dcond;
	unless = dcond;





























	pragma = function(w,c)
	end;
	lang = function(w,c)
		local _, op, l = w(2)
		local langstack = c.doc.stage.langstack
		if op == 'is' then
			langstack[math.max(1, #langstack)] = l







>
>
>
>
>




>
>
>
>
>







 







>







 







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
....
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
				if not id:find'%.' then
					if sec then
						local rid = sec.refs[id]
						if rid then
							return rid, id, sec
						end
					end

					for _, i in ipairs(sec.imports) do
						local rr, ri, rs = checkFromSec(i, doc)
						if ri then return rr, ri, rs end
					end

					if doc.sections[id] then
						return nil, id, doc.sections[id]
					end

					for _, i in ipairs(doc.globals) do
						local rr, ri, rs = checkFromSec(i, doc)
						if ri then return rr, ri, rs end
					end
				else
					local secid, ref = string.match(id, "(.-)%.(.+)")
					local s
					s = s or doc.sections[secid]
					if s then
						if s.refs[ref] then
							return s.refs[ref], ref, s
................................................................................
}

ct.sec = declare {
	ident = 'section';
	mk = function() return {
		blocks = {};
		refs = {};
		imports = {};
		depth = 0;
		kind = 'ordinary';
	} end;
	construct = function(self, id, depth)
		self.id = id
		self.depth = depth or self.depth
	end;
................................................................................
			nctx.line = ctx.line
			nctx.docDepth = (ctx.docDepth or 0) + ctx.sec.depth - 1
			return newdoc, nctx
		end;
	};
	mk = function(...) return {
		sections = {};
		globals = {};
		secorder = {};
		embed = {};
		meta = {};
		vars = {};
		parents = {...};
		ext = {
			inhibit = {};
................................................................................
ct.directives = {
	author = dsetmeta;
	license = dsetmeta;
	keywords = dsetmeta;
	desc = dsetmeta;
	when = dcond;
	unless = dcond;
	with = function(w,c)
		local _,str = w(2)
		local aka, name = str:match '^([^=])=(.*)$'
		if aka == nil then name=str aka=name end

		local o,id,s = c:ref(name)
		if o then -- import object
			c.sec.import.objs[aka] = o
		else -- import scope
			table.insert(c.sec.import.scope, s)
		end
	end;
	global = function(w,c)
		local _,str = w(2)
		if str ~= nil and str ~= '' then
			local aka, name = str:match '^([^=])=(.*)$'
			if aka == nil then name=str aka=name end

			local o,id,s = c:ref(name)

			if o then
				c.doc.globals.objs[aka] = name
			else
				table.insert(c.doc.globals, s)
			end
		else
			table.insert(c.doc.globals, c.sec)
		end
	end;
	pragma = function(w,c)
	end;
	lang = function(w,c)
		local _, op, l = w(2)
		local langstack = c.doc.stage.langstack
		if op == 'is' then
			langstack[math.max(1, #langstack)] = l