Differences From
Artifact [e689cbb41c]:
259 259 subtitle = [[
260 260 .subtitle {
261 261 color: @tone(0.3 20);
262 262 font-size: 1.2em;
263 263 font-style: italic;
264 264 margin-left: 1em;
265 265 }
266 - blockquote + .subtitle {
267 - &::before {
268 - content: "— ";
269 - }
270 - }
271 266 ]];
272 267 accent = [[
273 268 @media screen {
274 269 body { background: @bg; color: @fg }
275 270 a[href] {
276 271 color: @tone(0.7 30);
277 272 text-decoration-color: @tone/0.4(0.7 30);
................................................................................
313 308 }
314 309 section > aside p:first-child {
315 310 margin: 0;
316 311 }
317 312 section aside + aside {
318 313 margin-top: 0.5em;
319 314 }
320 - ]];
315 + ]];
316 + quoteCaption = [[
317 + blockquote > div.caption {
318 + text-align: right;
319 + font-style: italic;
320 + &::before {
321 + content: "— ";
322 + }
323 + }
324 + ]];
321 325 code = [[
322 326 code {
323 327 display: inline-block;
324 328 background: @tone(-1);
325 329 color: @tone(0.7);
326 330 font-family: monospace;
327 331 font-size: 90%;
................................................................................
1021 1025 return htmlURI(s.uri)
1022 1026 elseif s.mode == 'embed' then
1023 1027 local mime = s.mime:clone()
1024 1028 mime.opts = {}
1025 1029 return string.format('data:%s;base64,%s', mime, ss.str.b64e(s.raw))
1026 1030 end
1027 1031 end
1028 - --figure out how to embed the given object
1029 1032 local function P(p) -- get prop
1030 1033 if b.props and b.props[p] then
1031 1034 return b.props[p]
1032 1035 end
1033 1036 return obj.props[p]
1034 1037 end
1038 +
1039 + local cap = b.cap or P'desc' or P'detail'
1040 + local capIR = '';
1041 + if b.label_node then
1042 + local ln = b.label_node
1043 + capIR = sr.htmlSpan(ln.spans, ln, s)
1044 + elseif cap then
1045 + -- the block here should really be the relevant
1046 + -- ref definition if an override caption isn't
1047 + -- specified, but oh well
1048 + capIR = sr.htmlSpan(spanparse(
1049 + cap, b.origin
1050 + ), b, s)
1051 + end
1052 +
1053 + --figure out how to embed the given object
1035 1054 local embedActs = {
1036 1055 {ss.mime'image/*', function(s,ctr)
1037 1056 if s == nil then
1038 1057 return {tag = "picture", nodes = {}}
1039 1058 else
1040 1059 local uri = uriForSource(s)
1041 1060 local fbimg, idx
................................................................................
1139 1158 goto compatFound
1140 1159 end
1141 1160 end
1142 1161 end
1143 1162 -- nothing found; install fallback link
1144 1163 if fallback then
1145 1164 local lnk = htmlURI(fallback.uri)
1146 - return tag('a', {href=lnk},
1147 - tag('div',{class=xref},
1148 - string.format("→ %s [%s]", b.cap or '', tostring(fallback.mime))))
1165 + return tag('a', {href=lnk}, catenate {
1166 + tag('div',{class=xref}, catenate {
1167 + '→ '; capIR;
1168 + string.format(" [%s]", tostring(fallback.mime));
1169 + })})
1149 1170 else
1150 1171 addStyle 'docmeta'
1151 1172 return tag('div',{class="render-warn"},
1152 1173 'could not embed object type ' .. tostring(obj.srcs.mime))
1153 1174 end
1154 1175
1155 1176 ::compatFound::
................................................................................
1156 1177 local top = rtype[2]() -- create container
1157 1178 for n, src in ipairs(obj.srcs) do
1158 1179 if rtype[1] < src.mime then
1159 1180 rtype[2](src, top)
1160 1181 end
1161 1182 end
1162 1183 local ft = flatten(top)
1163 - local cap = b.cap or P'desc' or P'detail'
1164 1184 if b.mode == 'inline' then
1165 1185 -- TODO insert caption
1166 1186 return ft
1167 1187 else
1168 1188 local prop = {}
1169 1189 if b.mode == 'open' then
1170 1190 prop.open = true
1171 1191 end
1172 1192 return tag('details', prop, catenate {
1173 - tag('summary', {},
1174 - cap and (
1175 - -- the block here should really be the relevant
1176 - -- ref definition if an override caption isn't
1177 - -- specified, but oh well
1178 - sr.htmlSpan(spanparse(
1179 - cap, b.origin
1180 - ), b, s)
1181 - ) or '');
1193 + tag('summary', {}, capIR);
1182 1194 ft;
1183 1195 })
1184 1196 end
1185 1197 end
1186 1198
1187 1199 function block_renderers.macro(b,s)
1188 1200 local all = renderSubdoc(b.doc)
1189 1201 local cat = catenate(ss.map(flatten,all))
1190 1202 return tag(nil, {}, cat)
1191 1203 end
1192 1204
1193 1205 function block_renderers.quote(b,s)
1194 1206 local ir = renderSubdoc(b.doc)
1207 + if b.label_node then
1208 + addStyle 'quoteCaption'
1209 + table.insert(ir, tag('div', {class='caption'},
1210 + sr.htmlSpan(b.label_node.spans, b.label_node, s)))
1211 + end
1195 1212 return tag('blockquote', b.id and {id=getSafeID(b)} or {}, catenate(ss.map(flatten,ir)))
1196 1213 end
1197 1214
1198 1215 return block_renderers
1199 1216 end
1200 1217
1201 1218 local function getRenderers(procs)