Transclusion of pages with CSS/JS/JSON/LUA content model transcludes the plain text without styling
Open, Needs TriagePublic

Description

Hi. Open some page for source edit and add "{{some js or css or json or lua page}}". It looks terrible, especially json. I believe it should be fixed or at least prevented at all until the fix. Thank you.

For example:
When transcluded:
IKhitron created this task.Sep 27 2016, 2:09 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 27 2016, 2:09 PM
matmarex renamed this task from Fix contentmodel page transclusion to Transclusion of pages with CSS/JS/JSON content model transcludes the plain text without styling.Sep 29 2016, 8:10 PM
matmarex added a subscriber: matmarex.

The Content class has a getWikitextForTransclusion() method, possibly CssContent/JavaScriptContent/JsonContent should override it with… something.

matmarex updated the task description. (Show Details)Sep 29 2016, 8:12 PM

Well, @matmarex, what do you think about (in pseudocode)

return $('<syntaxhighlight>', {lang: 'css', html: super()});

will it work?

Yes, basically, with two caveats:

  • SyntaxHighlight is an extension, so MediaWiki core would have to use <pre> and add a hook that SyntaxHighlight can use to change it to <syntaxhighlight>.
  • MediaWiki's XML-like tags are not nestable, so if the page being transcluded contained </pre> itself, the styling would stop in the middle of the page. This can probably be avoided with some clever parser abuse.
IKhitron renamed this task from Transclusion of pages with CSS/JS/JSON content model transcludes the plain text without styling to Transclusion of pages with CSS/JS/JSON/LUA content model transcludes the plain text without styling.Sep 30 2016, 12:00 PM
IKhitron updated the task description. (Show Details)

You are the boss, @matmarex. I also added the lua model.

Anomie added a subscriber: Anomie.

Parsoid would probably also need something done here, if only replacing whatever it currently does to get the wikitext for a transclusion with something that calls getWikitextForTransclusion(). And in turn that might need some change to the action API.

Parsoid would probably also need something done here, if only replacing whatever it currently does to get the wikitext for a transclusion with something that calls getWikitextForTransclusion(). And in turn that might need some change to the action API.

Parsoid calls the expandtemplates action api endpoint, so as long as that does the right thing, this should work in Parsoid.

ssastry moved this task from Backlog to Non-Parsoid Tasks on the Parsoid board.Apr 9 2017, 11:43 PM
StjnVMF triaged this task as High priority.May 18 2018, 5:18 PM
JJMC89 raised the priority of this task from High to Needs Triage.May 18 2018, 5:43 PM