Im writing a plugin that needs to know the last section number of an article. Or how many sections a page has. Or... Even a way to list all sections of an article (maybe by name?)
Im using the API for it.
Anyone know of anything like this in the API?.
-Adam
Adam Meyer wrote:
Anyone know of anything like this in the API?.
http://example.com/api.php?action=parse&text=%7B%7B:Main Page}}__TOC__&prop=sections
Should do it. Replace the text "Main Page" in the example with the actual name of the page you're interested in.
Mike
Perfect. Thank you.
On Jun 19, 2009, at 8:59 PM, Michael Daly wrote:
Adam Meyer wrote:
Anyone know of anything like this in the API?.
http://example.com/api.php?action=parse&text=%7B%7B:Main Page}}__TOC__&prop=sections
Should do it. Replace the text "Main Page" in the example with the actual name of the page you're interested in.
Mike
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Strangly this does not work for pages that have sub sections.
Using this, the APi outputs 1, 1.1, 1.2, 2, 3, 4 etc
Were the API expects it would just be 1, 2, 3, 4, 5, 6 (treating sub sections as full sections).
Hmm...
http://example.com/api.php?action=parse&text=%7B%7B:Main Page}}__TOC__&prop=sections
Should do it. Replace the text "Main Page" in the example with the actual name of the page you're interested in.
Mike
Adam Meyer wrote:
Strangly this does not work for pages that have sub sections.
Using this, the APi outputs 1, 1.1, 1.2, 2, 3, 4 etc
Were the API expects it would just be 1, 2, 3, 4, 5, 6 (treating sub sections as full sections).
Hmm...
http://example.com/api.php?action=parse&text=%7B%7B:Main Page}}__TOC__&prop=sections
Should do it. Replace the text "Main Page" in the example with the actual name of the page you're interested in.
Mike
This is https://bugzilla.wikimedia.org/show_bug.cgi?id=16276
mediawiki-l@lists.wikimedia.org