Differences From
Artifact [14fa0c3d9d]:
853 853 elseif s.mode == 'embed' then
854 854 local mime = s.mime:clone()
855 855 mime.opts = {}
856 856 return string.format('data:%s;base64,%s', mime, ss.str.b64e(s.raw))
857 857 end
858 858 end
859 859 --figure out how to embed the given object
860 + local function P(p) -- get prop
861 + if b.props and b.props[p] then
862 + return b.props[p]
863 + end
864 + return obj.props[p]
865 + end
860 866 local embedActs = {
861 867 {ss.mime'image/*', function(s,ctr)
862 868 if s == nil then
863 869 return {tag = "picture", nodes = {}}
864 870 else
865 871 local uri = uriForSource(s)
866 872 local fbimg, idx
867 873 if next(ctr.nodes) == nil then
868 874 idx = 1
869 875 fbimg = {
870 876 elt = 'img'; --fallback
871 877 attrs = {
872 - alt = obj.props.desc or obj.props.detail or '';
873 - title = obj.props.detail;
878 + alt = P'desc' or P'detail' or '';
879 + title = P'detail';
874 880 src = uri;
875 - width = obj.props.width;
876 - height = obj.props.height;
881 + width = P'width';
882 + height = P'height';
877 883 };
878 884 }
879 885 else idx = #ctr.nodes end
880 886 table.insert(ctr.nodes, idx, {
881 887 elt = 'source'; --fallback
882 888 attrs = { srcset = uri; };
883 889 })
................................................................................
972 978 local top = rtype[2]() -- create container
973 979 for n, src in ipairs(obj.srcs) do
974 980 if rtype[1] < src.mime then
975 981 rtype[2](src, top)
976 982 end
977 983 end
978 984 local ft = flatten(top)
979 - local cap = b.cap or obj.props.desc or obj.props.detail
985 + local cap = b.cap or P'desc' or P'detail'
980 986 if b.mode == 'inline' then
981 987 -- TODO insert caption
982 988 return ft
983 989 else
984 990 local prop = {}
985 991 if b.mode == 'open' then
986 992 prop.open = true