865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
...
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
|
local uri = uriForSource(s)
local fbimg, idx
if next(ctr.nodes) == nil then
idx = 1
fbimg = {
elt = 'img'; --fallback
attrs = {
alt = '';
src = uri;
};
}
else idx = #ctr.nodes end
table.insert(ctr.nodes, idx, {
elt = 'source'; --fallback
attrs = { srcset = uri; };
})
................................................................................
local top = rtype[2]() -- create container
for n, src in ipairs(obj.srcs) do
if rtype[1] < src.mime then
rtype[2](src, top)
end
end
local ft = flatten(top)
return ft
end
function block_renderers.macro(b,s)
local all = renderSubdoc(b.doc)
local cat = catenate(ss.map(flatten,all))
return tag('div', {}, cat)
end
|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
...
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
|
local uri = uriForSource(s)
local fbimg, idx
if next(ctr.nodes) == nil then
idx = 1
fbimg = {
elt = 'img'; --fallback
attrs = {
alt = obj.props.desc or obj.props.detail or '';
title = obj.props.detail;
src = uri;
width = obj.props.width;
height = obj.props.height;
};
}
else idx = #ctr.nodes end
table.insert(ctr.nodes, idx, {
elt = 'source'; --fallback
attrs = { srcset = uri; };
})
................................................................................
local top = rtype[2]() -- create container
for n, src in ipairs(obj.srcs) do
if rtype[1] < src.mime then
rtype[2](src, top)
end
end
local ft = flatten(top)
local cap = b.cap or obj.props.desc or obj.props.detail
if b.mode == 'inline' then
-- TODO insert caption
return ft
else
local prop = {}
if b.mode == 'open' then
prop.open = true
end
return tag('details', prop, catenate {
tag('summary', {},
cap and (
-- the block here should really be the relevant
-- ref definition if an override caption isn't
-- specified, but oh well
sr.htmlSpan(spanparse(
cap, b.origin
), b, s)
) or '');
ft;
})
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
|