User:APatro (WMF)/OutPutPage::parse

From MediaWiki.org
Jump to navigation Jump to search

Upon changing the code to use parseAsContent instead of the deprecated parse method, we noticed that external link icons are missing on the translation aid section on Translatewiki.net

Input:[edit]

<nowiki>#:</nowiki>  [https://github.com/dissemin/dissemin/blob/master/papers/static/papers/refresh.js#L96 papers/static/papers/refresh.js:96]<br />

parse[edit]

Output:

<div class="mw-parser-output"><p>#:  <a rel="nofollow" class="external text" href="https://github.com/dissemin/dissemin/blob/master/papers/static/papers/refresh.js#L96">papers/static/papers/refresh.js:96</a><br/>
</p></div>

parseAsContent[edit]

Output:

<p>#:  <a rel="nofollow" class="external text" href="https://github.com/dissemin/dissemin/blob/master/papers/static/papers/refresh.js#L96">papers/static/papers/refresh.js:96</a><br />
</p>

Output from parse is wrapped in a div tag with class mw-parser-output whereas the output from parseAsContent is not. It is already documented that,

since 1.32, due to untidy output and inconsistent wrapper; use parseAsContent() if $interface is default value or false, or else parseAsInterface() if $interface is true.

The themes (checked with Vector & Timeless) are using the selector .mw-parser-output .external to style the content which is causing the external link to not appear.

I think it is expected for the parser content to be wrapped inside a container with .mw-parser-output class.