User:GarveyPatrickD/Combining the nowiki and pre tags
These are a series of tests of combining the <nowiki> and <pre> tags. This is motivated by the results seen after a migration utility was used on pages encoded in another wiki syntax for use in a replacement MediaWiki. The most important question is, is there a reason to use both of these tags together? If so, what is the effect of various nestings of the two tags?
Surrounding arbitrary text
Using only one tag
Placing all the tokens on one line in the source
No leading or trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</nowiki>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
<pre></pre> alone
Source:
<pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</pre>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Leading and trailing white space
<nowiki></nowiki> alone
Source:
<nowiki> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </nowiki>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: minimum white space is used in the result.
<pre></pre> alone
Source:
<pre> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </pre>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: white space is preserved in the result
Placing each token on a separate line in the source
No leading or trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</nowiki>
Display:
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
Note: the result is the same as placing all the tokens on one line in the source.
<pre></pre> alone
Source:
<pre>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: each token between the tags is placed on a separate line.
Leading and trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</nowiki>
Display:
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
Note: the result is the same as placing all the tokens on one line in the source.
<pre></pre> alone
Source:
<pre>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: each token between the tags is placed on a separate line with, at least, leading white space, including vertical white space.
Using both tags
Placing all the tokens on one line in the source
No leading or trailing white space
<nowiki> first, then <pre>
Source:
<nowiki><pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</pre></nowiki>
Display:
<pre>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</pre>
Note: the <pre> tag is displayed rather than consumed.
<pre> first, then <nowiki>
Source:
<pre><nowiki>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</nowiki></pre>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: both tags are consumed.
Leading and trailing white space
<nowiki> first, then <pre>
Source:
<nowiki><pre> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </pre></nowiki>
Display:
<pre> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </pre>
Note: the <pre> tag is displayed rather than consumed and the white space after the tag is minimized.
<pre> first, then <nowiki>
Source:
<pre><nowiki> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </nowiki></pre>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: both tags are consumed and the white space is preserved.
Placing each token on a separate line in the source
No leading or trailing white space
<nowiki> first, then <pre>
Source:
<nowiki>
<pre>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</pre>
</nowiki>
Display:
<pre>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</pre>
Note: the <pre> tag is displayed rather than consumed and white space is used between the tag and the next/previous token.
<pre> first, then <nowiki>
Source:
<pre>
<nowiki>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</nowiki>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: the additional vertical spacing in the result.
Leading and trailing white space
<nowiki> first, then <pre>
Source:
<nowiki>
<pre>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</pre>
</nowiki>
Display:
<pre>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</pre>
Note: the <pre> tag is displayed rather than consumed and white space is used between the tag and the next/previous token.
<pre> first, then <nowiki>
Source:
<pre>
<nowiki>
Lorem
ipsum
dolor
sit
amet,
consectetur
adipiscing
elit.
</nowiki>
Display:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Note: the additional vertical spacing and preserved horizontal spacing in the result.
Surrounding a Universal Record Locator (URL)
The Universal Record Locator (URL) value is:
https://secure.wikimedia.org/
Using only one tag
Placing all the tokens on one line in the source
No leading or trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>https://wikimediafoundation.org/wiki/Home</nowiki>
Display:
https://secure.wikimedia.org/
<pre></pre> alone
Source:
<pre>https://secure.wikimedia.org/</pre>
Display:
https://secure.wikimedia.org/
Leading and trailing white space
<nowiki></nowiki> alone
Source:
<nowiki> https://secure.wikimedia.org/ </nowiki>
Display:
https://secure.wikimedia.org/
Note: minimum white space is used in the result.
<pre></pre> alone
Source:
<pre> https://secure.wikimedia.org/ </pre>
Display:
https://secure.wikimedia.org/
Note: white space is preserved in the result
Placing each token on a separate line in the source
No leading or trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>
https://secure.wikimedia.org/
Display:
https://secure.wikimedia.org/
Note: the result is the same as placing all the tokens on one line in the source.
<pre></pre> alone
Source:
<pre>
https://secure.wikimedia.org/
Display:
https://secure.wikimedia.org/
Note: each token between the tags is placed on a separate line.
Leading and trailing white space
<nowiki></nowiki> alone
Source:
<nowiki>
</nowiki>
Display:
https://secure.wikimedia.org/
Note: the result is the same as placing all the tokens on one line in the source.
<pre></pre> alone
Source:
<pre>
Display:
https://secure.wikimedia.org/
Note: each token between the tags is placed on a separate line with, at least, leading white space, including vertical white space.
Using both tags
Placing all the tokens on one line in the source
No leading or trailing white space
<nowiki> first, then <pre>
Source:
<nowiki><pre>https://secure.wikimedia.org/</pre></nowiki>
Display:
<pre>https://secure.wikimedia.org/</pre>
Note: the <pre> tag is displayed rather than consumed.
<pre> first, then <nowiki>
Source:
<pre><nowiki>https://secure.wikimedia.org/</nowiki></pre>
Display:
https://secure.wikimedia.org/
Note: both tags are consumed.
Leading and trailing white space
<nowiki> first, then <pre>
Source:
<nowiki><pre> https://secure.wikimedia.org/ </pre></nowiki>
Display:
<pre> https://secure.wikimedia.org/ </pre>
Note: the <pre> tag is displayed rather than consumed and the white space after the tag is minimized.
<pre> first, then <nowiki>
Source:
<pre><nowiki> https://secure.wikimedia.org/ </nowiki></pre>
Display:
https://secure.wikimedia.org/
Note: both tags are consumed and the white space is preserved.
Placing each token on a separate line in the source
No leading or trailing white space
<nowiki> first, then <pre>
Source:
<nowiki>
<pre>
https://secure.wikimedia.org/
</pre>
</nowiki>
Display:
<pre>
https://secure.wikimedia.org/
</pre>
Note: the <pre> tag is displayed rather than consumed and white space is used between the tag and the next/previous token.
<pre> first, then <nowiki>
Source:
<pre>
<nowiki>
https://secure.wikimedia.org/
</nowiki>
Display:
https://secure.wikimedia.org/
Note: the additional vertical spacing in the result.
Leading and trailing white space
<nowiki> first, then <pre>
Source:
<nowiki>
<pre>
</pre>
</nowiki>
Display:
<pre>
https://secure.wikimedia.org/
</pre>
Note: the <pre> tag is displayed rather than consumed and white space is used between the tag and the next/previous token.
<pre> first, then <nowiki>
Source:
<pre>
<nowiki>
</nowiki>
Display:
https://secure.wikimedia.org/
Note: the additional vertical spacing and preserved horizontal spacing in the result.
Conclusion
Using the <nowiki></nowiki> tag pair inside a <pre></pre> tag pair has no additional effect.