1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
....
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
|
flush()
buf.header = c == '+'
elseif c == ':' then
local lst = l:sub(p.byte-#c,p.byte-#c)
local nxt = l:sub(p.next.byte,p.next.byte)
if lst == '|' or lst == '+' and l:sub(p.byte-2,p.byte-2) ~= '\\' then
buf.align = 'left'
elseif nxt == '|' or nxt == '|' then
if buf.align == 'left' then
buf.align = 'center'
else
buf.align = 'right'
end
else
buf.str = buf.str .. c
................................................................................
j:hook('block_table_insert', c, tbl, l)
j:hook('block_table_row_insert', c, tbl, tbl.rows[1], l)
end
end
local function insert_link_block(seq)
return blockwrap(function(s,c)
local r = s:sub(#seq):gsub('^%s+','') -- chomp
local uri, txt = r:match('^([^%s]*)%s*(.*)$')
return {
uri = ss.uri(uri);
label = ct.parse_span(txt, c);
}
end)
end
ct.ctlseqs = {
{seq = '.', fn = insert_paragraph};
{seq = '¶', fn = insert_paragraph};
|
|
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
....
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
|
flush()
buf.header = c == '+'
elseif c == ':' then
local lst = l:sub(p.byte-#c,p.byte-#c)
local nxt = l:sub(p.next.byte,p.next.byte)
if lst == '|' or lst == '+' and l:sub(p.byte-2,p.byte-2) ~= '\\' then
buf.align = 'left'
elseif nxt == '|' or nxt == '+' then
if buf.align == 'left' then
buf.align = 'center'
else
buf.align = 'right'
end
else
buf.str = buf.str .. c
................................................................................
j:hook('block_table_insert', c, tbl, l)
j:hook('block_table_row_insert', c, tbl, tbl.rows[1], l)
end
end
local function insert_link_block(seq)
return blockwrap(function(s,c)
local r = s:sub(#seq+1)
local k, uri, txt = r:match('^(%s*)([^%s]*)%s*(.*)$')
return {
kind = 'link';
uri = (k~='') and ss.uri(uri) or nil;
ref = (k=='') and uri or nil;
spans = ct.parse_span(txt, c);
}
end)
end
ct.ctlseqs = {
{seq = '.', fn = insert_paragraph};
{seq = '¶', fn = insert_paragraph};
|