6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
...
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
-- good both on a screen and when printed.
-- > cortav -m render:format html
local ct = require 'cortav'
local ss = require 'sirsem'
-- install rendering function for html
function ct.render.html(doc, opts)
local doctitle = opts['title']
local f = string.format
local getSafeID = ct.tool.namespace()
local footnotes = {}
local footnotecount = 0
................................................................................
style_rules = styles; -- use stylesneeded if at all possible
style_add = addStyle;
stylesets = stylesets;
stylesets_active = stylesNeeded;
obj_htmlid = getSafeID;
-- remaining fields added later
}
local renderJob = doc:job('render_html', nil, render_state_handle)
doc.stage.job = renderJob;
local runhook = function(h, ...)
return renderJob:hook(h, render_state_handle, ...)
end
................................................................................
end
else
b.origin:fail('%s is not an object that can be embedded', t.ref)
end
end
function span_renderers.var(v,b,s)
local val
if v.pos then
if not v.origin.invocation then
v.origin:fail 'positional arguments can only be used in a macro invocation'
elseif not v.origin.invocation.args[v.pos] then
v.origin.invocation.origin:fail('macro invocation %s missing positional argument #%u', v.origin.invocation.macro, v.pos)
end
val = v.origin.invocation.args[v.pos]
else
val = v.origin.doc:context_var(v.var, v.origin)
end
if v.raw then
return val
else
return htmlSpan(ct.parse_span(val, v.origin), b, s)
end
end
function span_renderers.raw(v,b,s)
return htmlSpan(v.spans, b, s)
end
|
|
>
>
>
>
>
>
>
>
>
>
|
<
<
<
<
<
<
<
<
<
<
|
<
<
|
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
...
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
|
-- good both on a screen and when printed.
-- > cortav -m render:format html
local ct = require 'cortav'
local ss = require 'sirsem'
-- install rendering function for html
function ct.render.html(doc, opts, setup)
local doctitle = opts['title']
local f = string.format
local getSafeID = ct.tool.namespace()
local footnotes = {}
local footnotecount = 0
................................................................................
style_rules = styles; -- use stylesneeded if at all possible
style_add = addStyle;
stylesets = stylesets;
stylesets_active = stylesNeeded;
obj_htmlid = getSafeID;
-- remaining fields added later
}
-- this is kind of gross but the context object belongs to the parser,
-- not the renderer, so that's not a suitable place for this information
doc.stage = {
kind = 'render';
format = 'html';
html_render_state = render_state_handle;
}
setup(doc.stage)
local renderJob = doc:job('render_html', nil, render_state_handle)
doc.stage.job = renderJob;
local runhook = function(h, ...)
return renderJob:hook(h, render_state_handle, ...)
end
................................................................................
end
else
b.origin:fail('%s is not an object that can be embedded', t.ref)
end
end
function span_renderers.var(v,b,s)
local r, raw = ct.expand_var(v)
if raw then return r else
return htmlSpan(r , b, s)
end
end
function span_renderers.raw(v,b,s)
return htmlSpan(v.spans, b, s)
end
|