Markup spec/BNF/Noparse-block

A "noparse block" (my term) is a block that is parsed according to totally different logic. It is the first thing the current parser does after preprocessing, in the "strip" method. The only thing that ends one of these blocks is the matching close tag.           ::=  |  |  | 

Notes:
 * Nowiki and pre are always available.
 * Html is available if $wgRawHtml is true in localsettings.php
 * Math is available if the math extension is installed
 * Other tags may be available if installed and present in parser->mTagHooks.

Nowiki
The &lt;nowiki&gt; tag prevents special markup (like  ''  for italics) from being recognized.

             ::=     [ | (?=EOF) ]      ::= "&lt;nowiki" ( ) "&gt;"      ::= "&lt;/nowiki"  "&gt;"             ::=

In words, if a &lt;nowiki&gt; tag is not closed, then it is taken to run until the end. (?=EOF) is a look-ahead assertion, like in PCRE. It asserts that an EOF follows, but does not consume the EOF.

Translating to HTML
To translate a nowiki tag to HTML, perform the following transformations: , and each paragraph being trimed. --HappyDog 15:11, 18 June 2006 (UTC)
 * <nowiki-opening-tag> is replaced with &lt;p&gt;
 * <nowiki-closing-tag> is replaced with &lt;/p&gt;
 * <html-unsafe-symbol> terminals within <nowiki-body> are replaced with the appropriate <html-entity> (see Fundamental elements).
 * The elements in the top-level <nowiki-tag> are discarded.
 * Actually, this is not true. The <nowiki-body> is treated as paragraphs of text, as in the main tag, with blank lines being replaced with

Pre
The &lt;pre&gt; tag behaves much like nowiki, but generates a literal &lt;pre> tag, which causes different output. Notably, a nowiki is treated literally inside a pre tag, and vice versa.

<pre-block>              ::= <pre-opening-tag>  <pre-body>  [<pre-closing-tag> | (?=EOF) ] <pre-opening-tag>        ::= "&lt;pre" ( ) "&gt;" <pre-closing-tag>        ::= "&lt;/pre"  "&gt;" <pre-body>               ::=

Notes:
 * Not quite accurate, <pre-foo> is recognised, although is not.

Translating to HTML

 * <html-unsafe-symbol> terminals are replaced.
 * New lines are retained literally.
 * The whole block is wrapped in

Html
<html-block>              ::= <html-opening-tag>  <html-body>  [<html-closing-tag> | (?=EOF) ] <html-opening-tag>        ::= "&lt;html" ( ) "&gt;" <html-closing-tag>        ::= "&lt;/html"  "&gt;" <html-body>               ::=

Translating to HTML

 * All characters, including whitespace, newlines, and "html-unsafe-symbol" terminals are output literally.
 * The block is not wrapped in anything.