Allow showing code in an unsupported language with a warning
Closed, ResolvedPublic

Description

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.


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi

bzimport set Reference to bz10201.
Amire80 created this task.Via LegacyJun 8 2007, 6:25 PM
Amire80 added a comment.Via ConduitJun 9 2007, 7:56 AM

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.

bzimport added a comment.Via ConduitJun 13 2007, 12:12 PM

robchur wrote:

Not a viable patch, includes cross-site scripting injection vector.

brion added a comment.Via ConduitJun 13 2007, 2:53 PM

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]

bzimport added a comment.Via ConduitJun 13 2007, 6:34 PM

ayg wrote:

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.

brion added a comment.Via ConduitJun 13 2007, 7:36 PM

Nod, go ahead and try that.

Krinkle added a comment.Via ConduitJul 21 2010, 10:23 PM

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)

Amire80 added a comment.Via ConduitJul 21 2010, 10:32 PM

No, this isn't fixed. Haskell seems to be supported now, but for unsupported language only an error message is shown.

brion added a comment.Via ConduitMay 13 2011, 1:27 PM

Done on trunk in r87976

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.