738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
...
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
|
}
end
ct.spanctls = {
{seq = '!', parse = formatter 'emph'};
{seq = '*', parse = formatter 'strong'};
{seq = '~', parse = formatter 'strike'};
{seq = '+', parse = formatter 'insert'};
{seq = '"', parse = rawcode};
-- deprecated
{seq = '`\\', parse = rawcode};
{seq = '\\\\', parse = rawcode};
{seq = '\\', parse = function(s, c) -- raw
return {
kind = 'raw';
spans = {s};
origin = c:clone();
}
end};
{seq = '`', parse = formatter 'literal'};
{seq = '$', parse = formatter 'variable'};
{seq = '^', parse = function(s,c) --footnotes
local r, t = s:match '^([^%s]+)%s*(.-)$'
return {
kind = 'footnote';
ref = r;
spans = ct.parse_span(t, c);
origin = c:clone();
}
-- TODO support for footnote sections
end};
{seq = '=', parse = function(s,c) --math mode
local tx = {
['%*'] = 'ร';
['/'] = 'รท';
}
for k,v in pairs(tx) do s = s:gsub(k,v) end
................................................................................
end};
{seq = '&', parse = function(s, c)
local r, t = s:match '^([^%s]+)%s*(.-)$'
return {
kind = 'deref';
spans = (t and t ~= "") and ct.parse_span(t, c) or {};
ref = r;
origin = c:clone();
}
end};
{seq = '^', parse = function(s, c)
local fn, t = s:match '^([^%s]+)%s*(.-)$'
return {
kind = 'footnote';
spans = (t and t~='') and ct.parse_span(t, c) or {};
ref = fn;
origin = c:clone();
}
end};
{seq = '>', parse = insert_link};
{seq = 'โ', parse = insert_link};
{seq = '๐', parse = insert_link};
{seq = '##', parse = insert_var_ref(true)};
|
<
<
<
<
>
|
>
|
>
|
<
<
<
<
<
<
<
<
<
<
<
|
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
...
786
787
788
789
790
791
792
793
794
795
796
797
798
799
|
}
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
return {
kind = 'raw';
spans = {s};
origin = c:clone();
}
end};
{seq = '`', parse = formatter 'literal'};
{seq = '"', parse = rawcode};
{seq = '$', parse = formatter 'variable'};
{seq = '^', parse = function(s, c)
-- TODO support for footnote sections
local fn, t = s:match '^([^%s]+)%s*(.-)$'
return {
kind = 'footnote';
spans = (t and t~='') and ct.parse_span(t, c) or {};
ref = fn;
origin = c:clone();
}
end};
{seq = '=', parse = function(s,c) --math mode
local tx = {
['%*'] = 'ร';
['/'] = 'รท';
}
for k,v in pairs(tx) do s = s:gsub(k,v) end
................................................................................
end};
{seq = '&', parse = function(s, c)
local r, t = s:match '^([^%s]+)%s*(.-)$'
return {
kind = 'deref';
spans = (t and t ~= "") and ct.parse_span(t, c) or {};
ref = r;
origin = c:clone();
}
end};
{seq = '>', parse = insert_link};
{seq = 'โ', parse = insert_link};
{seq = '๐', parse = insert_link};
{seq = '##', parse = insert_var_ref(true)};
|