[edit] Description
This file contains the class Parser, which contains the method parse, which converts Wikitext to HTML. It performs, among other things, the following actions:
- Call helper function Parser::internalParse(), which in turns calls
- Parser::replaceVariables, which replaces magic variables, templates, and template arguments with the appropriate text.
- It calls Parser::preprocessToDom, which preprocesses some wikitext and returns the document tree.
- Next it creates a PPFrame DOM object and calls its expand() method to do the actual template magic.
- Sanitizer::removeHTMLtags(), which cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
- Parser::doTableStuff, which handles and renders the wikitext for tables.
- Parser::doDoubleUnderscore, which removes valid double-underscore items, like __NOTOC__, and records them in array
$Parser->mDoubleUnderscores.
- Parser::doHeadings, which parses and renders section headers.
- Parser::replaceInternalLinks, which processes internal links (
[[ ]]) and stores them in $Parser->mLinkHolders (a LinkHolderArray object),
- Parser::doAllQuotes, which replaces single quotes with HTML markup (<i>, <b>, etc).
- Parser::replaceExternalLinks, which replaces and renders external links.
- Parser::doMagicLinks, which replaces special strings like "ISBN xxx" and "RFC xxx" with magic external links.
- Parser::formatHeadings, which:
- auto numbers headings if that options is enabled,
- adds an [edit] link to sections for users who have enabled the option and can edit the page,
- adds a Table of contents on the top for users who have enabled the option, and
- auto-anchors headings.
- Next, parse() calls Parser::doBlockLevels, which renders lists from lines starting with ':', '*', '#', etc.
- Parser::replaceLinkHolders is called, which calls LinkHolderArray::replace on
$Parser->mLinkHolders to replace link placeholders with actual links, in the buffer Placeholders created in Skin::makeLinkObj()
- Next, the text is language converted (when applicable) using the convert method of the appropiate Language object.
- Parser::replaceTransparentTags is called, which replaces transparent tags with values which are provided by the callback functions in $Parser->mTransparentTagHooks. Transparent tag hooks are like regular XML-style tag hooks, except they operate late in the transformation sequence, on HTML instead of wikitext.
- Sanitizer::normalizeCharReferences is called, which ensures that any entities and character references are legal for XML and XHTML specifically.
- If HTML tidy is enabled, MWTidy::tidy is called to do the tidying.
- Finally the rendered HTML result of the parse process is stored in the ParserOutput object
$Parser->mOutput, which is returned to the caller of Parser::parse.
[edit] See also
[edit] External link