# cat add category links
# ill add inter-language links
# subpage enable subpages (disabled by default)
+# noxml don't check for XML well formdness
# title=[[XXX]] run test using article title XXX
# disabled do not run test
#
</p>
!! end
+!! test
+Comment whitespace
+!! input
+<!-- returns a single newline, not nothing, since the newline after > is not stripped -->
+!! result
+
+!! end
+
+!! test
+Comment semantics and delimiters
+!! input
+<!-- --><!----><!-----><!------>
+!! result
+
+!! end
+
+!! test
+Comment semantics and delimiters, redux
+!! input
+<!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
+-- foo -- funky huh? ... -->
+!! result
+
+!! end
+
+!! test
+Comment semantics and delimiters: directors cut
+!! input
+<!-- ... However we like to keep things simple and somewhat XML-ish so we eat
+everything starting with < followed by !-- until the first -- and > we see,
+that wouldn't be valid XML however, since in XML -- has to terminate a comment
+-->-->
+!! result
+<p>-->
+</p>
+!! end
+
+!! test
+Comment semantics: nesting
+!! input
+<!--<!-- no, we're not going to do anything fancy here -->-->
+!! result
+<p>-->
+</p>
+!! end
+
+
###
### Preformatted text
###
</p>
!!end
+!! test
+Link containing "#<" and "#>" % as a hex sequences
+!! input
+[[%23%3c]]<!-- Render this as "[[#%3c]]" maybe.. ? -->[[%23%3e]]<!-- ..."[[#%3e]]" ? -->
+!! result
+<p>[[%23%3c]][[%23%3e]]
+</p>
+!! end
+
+!! test
+Link containing "<#" and ">#" as a hex sequences
+!! input
+[[%3c%23]][[%3e%23]]
+!! result
+<p>[[%3c%23]][[%3e%23]]
+</p>
+!! end
+
!! test
Plain link to URL
!! input
!! end
+
!! test
Bug 2304: HTML attribute safety (ISBN)
!! input
!! end
-
!! test
Math section safety when disabled
!! input
</p>
!! end
+# More MSIE fun discovered by Tom Gilder
+
+!! test
+MSIE CSS safety test: spurious slash
+!! input
+<div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
+!! result
+<div>evil</div>
+
+!! end
+
+!! test
+MSIE CSS safety test: hex code
+!! input
+<div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
+!! result
+<div>evil</div>
+
+!! end
+
+!! test
+MSIE CSS safety test: comment in url
+!! input
+<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
+!! result
+<div style="background-image:u rl(javascript:alert('boo'))">evil</div>
+
+!! end
+
+!! test
+MSIE CSS safety test: comment in expression
+!! input
+<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
+!! result
+<div style="background-image:expres sion(alert('boo4'))">evil4</div>
+
+!! end
+
!! test
Table attribute legitimate extension
!! end
###
-### Parser hooks
+### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
###
!! test
Parser hook: empty input
!! input
<tag></tag>
!! result
+<pre>
+string(0) ""
+array(0) {
+}
+</pre>
+
+!! end
+
+!! test
+Parser hook: empty input using terminated empty elements
+!! input
+<tag/>
+!! result
+<pre>
+NULL
+array(0) {
+}
+</pre>
+
!! end
!! test
!! input
<tag>input</tag>
!! result
-<p>input
-</p>
+<pre>
+string(5) "input"
+array(0) {
+}
+</pre>
+
!! end
+
!! test
Parser hook: case insensetive
!! input
+<TAG>input</TAG>
+!! result
+<pre>
+string(5) "input"
+array(0) {
+}
+</pre>
+
+!! end
+
+
+!! test
+Parser hook: case insensetive, redux
+!! input
<TaG>input</TAg>
!! result
-<p>input
-</p>
+<pre>
+string(5) "input"
+array(0) {
+}
+</pre>
+
+!! end
+
+!! test
+Parser hook: nested tags
+!! options
+noxml
+!! input
+<tag><tag></tag></tag>
+!! result
+<pre>
+string(5) "<tag>"
+array(0) {
+}
+</pre></tag>
+
!! end
!! test
<tag width=200 height = "100" depth = '50' square></tag>
!! result
<pre>
-Array
-(
- [width] => 200
- [height] => 100
- [depth] => 50
- [square] => square
-)
+string(0) ""
+array(4) {
+ ["width"]=>
+ string(3) "200"
+ ["height"]=>
+ string(3) "100"
+ ["depth"]=>
+ string(2) "50"
+ ["square"]=>
+ string(6) "square"
+}
</pre>
!! end
<tag foo=bar/>text
!! result
<pre>
-Array
-(
- [foo] => bar
-)
-</pre>
-text
+NULL
+array(1) {
+ ["foo"]=>
+ string(3) "bar"
+}
+</pre>text
+
!! end
# </tag> should be output literally since there is no matching tag that begins it
</tag>
!! result
<pre>
-Array
-(
- [width] => 200
- [height] => 100
- [depth] => 50
- [square] => square
-)
+NULL
+array(4) {
+ ["width"]=>
+ string(3) "200"
+ ["height"]=>
+ string(3) "100"
+ ["depth"]=>
+ string(2) "50"
+ ["square"]=>
+ string(6) "square"
+}
</pre>
-other stuff
-</tag>
-
+<p>other stuff
+</tag>
+</p>
!! end
!! end
-# More MSIE fun discovered by Tom Gilder
-
-!! test
-MSIE CSS safety test: spurious slash
-!! input
-<div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
-!! result
-<div>evil</div>
-
-!! end
-
-!! test
-MSIE CSS safety test: hex code
-!! input
-<div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
-!! result
-<div>evil</div>
-
-!! end
-
-!! test
-MSIE CSS safety test: comment in url
-!! input
-<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
-!! result
-<div style="background-image:u rl(javascript:alert('boo'))">evil</div>
-
-!! end
-
-!! test
-MSIE CSS safety test: comment in expression
-!! input
-<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
-!! result
-<div style="background-image:expres sion(alert('boo4'))">evil4</div>
-
-!! end
-
###
### Sanitizer
###
</p>
!! end
+!! test
+Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
+!! input
+<span id="æ: v">byte</span>[[#æ: v|backlink]]
+!! result
+<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
+</p>
+!! end
+
+!! test
+Sanitizer: Validating the contents of the id attribute (bug 4515)
+!! input
+<br id=9 />
+!! result
+Something, but defenetly not <br id="9" />...
+!! end
TODO:
more images