API:Parsing wikitext/zh

解析（Parse）动作用来处理及渲染维基源代码. 如果仅仅想要获得维基源代码，可以用查询动作（Query）.

expandtemplates
Returns preprocessed wikitext (comments stripped, templates expanded, etc.)

参数

 * : Wikitext to preprocess
 * : Act like the wikitext is on the page specified (default: )
 * This only really matters when parsing links to the page itself or links to subpages, or when using magic words like.

Possible errors
None.

parse
Returns parsed wikitext

参数

 * – Disable the PP Report from the parser output. Type: bool
 * – Parse the content of this revision. Overrides  and  . Type: string
 * – 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,   or   is used. Type: bool
 * – Parse the content of this page. Cannot be used together with  and  . Type: string
 * – Parse the content of this page. Overrides . Type: string
 * – Which pieces of information to get. A pipe character  separated list containing one or more of the following options:
 * – Gives the parsed text of the wikitext.
 * – Gives the langlinks the parsed wikitext.
 * – Gives the categories of the parsed wikitext.
 * – Gives the html version of the categories.
 * – Gives the html version of the languagelinks.
 * – Gives the internal links in the parsed wikitext.
 * – Gives the templates in the parsed wikitext.
 * – Gives the images in the parsed wikitext.
 * – Gives the external links in the parsed wikitext.
 * – 解析维基源代码，获取所有章节（即目录）. 返回值带有以下属性：
 * – If  was used, specify the ID of the revision parsed.
 * – Adds the title of the parsed wikitext.
 * – Gives items to put in the of the page.
 * – Gives parsed of the page.
 * – Gives interwiki links in the parsed wikitext.
 * NOTE: Section tree is only generated if there are more than 4 sections, if the keyword is present, or if   is explicitly requested and the page contains headings/sub-headings (overrides  ).
 * Type: string


 * – Do a pre-save transform (PST) on the input before parsing it (makes  work properly, expands tildes to signatures, etc.). Ignored if ,   or   is used. Type: bool
 * – If the  parameter is set to a redirect, resolve it. Type: bool
 * – Only retrieve the content of this section number. Type: string
 * – Retrieve the page's TOC (if any exists). Type: string
 * – Summary to parse. Type: string
 * – Wikitext to parse. Type: string
 * – Act like the wikitext is on this page (default: ). Type: string
 * This only really matters when parsing links to the page itself or subpages, or when using magic words like.
 * – The language code ("en" for English, "fr" for French, etc.) of the language in which the text or the page should be parsed. Type: string
 * This is useful for language-dependent content, such as generated by the template at the Commons, or generally by things dependent on  . Prior to MediaWiki 1.17, this worked by accident; since 1.17, it works by design.
 * – Content model of the input text. Default is the model of the specified title, or  if title is not specified. Only valid when used with text. Can be one of the following: wikitext, javascript, css, text, JsonZeroConfig, Scribunto, JsonSchema.
 * – Generate the XML parse tree (requires contentmodel=wikitext). Type: bool

Possible errors
Note:  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  attribute of, which will always be   for missing pages.
 * – There is no revision ID oldid
 * – The page you specified doesn't exist
 * – There is no page with ID $1
 * – There is no section sectionnumber in page
 * – The page parameter cannot be used together with the text and title parameters
 * – You don't have permission to view deleted revisions
 * – You need read permission to use this module