Last modified: 2014-05-04 19:47:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39041, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37041 - Can't highlight code containing <source> if passed as template parameter
Can't highlight code containing <source> if passed as template parameter
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-23 08:17 UTC by Danny B.
Modified: 2014-05-04 19:47 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Danny B. 2012-05-23 08:17:24 UTC
Although bug 18820 claims that now it's possible to hilight even the code containing <source>, it's not possible in every case.

Template:Code
{{#tag:syntaxhighlight|{{{code}}}|lang={{{lang}}}}}

Article:
Lorem ipsum
{{Code|lang=xml|code=
<image>
  <source isrelative="false">/absolute/path/to/image.png</source>
</image>
}}


The example above triggers error.
Comment 1 Danny B. 2012-05-23 11:53:41 UTC
Definitely not "lowest" priority as it breaks many pages already.
Comment 2 Krinkle 2012-05-23 21:03:15 UTC
By using #tag the purpose is to allow wikitext expansion. That means {{{parameters}}}, {{#parserfunctions}}, {{templates}}, but also <tags>.

If you don't want that, use <nowiki>:

{{#tag:syntaxhighlight|<nowiki>
<image>
  <source isrelative="false">/absolute/path/to/image.png</source>
</image>
</nowiki>
|lang=xml
}}

.. which works as expected.

Example: https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=541325


Invalid?
Comment 3 Platonides 2012-05-23 21:03:33 UTC
I think the solution of bug 18820 would be to use:
<syntaxhighlight lang=xml>
<image>
  <source isrelative="false">/absolute/path/to/image.png</source>
</image>
</syntaxhighlight>
Comment 4 Krinkle 2012-05-23 22:59:31 UTC
(In reply to comment #3)
> I think the solution of bug 18820 would be to use:
> <syntaxhighlight lang=xml>
> <image>
>   <source isrelative="false">/absolute/path/to/image.png</source>
> </image>
> </syntaxhighlight>

Nested tags don't work indeed (not unless the extension specifically does it, which in this case it doesn't and that's good). But the bug here is that it needs to work through a template. And the only way to pass a template value to a tag is to use {{#tag:}} because <tag> will take {{{foo}}} literally.
Comment 5 Danny B. 2012-05-24 08:51:05 UTC
(In reply to comment #2)
<nowiki> causes no hiliting, so you can't wrap the content in it.

If you'll find more effective way than 

{{Code|lang=xml|code=
<image>
  <<nowiki/>source isrelative="false">/absolute/path/to/image.png</source>
</image>
}}

how to put <source> in template parameter, I would be more than happy, thank you.
Comment 6 Bartosz Dziewoński 2014-05-04 19:47:31 UTC
I'm afraid no better way is possible, and no better way will ever be possible. It's just a limitation of wikitext syntax. :(

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links