620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
...
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
....
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
....
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
|
} end;
catenate = function(...) return ... end;
};
toHTML = {
elt = elt;
tag = function(t,attrs,body)
return f('<%s>%s</%s>', html_open(t,attrs), body, t)
end;
catenate = table.concat;
};
}
end
local function getBaseRenderers(procs, span_renderers)
................................................................................
return ''
elseif type(t) == 'string' then
return t
elseif type(t) == 'table' then
if t[1] then
return catenate(ss.map(flatten, t))
elseif t.tag then
return tag(t.tag, t.attrs or {}, flatten(t.nodes))
elseif t.elt then
return tag(t.elt, t.attrs or {})
end
end
end
function block_renderers.embed(b,s)
local obj
if b.rsrc
................................................................................
})
end
end
function block_renderers.macro(b,s)
local all = renderSubdoc(b.doc)
local cat = catenate(ss.map(flatten,all))
return tag('div', {}, cat)
end
function block_renderers.quote(b,s)
local ir = renderSubdoc(b.doc)
return tag('blockquote', b.id and {id=getSafeID(b)} or {}, catenate(ss.map(flatten,ir)))
end
................................................................................
end
if next(footnotes) and not opts.epub then
table.insert(ir, tagproc.toIR.tag('div',{id='cover'},''))
end
-- restructure passes
runhook('ir_restructure_pre', ir)
---- list insertion pass
local lists = {}
for _, sec in pairs(ir) do
if sec.tag == 'section' then
local i = 1 while i <= #sec.nodes do local v = sec.nodes[i]
if v.tag == 'li' then
|
>
|
>
>
>
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
...
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
....
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
....
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
|
} end;
catenate = function(...) return ... end;
};
toHTML = {
elt = elt;
tag = function(t,attrs,body)
if t then
return f('<%s>%s</%s>', html_open(t,attrs), body, t)
else
return tostring(body)
end
end;
catenate = table.concat;
};
}
end
local function getBaseRenderers(procs, span_renderers)
................................................................................
return ''
elseif type(t) == 'string' then
return t
elseif type(t) == 'table' then
if t[1] then
return catenate(ss.map(flatten, t))
elseif t.tag then
return tag(t.tag, t.attrs or {}, flatten(t.nodes), t.src)
elseif t.elt then
return elt(t.elt, t.attrs or {}, t.src)
end
end
end
function block_renderers.embed(b,s)
local obj
if b.rsrc
................................................................................
})
end
end
function block_renderers.macro(b,s)
local all = renderSubdoc(b.doc)
local cat = catenate(ss.map(flatten,all))
return tag(nil, {}, cat)
end
function block_renderers.quote(b,s)
local ir = renderSubdoc(b.doc)
return tag('blockquote', b.id and {id=getSafeID(b)} or {}, catenate(ss.map(flatten,ir)))
end
................................................................................
end
if next(footnotes) and not opts.epub then
table.insert(ir, tagproc.toIR.tag('div',{id='cover'},''))
end
-- restructure passes
runhook('ir_restructure_pre', ir)
-- flay empty containers
for _, sec in pairs(ir) do
if sec.tag == 'section' then
local i = 1 while i <= #sec.nodes do local v = sec.nodes[i]
if type(v) ~= 'string' and v.nodes and v.tag == nil then
table.remove(sec.nodes,i)
for j=1,#v.nodes do
table.insert(sec.nodes, i+j - 1, v.nodes[j])
end
end
i=i+1 end
end
end
---- list insertion pass
local lists = {}
for _, sec in pairs(ir) do
if sec.tag == 'section' then
local i = 1 while i <= #sec.nodes do local v = sec.nodes[i]
if v.tag == 'li' then
|