Would anyone be opposed to a "partial-content" call in the api that would return a particular section of a media-wiki page. This could be provided by adding a "rvpath=" option to the "prop=revisions" call, that adds a path to a particular session.
So for example api.php?action=query&prop=revisions&titles=Telephone&rvprop=timestamp|user|comment|content&rvpath=History.Early%20Development would return the early development subsection of the history section of the telephone article.
One would the need an additional call to return the section tree of a document, perhaps: api.php?action=query&prop=revisions&rvprop=sections.
The motivation behind this would be (a) To reduce bandwidth use for certain types of queries. (b) To prevent client programs from having to parse so much html by hand.
In this could be implemented on the server without too much overhead, since the section tree could be cached, and needs to be calculated when rendering a document to create tables of content.
Is this a terribly bad idea? Is this syntax okay?
Thanks very much. Tom Wright
Tom Wright schreef:
Would anyone be opposed to a "partial-content" call in the api that would return a particular section of a media-wiki page. This could be provided by adding a "rvpath=" option to the "prop=revisions" call, that adds a path to a particular session.
So for example api.php?action=query&prop=revisions&titles=Telephone&rvprop=timestamp|user|comment|content&rvpath=History.Early%20Development would return the early development subsection of the history section of the telephone article.
One would the need an additional call to return the section tree of a document, perhaps: api.php?action=query&prop=revisions&rvprop=sections.
The motivation behind this would be (a) To reduce bandwidth use for certain types of queries. (b) To prevent client programs from having to parse so much html by hand.
In this could be implemented on the server without too much overhead, since the section tree could be cached, and needs to be calculated when rendering a document to create tables of content.
Is this a terribly bad idea? Is this syntax okay?
We kinda already have this. index.php?action=raw&title=Example§ion=2 will return the 2nd section only. Using section=0 will get the top of the article, i.e. the part before the first section header.
Roan Kattouw (Catrope)
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.
Thanks very much, Tom Wright.
On Jan 28, 2008 6:18 PM, Roan Kattouw roan.kattouw@home.nl wrote:
Tom Wright schreef:
Would anyone be opposed to a "partial-content" call in the api that would return a particular section of a media-wiki page. This could be provided by adding a "rvpath=" option to the "prop=revisions" call, that adds a path to a particular session.
So for example api.php?action=query&prop=revisions&titles=Telephone&rvprop=timestamp|user|comment|content&rvpath=History.Early%20Development would return the early development subsection of the history section of the telephone article.
One would the need an additional call to return the section tree of a document, perhaps: api.php?action=query&prop=revisions&rvprop=sections.
The motivation behind this would be (a) To reduce bandwidth use for certain types of queries. (b) To prevent client programs from having to parse so much html by hand.
In this could be implemented on the server without too much overhead, since the section tree could be cached, and needs to be calculated when rendering a document to create tables of content.
Is this a terribly bad idea? Is this syntax okay?
We kinda already have this. index.php?action=raw&title=Example§ion=2 will return the 2nd section only. Using section=0 will get the top of the article, i.e. the part before the first section header.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
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).
As for query.php: it's now obsolete. All features implemented in query.php are also available through api.php (most of them better).
Roan Kattouw (Catrope)
Thanks. That would be very useful. Tom
On Jan 28, 2008 9:44 PM, Roan Kattouw roan.kattouw@home.nl wrote:
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).
As for query.php: it's now obsolete. All features implemented in query.php are also available through api.php (most of them better).
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
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)
This seems to pretty much do what I need.
One last point: Is there any way to get a rendered copy of a particular section on its own.
I'll try to avoid asking you to implement things that already work in the future :).
Thanks very much. Tom.
On Jan 29, 2008 2:54 PM, Roan Kattouw roan.kattouw@home.nl wrote:
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)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
If the wiki had LST or the newer DPL installed then it would be possible with those api tricks. But yes, I suppose it would be best to have that parameter working that way in the api.
~Daniel Friesen(Dantman) of: -The Gaiapedia (http://gaia.wikia.com) -Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG) -and Wiki-Tools.com (http://wiki-tools.com)
Roan Kattouw wrote:
Tom Wright schreef:
This seems to pretty much do what I need.
One last point: Is there any way to get a rendered copy of a particular section on its own.
Hmm, index.php?action=render doesn't seem to respect the section parameter. I'll look into that.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org