Last modified: 2013-04-08 11:02:07 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 T12201, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10201 - Allow showing code in an unsupported language with a warning
Allow showing code in an unsupported language with a warning
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SyntaxHighlight (GeSHi) (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Brion Vibber
http://www.mediawiki.org/wiki/Extensi...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-08 18:25 UTC by Amir E. Aharoni
Modified: 2013-04-08 11:02 UTC (History)
3 users (show)

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


Attachments

Description Amir E. Aharoni 2007-06-08 18:25:11 UTC
I participate in writing the Wikibook about the Haskell programming language.

GeSHi doesn't support Haskell yet, but it might in the near future (see the feature request - http://sourceforge.net/tracker/index.php?func=detail&aid=1720310&group_id=114997&atid=670234 ).

In the meantime, if i try to write <source lang="haskell">SOME CODE</source>, it is rendered as a Big Red Error that doesn't show any code. I think that it would be better to display the source in the default (black) color with a small warning saying that the language is not supported. This way, when support for that language is added, the warning will go away and the coloring will just start working.
Comment 1 Amir E. Aharoni 2007-06-09 07:56:49 UTC
I am not a PHP expert and i don't have an environment to test it, but it looks like it's really easy to change.

Just change the line

return syntaxHighlightHelp( wfMsgHtml( 'syntaxhighlight-err-language' ) );

into

return $text . syntaxHighlightHelp( wfMsgHtml( 'syntaxhighlight-err-language' ) );

And make syntaxHighlightHelp() and syntaxHighlightError() return more modest error messages.

I hope it helps.
Comment 2 Rob Church 2007-06-13 12:12:57 UTC
Not a viable patch, includes cross-site scripting injection vector.
Comment 3 Brion Vibber 2007-06-13 14:53:09 UTC
It probably wouldn't be a bad idea to go ahead and show the input (properly escaped and <pre>d of course), but I'm not sure about making the warning smaller... listing the supported languages is probably the only way to figure out wtf is going on. :)

[Though in theory that could be moved to a special help page or something and that could be linked.... shrug]
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-06-13 18:34:22 UTC
Why not pass the list of supported languages and escaped properly formatted code as $1 and $2 to the error message so this can be decided on a site-by-site basis?  I'd say the default should be to display it, yes, that's a much better failure mode, but with a list of supported languages too.
Comment 5 Brion Vibber 2007-06-13 19:36:29 UTC
Nod, go ahead and try that.
Comment 6 Krinkle 2010-07-21 22:23:16 UTC
So how about this ?

<source lang="something">
Code
</source>
still only shows an error message.

Or was something else meant (which may or may not be fixed in the mean time)
Comment 7 Amir E. Aharoni 2010-07-21 22:32:51 UTC
No, this isn't fixed. Haskell seems to be supported now, but for unsupported language only an error message is shown.
Comment 8 Brion Vibber 2011-05-13 13:27:43 UTC
Done on trunk in r87976

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


Navigation
Links