1
2
3
4
5
6
7
8
9
10
11
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
-- [ʞ] cortav.lua
-- ~ lexi hale <lexi@hale.su>
-- © EUPL v1.2
-- ? reference implementation of the cortav document language
--
-- ! TODO refactor encoding logic. it's a complete
-- mess and i seem to have repeatedly gotten
-- confused about how it's supposed to work.
-- the whole shitshow needs to be replaced
-- with a clean, simple paradigm: documents
-- are translated to UTF8 on the way in, and
................................................................................
new.generation = old.generation + 1
else
new.generation = 1
end
end;
fns = {
fail = function(self, msg, ...)
--error(string.format(msg,...))
ct.exns.tx(msg, self.src.file, self.line or 0, ...):throw()
end;
insert = function(self, block)
block.origin = self:clone()
table.insert(self.sec.blocks,block)
return block
end;
................................................................................
end;
job = function(self, name, pred, ...) -- convenience func
return self.docjob:fork(name, pred, ...)
end;
sub = function(self, ctx)
-- convenience function for single-inheritance structure
-- 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
|
|
1
2
3
4
5
6
7
8
9
10
11
12
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
-- [ʞ] cortav.lua
-- ~ lexi hale <lexi@hale.su>
-- © EUPL v1.2
-- ? reference implementation of the cortav document language
-- \ from Ranuir "written document"
--
-- ! TODO refactor encoding logic. it's a complete
-- mess and i seem to have repeatedly gotten
-- confused about how it's supposed to work.
-- the whole shitshow needs to be replaced
-- with a clean, simple paradigm: documents
-- are translated to UTF8 on the way in, and
................................................................................
new.generation = old.generation + 1
else
new.generation = 1
end
end;
fns = {
fail = function(self, msg, ...)
-- error(string.format(msg,...))
ct.exns.tx(msg, self.src.file, self.line or 0, ...):throw()
end;
insert = function(self, block)
block.origin = self:clone()
table.insert(self.sec.blocks,block)
return block
end;
................................................................................
end;
job = function(self, name, pred, ...) -- convenience func
return self.docjob:fork(name, pred, ...)
end;
sub = function(self, ctx)
-- convenience function for single-inheritance structure
-- sets up a doc/ctx pair for a subdocument embedded in the source
-- of a greater 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
|