* item 1
!! endarticle
+!! article
+Template:echo
+!! text
+{{{1}}}
+!! endarticle
+
###
### Basic tests
###
### Comments
###
!! test
-Comment test 1
+Comments and Pre
!! input
+<!-- comment 1 --> asdf
+
<!-- comment 1 --> asdf
<!-- comment 2 -->
+
+<!-- comment 1 --> asdf
+<!-- comment 2 -->xyz
+
+<!-- comment 1 --> asdf
+<!-- comment 2 --> xyz
!! result
<pre>asdf
</pre>
-
+<pre>asdf
+</pre>
+<pre>asdf
+</pre>
+<p>xyz
+</p>
+<pre>asdf
+xyz
+</pre>
!! end
!! test
</p>
!! end
+!!test
+Templates: Pre: 1a. Templates that break a line should suppress <pre>
+!!input
+ {{echo|}}
+!!result
+
+!!end
+
+!!test
+Templates: Pre: 1b. Templates that break a line should suppress <pre>
+!!input
+ {{echo|
+foo}}
+!!result
+<p>foo
+</p>
+!!end
+
+!! test
+Templates: Pre: 1c: Wrapping should be based on expanded content
+!! input
+ {{echo|a
+b}}
+!!result
+<pre>a
+</pre>
+<p>b
+</p>
+!!end
+
+!! test
+Templates: Pre: 1d: Wrapping should be based on expanded content
+!! input
+ {{echo|a
+b
+c
+ d
+e
+}}
+!!result
+<pre>a
+</pre>
+<p>b
+c
+</p>
+<pre>d
+</pre>
+<p>e
+</p>
+!!end
+
+!!test
+Templates: Pre: 1e. Wrapping should be based on expanded content
+!!input
+{{echo| foo}}
+
+{{echo| foo}}
+{{echo| bar}}
+
+{{echo|<!--cmt--> foo}}
+
+<!--cmt-->{{echo| foo}}
+
+{{echo|{{echo| }}bar}}
+!!result
+<pre>foo
+</pre>
+<pre>foo
+bar
+</pre>
+<pre>foo
+</pre>
+<pre>foo
+</pre>
+<pre>bar
+</pre>
+!!end
+
+###
+### Parsoid-centric tests for testing RT edge cases
+### around comments and white-space inside pre blocks
+###
+
+!!test
+1a. Pre and Comments
+!!input
+ a
+<!--a-->
+c
+!!result
+<pre>a
+</pre>
+<p>c
+</p>
+!!end
+
+!!test
+1b. Pre and Comments
+!!input
+ a
+ <!--a-->
+c
+!!result
+<pre>a
+</pre>
+<p>c
+</p>
+!!end
+
+!!test
+1c. Pre and Comments
+!!input
+<!--a--> a
+
+ <!--a--> a
+!!result
+<pre> a
+</pre>
+<pre> a
+</pre>
+!!end
###
### Definition lists
</p>
!!end
+!! test
+External links: Pipe char between url and text
+!! input
+[http://example.com | link]
+!! result
+<p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
+</p>
+!!end
+
!! test
External links: protocol-relative URL in brackets
!! input
</p>
!! end
+!! test
+Parsoid-specific test: Wikilinks with should RT properly
+!! options
+language=ln
+!! input
+[[WW II]]
+!!result
+<p><a href="/index.php?title=WW_II&action=edit&redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW II</a>
+</p>
+!! end
##
## XHTML tidiness
!! article
Template:quote
!! text
-{{{quote|{{{1}}} }}}
+{{{quote|{{{1}}}}}}
!! endarticle
!!test
!!input
{{quote|foo}}
!!result
-<p>foo
+<p>foo
</p>
!!end
!!input
{{quote|quote}}
!!result
-<p>quote
+<p>quote
</p>
!!end
###
### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
###
-!! article
-Template:echo
-!! text
-{{{1}}}
-!! endarticle
!!test
Templates: 1. Simple use
!!end
-!!test
-Templates: Pre: 1a. Templates that break a line should suppress <pre>
-!!input
- {{echo|}}
-!!result
-
-!!end
-
-!!test
-Templates: Pre: 1b. Templates that break a line should suppress <pre>
-!!input
- {{echo|
-foo}}
-!!result
-<p>foo
-</p>
-!!end
-
!!test
Parser Functions: 1. Simple example
!!input