cortav  Diff

Differences From Artifact [e689cbb41c]:

To Artifact [e178fd542c]:


259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
...
313
314
315
316
317
318
319
320









321
322
323
324
325
326
327
....
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
















1035
1036
1037
1038
1039
1040
1041
....
1139
1140
1141
1142
1143
1144
1145
1146
1147

1148

1149
1150
1151
1152
1153
1154
1155
....
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194





1195
1196
1197
1198
1199
1200
1201
		subtitle = [[
			.subtitle {
				color: @tone(0.3 20); 
				font-size: 1.2em;
				font-style: italic;
				margin-left: 1em;
			}
			blockquote + .subtitle {
				&::before {
					content: "— ";
				}
			}
		]];
		accent = [[
			@media screen {
				body { background: @bg; color: @fg }
				a[href] {
					color: @tone(0.7 30);
					text-decoration-color: @tone/0.4(0.7 30);
................................................................................
			}
			section > aside p:first-child {
				margin: 0;
			}
         section aside + aside {
				margin-top: 0.5em;
			}
      ]];









		code = [[
			code {
				display: inline-block;
				background: @tone(-1);
				color: @tone(0.7);
				font-family: monospace;
				font-size: 90%;
................................................................................
					return htmlURI(s.uri)
				elseif s.mode == 'embed' then
					local mime = s.mime:clone()
					mime.opts = {}
					return string.format('data:%s;base64,%s', mime, ss.str.b64e(s.raw))
				end
			end
			--figure out how to embed the given object
			local function P(p) -- get prop
				if b.props and b.props[p] then
					return b.props[p]
				end
				return obj.props[p]
			end
















			local embedActs = {
				{ss.mime'image/*',       function(s,ctr)
					if s == nil then
						return {tag = "picture", nodes = {}}
					else
						local uri = uriForSource(s)
						local fbimg, idx
................................................................................
						goto compatFound
					end
				end
			end
			-- nothing found; install fallback link
				if fallback then
					local lnk = htmlURI(fallback.uri)
					return tag('a', {href=lnk},
								  tag('div',{class=xref},

										string.format("→ %s [%s]", b.cap or '', tostring(fallback.mime))))

				else
					addStyle 'docmeta'
					return tag('div',{class="render-warn"},
								  'could not embed object type ' .. tostring(obj.srcs.mime))
				end

			::compatFound::
................................................................................
			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 P'desc' or P'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(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

		return block_renderers
	end

	local function getRenderers(procs)







<
<
<
<
<







 







|
>
>
>
>
>
>
>
>
>







 







<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
>
|
>







 







<









|
<
<
<
<
<
<
<
<













>
>
>
>
>







259
260
261
262
263
264
265





266
267
268
269
270
271
272
...
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
....
1025
1026
1027
1028
1029
1030
1031

1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
....
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
....
1177
1178
1179
1180
1181
1182
1183

1184
1185
1186
1187
1188
1189
1190
1191
1192
1193








1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
		subtitle = [[
			.subtitle {
				color: @tone(0.3 20); 
				font-size: 1.2em;
				font-style: italic;
				margin-left: 1em;
			}





		]];
		accent = [[
			@media screen {
				body { background: @bg; color: @fg }
				a[href] {
					color: @tone(0.7 30);
					text-decoration-color: @tone/0.4(0.7 30);
................................................................................
			}
			section > aside p:first-child {
				margin: 0;
			}
         section aside + aside {
				margin-top: 0.5em;
			}
		]];
		quoteCaption = [[
			blockquote > div.caption {
				text-align: right;
				font-style: italic;
				&::before {
					content: "— ";
				}
			}
		]];
		code = [[
			code {
				display: inline-block;
				background: @tone(-1);
				color: @tone(0.7);
				font-family: monospace;
				font-size: 90%;
................................................................................
					return htmlURI(s.uri)
				elseif s.mode == 'embed' then
					local mime = s.mime:clone()
					mime.opts = {}
					return string.format('data:%s;base64,%s', mime, ss.str.b64e(s.raw))
				end
			end

			local function P(p) -- get prop
				if b.props and b.props[p] then
					return b.props[p]
				end
				return obj.props[p]
			end

			local cap = b.cap or P'desc' or P'detail'
			local capIR = '';
			if b.label_node then
				local ln = b.label_node
				capIR = sr.htmlSpan(ln.spans, ln, s)
			elseif cap then
				 -- the block here should really be the relevant
				 -- ref definition if an override caption isn't
				 -- specified, but oh well
				capIR = sr.htmlSpan(spanparse(
					cap, b.origin
				), b, s)
			end

			--figure out how to embed the given object
			local embedActs = {
				{ss.mime'image/*',       function(s,ctr)
					if s == nil then
						return {tag = "picture", nodes = {}}
					else
						local uri = uriForSource(s)
						local fbimg, idx
................................................................................
						goto compatFound
					end
				end
			end
			-- nothing found; install fallback link
				if fallback then
					local lnk = htmlURI(fallback.uri)
					return tag('a', {href=lnk}, catenate {
							  tag('div',{class=xref}, catenate {
								  '→ '; capIR;
								  string.format(" [%s]", tostring(fallback.mime));
							  })})
				else
					addStyle 'docmeta'
					return tag('div',{class="render-warn"},
								  'could not embed object type ' .. tostring(obj.srcs.mime))
				end

			::compatFound::
................................................................................
			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)

			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', {}, capIR);








					ft;
				})
			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)
			if b.label_node then
				addStyle 'quoteCaption'
				table.insert(ir, tag('div', {class='caption'},
					sr.htmlSpan(b.label_node.spans, b.label_node, s)))
			end
			return tag('blockquote', b.id and {id=getSafeID(b)} or {}, catenate(ss.map(flatten,ir)))
		end

		return block_renderers
	end

	local function getRenderers(procs)