Differences From
Artifact [599907d26e]:
79 79 sreq = function(me, r)
80 80 me:flush()
81 81 table.insert(me.lines, "'"..r)
82 82 end;
83 83 esc = function(me, e)
84 84 me:raw('\\' .. e)
85 85 end;
86 - draw = function(me, args)
87 - for _,v in ipairs(args) do
86 + draw = function(me, args)
87 + for _,v in ipairs(args) do
88 88 me:esc("D'" .. v .. "'")
89 - end
90 - end;
89 + end
90 + end;
91 91 flush = function(me)
92 92 if me.linbuf ~= nil then
93 93 local line = me.linbuf:compile()
94 94 local first = line:sub(1,1)
95 95 -- make sure our lines aren't accidentally interpreted
96 96 -- as groff requests. groff is kinda hostile to script
97 97 -- generation, huh?
................................................................................
418 418 end
419 419
420 420 local blockRenderers = {}
421 421 blockRenderers['horiz-rule'] = function(rc, b, sec)
422 422 rc.prop.margin = { top = 0.3 }
423 423 rc.prop.underline = 0.1
424 424 end
425 - function blockRenderers.label(rc, b, sec)
425 + function blockRenderers.label(rc, b, sec)
426 426 if ct.sec.is(b.captions) then
427 427 local visDepth = b.captions.depth + (b.origin.docDepth or 0)
428 428 local sizes = {36,24,12,8,4,2}
429 429 local margins = {0,3}
430 430 local dedents = {2.5,1.3,0.8,0.4}
431 431 local uls = {3,1.5,0.5,0.25}
432 432 rc.prop.dsz = sizes[visDepth] or 10
................................................................................
443 443 rc.prop.breakBefore = true
444 444 end
445 445 rs.renderSpans(rc, b.spans, b, sec)
446 446 else
447 447 ss.bug 'tried to render label for an unknown object type':throw()
448 448 end
449 449 end
450 - function blockRenderers.paragraph(rc, b, sec)
450 + function blockRenderers.paragraph(rc, b, sec)
451 + rs.renderSpans(rc, b.spans, b, sec)
452 + end
453 + function blockRenderers.subtitle(rc, b, sec)
454 + rc.prop.dsz = 16 -- TODO base on "parent" label
455 + rc.prop.emph = true
451 456 rs.renderSpans(rc, b.spans, b, sec)
452 457 end
453 - function blockRenderers.macro(rc, b, sec)
458 + function blockRenderers.macro(rc, b, sec)
454 459 local rc = rc.parent:clone()
455 460 rs.renderDoc(rc, b.doc)
456 461 end
457 - function blockRenderers.quote(rc, b, sec)
462 + function blockRenderers.quote(rc, b, sec)
458 463 local rc = rc.parent:clone()
459 464 rc.prop.indent = (rc.prop.indent or 0) + 1
460 465 local added = rs.renderDoc(rc, b.doc)
461 466 -- select last block of last section and increase bottom margin
462 467 local ap = added[#added].blocks
463 468 ap = ap[#ap].prop
464 469 if ap.margin then
................................................................................
467 472 else
468 473 ap.margin.bottom = 1.1
469 474 end
470 475 else
471 476 ap.margin = {bottom = 1.1}
472 477 end
473 478 end
474 - function blockRenderers.table(rc, b, sec)
479 + function blockRenderers.table(rc, b, sec)
475 480 function rc:begin(g)
476 481 g:req 'TS'
477 482 local aligns = {}
478 483 for i, c in ipairs(b.rows[1]) do
479 484 aligns[i] = ({
480 485 left = 'l';
481 486 center = 'c';