API:Parse

From MediaWiki.org
Jump to: navigation, search


Prefix: None Required Rights: None POST Only? No

This module parses wikitext and returns parser output

Parameters [edit]

  • 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 – Do a pre-save transform (PST) on the input, but don't parse it

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
    • 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 - Adds the revision id of the parsed page
    • 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 sections is explicitly requested and the page contains headings/sub-headings (overrides __NOTOC__).

Type: one of text, langlinks, languageshtml, categories, categorieshtml, links, templates, images, externallinks, sections, revid, displaytitle, headitems, headhtml, iwlinks
  • pst – Do a pre-save transform on the input before parsing it. 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 – Title of page the text belongs to.
  • uselang – Which language to parse the request in. Type: string

Errors Codes [edit]

  • 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.