2015-06-23 04:41:39 +00:00
|
|
|
!! hooks
|
|
|
|
source
|
|
|
|
!! endhooks
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Non-existent language
|
|
|
|
!!input
|
|
|
|
<source lang="doesnotexist">
|
|
|
|
foobar
|
|
|
|
</source>
|
|
|
|
!! result
|
2015-07-03 13:42:46 +00:00
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>foobar</pre></div>
|
2015-06-23 04:41:39 +00:00
|
|
|
|
|
|
|
!! end
|
|
|
|
|
2015-07-07 21:06:08 +00:00
|
|
|
!! test
|
|
|
|
No language specified
|
|
|
|
!! wikitext
|
|
|
|
<source>
|
|
|
|
foo
|
|
|
|
</source>
|
|
|
|
!! html
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>foo</pre></div>
|
|
|
|
|
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
No language specified (no wellformed xml)
|
|
|
|
!! config
|
|
|
|
!! wikitext
|
|
|
|
<source>
|
|
|
|
bar
|
|
|
|
</source>
|
|
|
|
!! html
|
2016-05-16 10:01:22 +00:00
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>bar</pre></div>
|
2015-07-07 21:06:08 +00:00
|
|
|
|
|
|
|
!! end
|
|
|
|
|
2015-06-23 04:41:39 +00:00
|
|
|
!! test
|
|
|
|
XSS is escaped
|
|
|
|
!!input
|
|
|
|
<source lang="doesnotexist">
|
|
|
|
<script>alert("pwnd")</script>
|
|
|
|
<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>
|
|
|
|
<IMG
|
|
|
|
SRC=javascript:alert(
|
|
|
|
'XSS')
|
|
|
|
\";alert('XSS');//
|
|
|
|
</script><script>alert('XSS');</script>
|
|
|
|
%253cscript%253ealert(document.cookie)%253c/script%253e
|
|
|
|
</source>
|
|
|
|
!! result
|
2015-07-03 13:42:46 +00:00
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><script>alert("pwnd")</script>
|
2015-06-23 04:41:39 +00:00
|
|
|
<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>
|
|
|
|
<IMG
|
|
|
|
SRC=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;
|
|
|
|
&#39;&#88;&#83;&#83;&#39;&#41;
|
|
|
|
\";alert('XSS');//
|
|
|
|
</script><script>alert('XSS');</script>
|
|
|
|
%253cscript%253ealert(document.cookie)%253c/script%253e</pre></div>
|
|
|
|
|
|
|
|
!! end
|
2015-06-25 04:46:42 +00:00
|
|
|
|
2015-07-03 13:42:46 +00:00
|
|
|
!! test
|
|
|
|
XSS is escaped (inline)
|
|
|
|
!!input
|
|
|
|
<source lang="doesnotexist" inline>
|
|
|
|
<script>alert("pwnd")</script>
|
|
|
|
<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>
|
|
|
|
<IMG
|
|
|
|
SRC=javascript:alert(
|
|
|
|
'XSS')
|
|
|
|
\";alert('XSS');//
|
|
|
|
</script><script>alert('XSS');</script>
|
|
|
|
%253cscript%253ealert(document.cookie)%253c/script%253e
|
|
|
|
</source>
|
|
|
|
!! result
|
2018-07-16 13:23:25 +00:00
|
|
|
<p><code class="mw-highlight" dir="ltr"><script>alert("pwnd")</script> <IMG SRC=`javascript:alert("RSnake says, 'XSS'")`> <IMG SRC=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40; &#39;&#88;&#83;&#83;&#39;&#41; \";alert('XSS');// </script><script>alert('XSS');</script> %253cscript%253ealert(document.cookie)%253c/script%253e</code>
|
2015-07-03 13:42:46 +00:00
|
|
|
</p>
|
|
|
|
!! end
|
|
|
|
|
2015-06-25 04:46:42 +00:00
|
|
|
!! test
|
|
|
|
Default behaviour (inner is pre)
|
|
|
|
!!input
|
|
|
|
<source lang="javascript">
|
|
|
|
var a;
|
|
|
|
</source>
|
|
|
|
!! result
|
2017-01-29 09:35:35 +00:00
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre><span></span><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span>
|
2015-07-03 13:42:46 +00:00
|
|
|
</pre></div>
|
|
|
|
|
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Multiline <source/> in lists
|
|
|
|
!!input
|
|
|
|
* <source>a
|
|
|
|
b</source>
|
|
|
|
|
|
|
|
* foo <source>a
|
|
|
|
b</source>
|
|
|
|
!! html
|
2018-03-20 18:43:33 +00:00
|
|
|
<ul><li><div class="mw-highlight mw-content-ltr" dir="ltr"><pre>a
|
2015-07-03 13:42:46 +00:00
|
|
|
b</pre></div></li></ul>
|
2018-03-20 18:43:33 +00:00
|
|
|
<ul><li>foo <div class="mw-highlight mw-content-ltr" dir="ltr"><pre>a
|
2015-07-03 13:42:46 +00:00
|
|
|
b</pre></div></li></ul>
|
|
|
|
|
|
|
|
!! html+tidy
|
2018-03-20 18:43:33 +00:00
|
|
|
<ul><li><div class="mw-highlight mw-content-ltr" dir="ltr"><pre>a
|
2018-02-24 03:39:10 +00:00
|
|
|
b</pre></div></li></ul>
|
2018-03-20 18:43:33 +00:00
|
|
|
<ul><li>foo <div class="mw-highlight mw-content-ltr" dir="ltr"><pre>a
|
2018-02-24 03:39:10 +00:00
|
|
|
b</pre></div></li></ul>
|
2015-07-03 13:42:46 +00:00
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Custom attributes
|
|
|
|
!!input
|
|
|
|
<source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;">var a;</source>
|
|
|
|
!! result
|
2017-01-29 09:35:35 +00:00
|
|
|
<div id="foo" class="bar mw-highlight mw-content-rtl" dir="rtl" style="font-size: larger;"><pre><span></span><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span>
|
2015-06-25 04:46:42 +00:00
|
|
|
</pre></div>
|
|
|
|
|
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Inline attribute (inline code)
|
|
|
|
!!input
|
|
|
|
Text <source lang="javascript" inline>var a;</source>.
|
|
|
|
!! result
|
2015-07-03 13:42:46 +00:00
|
|
|
<p>Text <code class="mw-highlight" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
|
2015-06-25 04:46:42 +00:00
|
|
|
</p>
|
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Enclose none (inline code)
|
|
|
|
!!input
|
|
|
|
Text <source lang="javascript" enclose="none">var a;</source>.
|
|
|
|
!! result
|
2015-07-03 13:42:46 +00:00
|
|
|
<p>Text <code class="mw-highlight" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
|
2015-06-25 04:46:42 +00:00
|
|
|
</p>
|
|
|
|
!! end
|
2016-03-14 04:18:07 +00:00
|
|
|
|
|
|
|
!! test
|
|
|
|
Enclose with nowiki
|
|
|
|
!! input
|
|
|
|
{{#tag:syntaxhighlight|<nowiki>foo</nowiki>|lang="text"|inline=none}}
|
|
|
|
!! result
|
|
|
|
<p><code class="mw-highlight" dir="ltr">foo</code>
|
|
|
|
</p>
|
|
|
|
!! end
|
2018-02-22 21:19:53 +00:00
|
|
|
|
|
|
|
!! test
|
|
|
|
No code
|
|
|
|
!! input
|
|
|
|
<source lang="CSharp"></source>
|
|
|
|
!! result
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"></div>
|
|
|
|
|
|
|
|
!! end
|
|
|
|
|
|
|
|
!! test
|
|
|
|
Just whitespace
|
|
|
|
!! input
|
|
|
|
<source lang="CSharp"> </source>
|
|
|
|
!! result
|
|
|
|
<div class="mw-highlight mw-content-ltr" dir="ltr"></div>
|
|
|
|
|
|
|
|
!! end
|