I’ve got some space that returns a list of pages. It grabs a bunch of pages based on a tag, then for each of those pages, it gets the subpages based on tags that match the page name of the parent. It also goes one layer deeper. The return just gives me a flat list. How can I make it so the outer level pages are #, the subpages are ## and the third level are ###?
Here’s my code if it helps to explain what I’m trying to do.
function getJD(tagName)
data = getTag(tagName)
ndata = {}
for i, v in ipairs(data) do
table.insert(ndata,v)
for ii, iv in ipairs(getTag(v.name)) do
table.insert(ndata, iv)
for iii, iiv in ipairs(getTag(iv.name)) do
table.insert(ndata, iiv)
end
end
end
return ndata
end
function getTag(tagName)
tquery = query[[from index.tag("page") where table.includes(itags, tagName)]]
return tquery
end
Didn’t manage to format the third-level template like the other two templates, since sb treats " other than [[ or [==[ and escaping quotes isn’t yet implemented.
Huh, didn’t know you could nest templates! That looks perfect. I’ll give it a go, thanks!
Just a little styling to go, and that’s pretty much done. Thanks for the help!