221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
local sec = secptr.ref
if sec.heading_node then -- does this section have a label?
local ent = tag('li',nil,
catenate{tag('a', {href='#'..getSafeID(sec)},
sr.htmlSpan(sec.heading_node.spans, sec.heading_node, sec))})
if secptr.depth > #stack then
local n = {tag = 'ol', attrs={}, nodes={ent}}
table.insert(top().nodes[#top().nodes].nodes, n)
table.insert(stack, n)
else
if secptr.depth < #stack then
for j=#stack,secptr.depth+1,-1 do stack[j] = nil end
end
table.insert(top().nodes, ent)
end
-- now we need to assemble a list of items within the
-- section worthy of an entry on their own. currently
-- this is only anchors created with %toc mark|name
local innerlinks = {}
local noteworthy = { anchor = true }
|
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
local sec = secptr.ref
if sec.heading_node then -- does this section have a label?
local ent = tag('li',nil,
catenate{tag('a', {href='#'..getSafeID(sec)},
sr.htmlSpan(sec.heading_node.spans, sec.heading_node, sec))})
if secptr.depth > #stack then
local n = {tag = 'ol', attrs={}, nodes={ent}}
if top() then
table.insert(top().nodes[#top().nodes].nodes, n)
end
table.insert(stack, n)
else
if secptr.depth < #stack then
for j=#stack,secptr.depth+1,-1 do stack[j] = nil end
end
if top() then
table.insert(top().nodes, ent)
end
end
-- now we need to assemble a list of items within the
-- section worthy of an entry on their own. currently
-- this is only anchors created with %toc mark|name
local innerlinks = {}
local noteworthy = { anchor = true }
|