cortav  Diff

Differences From Artifact [599907d26e]:

To Artifact [b6c7f1e8a6]:


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
...
443
444
445
446
447
448
449
450
451
452





453
454
455
456
457
458
459
460
461
462
463
464
...
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
		sreq = function(me, r)
			me:flush()
			table.insert(me.lines, "'"..r)
		end;
		esc = function(me, e)
			me:raw('\\' .. e)
		end;
      draw = function(me, args)
         for _,v in ipairs(args) do
				me:esc("D'" .. v .. "'")
         end
      end;
		flush = function(me)
			if me.linbuf ~= nil then
				local line = me.linbuf:compile()
				local first = line:sub(1,1)
				-- make sure our lines aren't accidentally interpreted
				-- as groff requests. groff is kinda hostile to script
				-- generation, huh?
................................................................................
	end

	local blockRenderers = {}
	blockRenderers['horiz-rule'] = function(rc, b, sec)
		rc.prop.margin = { top = 0.3 }
		rc.prop.underline = 0.1
	end
	function	blockRenderers.label(rc, b, sec)
		if ct.sec.is(b.captions) then
			local visDepth = b.captions.depth + (b.origin.docDepth or 0)
			local sizes = {36,24,12,8,4,2}
			local margins = {0,3}
			local dedents = {2.5,1.3,0.8,0.4}
			local uls = {3,1.5,0.5,0.25}
			rc.prop.dsz = sizes[visDepth] or 10
................................................................................
				rc.prop.breakBefore = true
			end
			rs.renderSpans(rc, b.spans, b, sec)
		else
			ss.bug 'tried to render label for an unknown object type':throw()
		end
	end
	function	blockRenderers.paragraph(rc, b, sec)
		rs.renderSpans(rc, b.spans, b, sec)
	end





	function	blockRenderers.macro(rc, b, sec)
		local rc = rc.parent:clone()
		rs.renderDoc(rc, b.doc)
	end
	function	blockRenderers.quote(rc, b, sec)
		local rc = rc.parent:clone()
		rc.prop.indent = (rc.prop.indent or 0) + 1
		local added = rs.renderDoc(rc, b.doc)
		 -- select last block of last section and increase bottom margin
		local ap = added[#added].blocks
		ap = ap[#ap].prop
		if ap.margin then
................................................................................
			else
				ap.margin.bottom = 1.1
			end
		else
			ap.margin = {bottom = 1.1}
		end
	end
	function	blockRenderers.table(rc, b, sec)
		function rc:begin(g)
			g:req 'TS'
			local aligns = {}
			for i, c in ipairs(b.rows[1]) do
				aligns[i] = ({
					left = 'l';
					center = 'c';







|
|

|
|







 







|







 







|


>
>
>
>
>
|



|







 







|







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
		sreq = function(me, r)
			me:flush()
			table.insert(me.lines, "'"..r)
		end;
		esc = function(me, e)
			me:raw('\\' .. e)
		end;
		draw = function(me, args)
			for _,v in ipairs(args) do
				me:esc("D'" .. v .. "'")
			end
		end;
		flush = function(me)
			if me.linbuf ~= nil then
				local line = me.linbuf:compile()
				local first = line:sub(1,1)
				-- make sure our lines aren't accidentally interpreted
				-- as groff requests. groff is kinda hostile to script
				-- generation, huh?
................................................................................
	end

	local blockRenderers = {}
	blockRenderers['horiz-rule'] = function(rc, b, sec)
		rc.prop.margin = { top = 0.3 }
		rc.prop.underline = 0.1
	end
	function blockRenderers.label(rc, b, sec)
		if ct.sec.is(b.captions) then
			local visDepth = b.captions.depth + (b.origin.docDepth or 0)
			local sizes = {36,24,12,8,4,2}
			local margins = {0,3}
			local dedents = {2.5,1.3,0.8,0.4}
			local uls = {3,1.5,0.5,0.25}
			rc.prop.dsz = sizes[visDepth] or 10
................................................................................
				rc.prop.breakBefore = true
			end
			rs.renderSpans(rc, b.spans, b, sec)
		else
			ss.bug 'tried to render label for an unknown object type':throw()
		end
	end
	function blockRenderers.paragraph(rc, b, sec)
		rs.renderSpans(rc, b.spans, b, sec)
	end
	function blockRenderers.subtitle(rc, b, sec)
		rc.prop.dsz = 16 -- TODO base on "parent" label
		rc.prop.emph = true
		rs.renderSpans(rc, b.spans, b, sec)
	end
	function blockRenderers.macro(rc, b, sec)
		local rc = rc.parent:clone()
		rs.renderDoc(rc, b.doc)
	end
	function blockRenderers.quote(rc, b, sec)
		local rc = rc.parent:clone()
		rc.prop.indent = (rc.prop.indent or 0) + 1
		local added = rs.renderDoc(rc, b.doc)
		 -- select last block of last section and increase bottom margin
		local ap = added[#added].blocks
		ap = ap[#ap].prop
		if ap.margin then
................................................................................
			else
				ap.margin.bottom = 1.1
			end
		else
			ap.margin = {bottom = 1.1}
		end
	end
	function blockRenderers.table(rc, b, sec)
		function rc:begin(g)
			g:req 'TS'
			local aligns = {}
			for i, c in ipairs(b.rows[1]) do
				aligns[i] = ({
					left = 'l';
					center = 'c';