cortav  Diff

Differences From Artifact [940c3efd41]:

To Artifact [2184d83e7b]:


1
2
3
4










5
6
7
8
9
10
11
...
732
733
734
735
736
737
738







739
740
741
742
743
744
745
...
794
795
796
797
798
799
800






801
802
803
804
805
806
807
-- [ʞ] cortav.lua
--  ~ lexi hale <lexi@hale.su>
--  © AGPLv3
--  ? reference implementation of the cortav document language











local ss = require 'sirsem'
-- aliases for commonly used sirsem funcs
local startswith = ss.str.begins
local dump = ss.dump
local declare = ss.declare

................................................................................
			spans = {{
				kind = 'raw';
				spans = {str};
				origin = o;
			}};
			origin = o;
		}







	end
	ct.spanctls = {
		{seq = '!', parse = formatter 'emph'};
		{seq = '*', parse = formatter 'strong'};
		{seq = '~', parse = formatter 'strike'};
		{seq = '+', parse = formatter 'insert'};
		{seq = '\\', parse = function(s, c) -- raw
................................................................................
			}
		end};
		{seq = '>', parse = insert_link};
		{seq = '→', parse = insert_link};
		{seq = '🔗', parse = insert_link};
		{seq = '##', parse = insert_var_ref(true)};
		{seq = '#', parse = insert_var_ref(false)};






		{seq = '%%', parse = function (s,c)
			local com = s:match '^%%%%%s*(.*)$'
			return {
				kind = 'comment';
				comment = com;
			}
		end};




>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
...
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
-- [ʞ] cortav.lua
--  ~ lexi hale <lexi@hale.su>
--  © AGPLv3
--  ? 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
--         translate back out on the way out. trying
--         to cope with multiple simultaneous
--         encodings in memory is a disaster zone.

local ss = require 'sirsem'
-- aliases for commonly used sirsem funcs
local startswith = ss.str.begins
local dump = ss.dump
local declare = ss.declare

................................................................................
			spans = {{
				kind = 'raw';
				spans = {str};
				origin = o;
			}};
			origin = o;
		}
	end
	local function unicodepoint(s,c)
		local cp = tonumber(s, 16)
		return {
			kind = 'codepoint';
			code = cp;
		}
	end
	ct.spanctls = {
		{seq = '!', parse = formatter 'emph'};
		{seq = '*', parse = formatter 'strong'};
		{seq = '~', parse = formatter 'strike'};
		{seq = '+', parse = formatter 'insert'};
		{seq = '\\', parse = function(s, c) -- raw
................................................................................
			}
		end};
		{seq = '>', parse = insert_link};
		{seq = '→', parse = insert_link};
		{seq = '🔗', parse = insert_link};
		{seq = '##', parse = insert_var_ref(true)};
		{seq = '#', parse = insert_var_ref(false)};

		{seq = 'U+', parse = unicodepoint};
		{seq = 'u+', parse = unicodepoint};
		{seq = 'U',  parse = unicodepoint};
		{seq = 'u',  parse = unicodepoint};

		{seq = '%%', parse = function (s,c)
			local com = s:match '^%%%%%s*(.*)$'
			return {
				kind = 'comment';
				comment = com;
			}
		end};