Add mw-content-ltr/rtl classes to inline snippets

We already add the dir=ltr/rtl HTML attribute so this
should be a no-op and makes it consistent with block
snippets.

Change-Id: I53e9204cc3bd54ba167f6f91e718a9d35b5bdfd0
This commit is contained in:
Ed Sanders 2021-01-15 17:29:46 +00:00
parent 4df77c1138
commit 2d3af74c39
2 changed files with 5 additions and 7 deletions

View file

@ -393,9 +393,7 @@ class SyntaxHighlight {
if ( $lexer !== null ) {
$classList[] = self::HIGHLIGHT_CSS_CLASS . '-lang-' . $lexer;
}
if ( !$isInline ) {
$classList[] = 'mw-content-' . $dir;
}
$classList[] = 'mw-content-' . $dir;
if ( $showLines ) {
$classList[] = self::HIGHLIGHT_CSS_CLASS . '-lines';
}

View file

@ -73,7 +73,7 @@ SRC=javascript:al&#1
%253cscript%253ealert(document.cookie)%253c/script%253e
</source>
!! html
<p><code class="mw-highlight" dir="ltr">&lt;script&gt;alert("pwnd")&lt;/script&gt; &lt;IMG SRC=`javascript:alert("RSnake says, 'XSS'")`&gt; &lt;IMG SRC=&amp;#106;&amp;#97;&amp;#118;&amp;#97;&amp;#115;&amp;#99;&amp;#114;&amp;#105;&amp;#112;&amp;#116;&amp;#58;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40; &amp;#39;&amp;#88;&amp;#83;&amp;#83;&amp;#39;&amp;#41; \";alert('XSS');// &lt;/script&gt;&lt;script&gt;alert('XSS');&lt;/script&gt; %253cscript%253ealert(document.cookie)%253c/script%253e</code>
<p><code class="mw-highlight mw-content-ltr" dir="ltr">&lt;script&gt;alert("pwnd")&lt;/script&gt; &lt;IMG SRC=`javascript:alert("RSnake says, 'XSS'")`&gt; &lt;IMG SRC=&amp;#106;&amp;#97;&amp;#118;&amp;#97;&amp;#115;&amp;#99;&amp;#114;&amp;#105;&amp;#112;&amp;#116;&amp;#58;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40; &amp;#39;&amp;#88;&amp;#83;&amp;#83;&amp;#39;&amp;#41; \";alert('XSS');// &lt;/script&gt;&lt;script&gt;alert('XSS');&lt;/script&gt; %253cscript%253ealert(document.cookie)%253c/script%253e</code>
</p>
!! end
@ -122,7 +122,7 @@ Inline attribute (inline code)
!! wikitext
Text <source lang="javascript" inline>var a;</source>.
!! html
<p>Text <code class="mw-highlight mw-highlight-lang-javascript" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
<p>Text <code class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
</p>
!! end
@ -131,7 +131,7 @@ Enclose none (inline code)
!! wikitext
Text <source lang="javascript" enclose="none">var a;</source>.
!! html
<p>Text <code class="mw-highlight mw-highlight-lang-javascript" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
<p>Text <code class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><span class="kd">var</span> <span class="nx">a</span><span class="p">;</span></code>.
</p>
!! end
@ -140,7 +140,7 @@ Enclose with nowiki
!! wikitext
{{#tag:syntaxhighlight|<nowiki>foo</nowiki>|lang="text"|inline=none}}
!! html
<p><code class="mw-highlight mw-highlight-lang-text" dir="ltr">foo</code>
<p><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" dir="ltr">foo</code>
</p>
!! end