The Wayback Machine - https://web.archive.org/web/20151003214628/https://www.mediawiki.org/wiki/API:Parsing_wikitext/ja

API:Parsing wikitext/ja

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png このページは MediaWiki 操作 API の説明文書の一部です。
MediaWiki APIAPI:Main page

MediaWiki 操作 API

v · d · e

以下のAPIモジュールによって再処理とレンダリングのためにパーサーを呼び出すことができます。

Retrieving just the raw source wikitext can be done through prop=revisions.

expandtemplates[edit | edit source]

MediaWiki バージョン: 1.12

前処理したウィキテキスト (コメントを削除、テンプレートを展開、など) を返す

パラメーター[edit | edit source]

  • text: 前処理するウィキテキスト
  • title: 指定したページ上のウィキテキストであるかのように振る舞う (既定値: API)
    • This only really matters when parsing links to the page itself or links to subpages, or when using マジックワード like {{PAGENAME}}.

[edit | edit source]

{{Project:Sandbox}} ウィキテキストを拡張する

起こり得るエラー[edit | edit source]

なし。

構文解析[edit | edit source]

MediaWiki バージョン: 1.12

構文解析されたウィキテキストを返します。Extension:TextExtracts が追加的な API を提供します。

パラメーター[edit | edit source]

  • disablepp – Disable the PP Report from the parser output. Type: bool
  • oldid – Parse the content of this revision. Overrides page and pageid. Type: string
  • onlypst – Only do a pre-save transform (PST) on the input, don't parse it. Type: bool
    Returns the same wikitext, after a PST has been applied. Ignored if page, pageid or oldid is used. Type: bool
  • page – Parse the content of this page. Cannot be used together with text and title. Type: string
  • pageid – Parse the content of this page. Overrides page. Type: string
  • prop – Which pieces of information to get. A pipe character | separated list containing one or more of the following options:
    • text – Gives the parsed text of the wikitext.
    • langlinks – Gives the langlinks the parsed wikitext.
    • categories – Gives the categories of the parsed wikitext.
    • categorieshtml – Gives the html version of the categories.
    • languageshtml – Gives the html version of the languagelinks.
    • links – Gives the internal links in the parsed wikitext.
    • templates – Gives the templates in the parsed wikitext.
    • images – Gives the images in the parsed wikitext.
    • externallinks – Gives the external links in the parsed wikitext.
    • sections – Gives the sections in the parsed wikitext (TOC, table of contents).
    • revid – If page was used, specify the ID of the revision parsed.
    • displaytitle – Adds the title of the parsed wikitext.
    • headitems – Gives items to put in the <head> of the page.
    • headhtml – Gives parsed <head> of the page.
    • iwlinks – Gives interwiki links in the parsed wikitext.
NOTE: Section tree is only generated if there are more than 4 sections, if the __TOC__ keyword is present, or if sections is explicitly requested and the page contains headings/sub-headings (overrides __NOTOC__).
Type: string
  • pst – Do a pre-save transform (PST) on the input before parsing it (makes {{subst:}} work properly, expands tildes to signatures, etc.). Ignored if page, pageid or oldid is used. Type: bool
  • redirects – If the page parameter is set to a redirect, resolve it. Type: bool
  • section – Only retrieve the content of this section number. Type: string
  • sections – Retrieve the page's TOC (if any exists). Type: string
  • summary – Summary to parse. Type: string
  • text – Wikitext to parse. Type: string
  • title – Act like the wikitext is on this page (default: API). Type: string
    This only really matters when parsing links to the page itself or subpages, or when using マジックワード like {{PAGENAME}}.
  • uselang – 構文解析すべきテキストまたはページの言語の言語コード (英語は "en"、フランス語は "fr"、など)。型: 文字列
    This is useful for language-dependent content, such as generated by the {{LangSwitch}} template at the Commons, or generally by things dependent on {{int:Lang}}. Prior to MediaWiki 1.17, this worked by accident; since 1.17, it works by design.
  • contentmodel – 入力テキストのコンテンツ モデル。既定値は指定した title のモデルであり、title を指定しなかった場合は wikitext です。text とともに使用した場合のみ有効です。以下の値のいずれかです: wikitext, javascript, css, text, JsonZeroConfig, Scribunto, JsonSchema
  • generatexml – XML の構文解析木を生成する (contentmodel=wikitext が必須)。 型: 真偽値

[edit | edit source]

Parse wikitext [[foo]] [[API:Query|bar]] [http://www.example.com/ baz]

起こり得るエラー[edit | edit source]

コード 情報
missingrev There is no revision ID oldid
missingtitle The page you specified doesn't exist
nosuchpageid There is no page with ID $1
nosuchsection There is no section sectionnumber in page
params The page parameter cannot be used together with the text and title parameters
permissiondenied You don't have permission to view deleted revisions
readapidenied You need read permission to use this module

注 : missingtitle is returned only for syntactically invalid page titles (eg. empty). Trying to fetching a missing page will return the rendered HTML of the "page missing" notice, not an error. However, you can check the revid attribute of <param>, which will always be 0 for missing pages.

Navigation menu

Namespaces

Variants

More

Morty Proxy This is a proxified and sanitized view of the page, visit original site.