Extension:PageSummaries

An extension of the API to parse and include article summaries like the one you're reading into the API parse feed. It also creates a new API type named "summaries" that will take a list of article titles and include them into a new feed along with the article summaries. It's small, light weight, and easy to install.

What can this extension do?
This extension adds two new features to the MediaWiki API.

Since most articles are written with the first paragraph as a summary of the entire article, this extension expands on the "parse" feature of the API, finding the first paragraph of text and appending it to the output in a "summary" field. This is different and separate from the "summary" entered when changing a page.

It adds a new API module called "summaries" which, when provided with a list of article titles, will find and return the summaries for those articles with the formatted titles and links to the page.

I've used this on my site to generate "summary" boxes on other pages via AJAX calls to the API for keywords.

It is compatible will the XML, YAML, TXT, RAW, and JSON formats and probably all the rest as well.

Lastly, the script path in the link provided on return should modify based upon the path of the wiki install location but, worst case scenario, it can be changed on line 58. (Hence the reason this is still in beta.)

Usage
Standard "parse" API requests will automatically have "summary" fields added to each entry. For instance the following URL will return:

The new summaries API module is accessible by passing the action "summaries" in the query string. So that the following URL will return:

The examples here are truncated from the actual API response. There is no limit on the size of a summary so long as it is all contained within the first paragraph of text within the article. It will, however, strip out any HTML formatting done within that paragraph before including it into the summary field.

Download instructions
The package is available for download here.

Installation
To install this extension, add the following to LocalSettings.php: