Page MenuHomePhabricator

api.php should be able to load only a section of wikitext of a page
Closed, ResolvedPublic

Description

Author: alistrius

Description:
hello,

it should be very useful that api.php can load only a section of wikitext like index.php can do :

index.php?title=titleOfThePage&action=edit&section=nSection

something like

action=query&prop=revisions&rvprop=content&titles=wgTitle&section=nSection ?


Version: unspecified
Severity: enhancement

Details

Reference
bz11353

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:00 PM
bzimport set Reference to bz11353.
bzimport added a subscriber: Unknown Object (MLST).

cannon.danielc wrote:

This could be quite problematic when loading content from a page's revisions over time. In particular, section numbers are determined based upon the placement of the sections within the current revision. In previous revisions, the section referred to may not exist or there may have been other sections previous to it that would effect the numbering of the section. For one revision, this should be do-able; however, I think it's best implemented not as a feature of the API but rather as a function of "action=raw". For instance, http://en.wikipedia.org/w/index.php?title=Chad&action=raw&section=1 (which doesn't work at the moment) could provide you with the contents of the "History" section.

cannon.danielc wrote:

Committed r26142 which enables the retrieval of the raw content of a section of a page via action=raw; e.g. http://en.wikipedia.org/w/index.php?title=Chad&action=raw&section=1 now works. I think this should suffice.

alistrius wrote:

the raw fits my need perfectly (absolutely nothing to strip above all) so it's even better than i expected with api.php, thanks.(In reply to comment #2)

Committed r26142 which enables the retrieval of the raw content of a section of
a page via action=raw; e.g.
http://en.wikipedia.org/w/index.php?title=Chad&action=raw&section=1 now works.
I think this should suffice.