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