API - getting the last section, or listing sections

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

API - getting the last section, or listing sections

Adam Meyer
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

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: API - getting the last section, or listing sections

Michael Daly-5
Adam Meyer wrote:

> Anyone know of anything like this in the API?.

http://example.com/api.php?action=parse&text={{: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
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: API - getting the last section, or listing sections

Adam Meyer
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={{: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
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l


_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: API - getting the last section, or listing sections

Adam Meyer
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={{: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
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: API - getting the last section, or listing sections

Alex Zaddach
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={{: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

--
Alex (wikipedia:en:User:Mr.Z-man)

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l