Extension:WikipediaExtracts

The WikipediaExtracts extension allows you to insert content extracted directly from Wikipedia into any MediaWiki wiki. The content extracted comes in the form of limited wikitext, omitting leading templates, links to files or pages, etc., so it looks great on any wiki.

Configuration
The only configuration variable of this extension allows you to specify the user agent of your application, like so:

By default, the user agent will be WikipediaExtracts, but you should use a customized user agent.

Usage
To insert the content of any Wikipedia article into any page, simply write:

If you omit the title, then the title of the current page will be used. You can also use the link to the article:

You can control several aspects of the content you get from Wikipedia by passing parameters to the parser function, using the familiar template syntax. For example:

The available parameters are:


 * language - The language of the Wikipedia you query ("en", "es", "de", etc.) The default is the content language of your wiki.
 * chars - The number of characters you get. Cannot be used together with the "sentences" parameter.
 * sentences - The number of sentences you get. Cannot be used together with the "chars" parameter.
 * intro - Whether or not to get content only before the first section. Any value means true.
 * plaintext - Whether or not to get content as plain text rather than limited HTML. Any value means true.
 * sectionformat - Either "plain", "wiki" or "raw". Default is "wiki".

Most of these parameters are based on the API of the Extension:TextExtracts, check its documentation for more details.

Templates
Usually you'll want to wrap the parser function in a template, to simplify the syntax and set sensible defaults. For example, if you plan on using this extension for inserting the introductions of Wikipedia articles, you could create a template called Template:WikipediaIntro with the following content:

Calling this template without any parameters will insert the introduction of the Wikipedia article with the same title as the page you're currently at. If you want the introduction of a different article, you can pass the desired title through the first parameter, like so:

Similarly, if you want to use this extension for inserting mostly definitions extracted from Wikipedia, you could create a template called Template:WikipediaDefinition with the following content:

Calling this template without any parameters will insert the first sentence of the Wikipedia article with the same title as the page you're currently at. If you want the first sentence of a different article, you can pass the desired title through the first parameter, and if you want more than one sentence from the article, you can pass the second parameter, like so:

Crediting Wikipedia
When using this extension, you should credit Wikipedia for the extracted content. You can easily do so by including a link to Wikipedia at the bottom of your templates. For example:

Extracted from [ Wikipedia]

Or maybe with a "Read more..." message:

[ Read more...]