Roan Kattouw schreef:
Tom Wright schreef:
Sorry - Insufficient reading on my part. This
only seems to be able to
go down one level of depth (i.e one can't get subsections) - but this
is probably good enough for most purposes - particularly the one I had
in mind.
Is there a way getting a list of the section names directly? I can't
seem to find a command in index.php, api.php or query.php.
Currently, there isn't. I'll see if I can add such a feature tomorrow
(I'm in Europe and it's 22:45 right now).
This is sort of possible
already:
api.php?action=parse&text={{:My_page}}__TOC__&prop=sections
However, this won't give the expected result when trying to get the
section tree of a template that has sections inside <noinclude> tags. In
that case, you should use: (not available on the live servers yet)
api.php?action=parse&page=Template:My_template&prop=sections
But that in turn has the drawback of not generating a section tree if
there are three sections or less, or if there's a __NOTOC__ somewhere.
In that (rare) case, you should probably accept that you're screwed.
Roan Kattouw (Catrope)