Extension:InterwikiExtracts/ja

InterwikiExtracts (formerly WikipediaExtracts) is an extension to reuse content from other wikis. It introduces the  parser function that gets content from any wiki defined in your  table. See for adding new wikis to the interwiki table.

The content can be returned in three formats: HTML, wikitext or plain text. See the section for details about each format.

New interwikis
To reuse content from a wiki, it must be loaded in the table. MediaWiki comes with a bunch of wikis already loaded, including the English Wikipedia and many other Wikimedia projects, so these wikis work out of the box.

To easily add new wikis to the interwiki table, install Extension:Interwiki and vist Special:Interwiki. Be sure to include the URL of the API of the wiki you want to add, or it wont work.

In older versions of the Interwiki extension, it isn't possible to set the URL of the API from the special page, so you must set it directly from the database by running a SQL command like the following:

HTML
By default, the extension gets content from Wikipedia in HTML format. So to get the HTML of any Wikipedia article, just write:

If you omit the title, then the title of the current page will be used. If you enter the title of a redirect page, the redirect will be followed and the content of the target article will be returned. If the redirect is to a section of the target article it will extract the full article and not just the section.

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

ウィキテキスト
You can get content in wikitext format with the following syntax:

The content will be parsed after getting it, which means that any links to pages in your wiki that don't exist yet will show red, including templates!

The wikitext format is unlikely to be useful with content from Wikipedia, but it may be more useful with content from smaller wikis, with less internal links and templates.

Plain text
To get content in plain text format, the target wiki needs to have the TextExtracts extension enabled. All Wikimedia wikis have it enabled, but other wikis may not!

To get content in plain text format, use the following syntax:

The available parameters are:


 * section – Title of the section to get (excluding subsections).
 * paragraphs – Number of paragraphs to get
 * intro – Whether or not to get content only before the first section. Any value means true.
 * sentences – Number of sentences to get from the intro. Cannot be used together with the "chars" parameter.
 * chars – Number of characters you get. Cannot be used together with the "sentences" parameter.
 * 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".

Except for 'section' and 'paragraphs', all parameters are based on the API of the Extension:TextExtracts. Check its documentation for more details.

Wrapper 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 want to use the extension to get the introductions of Wikipedia articles, you could create a template called Template:WikipediaLead with the following content:

Calling this template without any parameters will get the lead section of the Wikipedia article with the same title as the current page. If you want the lead of a different article, you can specify the article through the first parameter, like so:

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

Calling this template without any parameters will get you the first sentence of the Wikipedia article with the same title as the current page. If you want the first sentence of a different article, you can specify the article through the first parameter.

Crediting the authors
When using this extension, you should always credit the authors of the content you're reusing. You can easily do so by including a link in your wrapper template. For example:

[ From Wikipedia]

関連項目

 * Extension:TextExtracts
 * Appropedia:Template:Wikipedia excerpt - Real use case of this extension