Village Pump:Home/Syntax Highlighting ( archived 2009-06-18 ): Difference between revisions

→‎Groovy also not copacetic: I'll have to double-check.
(→‎Highlighting of Tcl: Improved description of what is wrong)
(→‎Groovy also not copacetic: I'll have to double-check.)
 
(14 intermediate revisions by 6 users not shown)
Line 307:
 
==Highlighting of [[Tcl]]==
===Braces aren't comments===
Is it possible to change the highlighting of Tcl so that sequences where there is an open and close brace on the same line are not highlighted as (presumably) comments? This makes expressions and one-liners much more difficult to read than they otherwise would be. For example, this is a one line <tt>if</tt>:
<lang tcl>if {[incr $a] == [list $b $c]} {puts [$d $a]} {error "$e $a"}</lang>
It's probably best for “{…}” to be not treated specially at all. (At some point we could also do with updating the list of ”keywords”, but that's nothing like as important.) —[[User:Dkf|Dkf]] 09:07, 22 May 2009 (UTC)
:Thanks for fixing this. —[[User:Dkf|Donal Fellows]] 14:34, 17 June 2009 (UTC)
:The current list of "keywords" for Tcl 8.6 (which is quite a bit longer than for previous versions) is:
===Keywords===
::'''Normal Keywords:''' append apply bgerror break catch cd class close concat constructor continue copy define deletemethod destructor else elseif eof error eval exec exit export expr fblocked fconfigure fcopy fileevent filename filter finally flush for foreach format gets glob if incr join lappend lassign lindex linsert list llength load lrange lrepeat lreplace lreverse lsearch lset lsort mixin my next objdefine object on open parray pid puts pwd read regexp regsub rename renamemethod return scan seek self set socket source split subst superclass switch tell then throw time trap try unexport unload unset uplevel vwait while
:The current list of "keywords" for Tcl 8.6 (which is quite a bit longer than for previous versions) is:
::'''Function Definition Keywords:''' create forward method new proc
::'''Normal Keywords:''' append apply bgerror break catch cd class close concat constructor continue copy define deletemethod destructor else elseif eof error eval exec exit export expr fblocked fconfigure fcopy fileevent filename filter finally flush for foreach format gets glob if incr join lappend lassign lindex linsert list llength load lrange lrepeat lreplace lreverse lsearch lset lsort mixin my next objdefine object on open parray pid puts pwd read regexp regsub rename renamemethod return scan seek self set socket source split subst superclass switch tell then throw time trap try unexport unload unset uplevel vwait while
::'''Variable Definition Keywords:''' global upvar variable
::'''Function Definition Keywords:''' create forward method new proc
::'''Compound Keywords:''' after array binary chan clock dde dict encoding file info interp namespace package prefix registry string trace update zlib
::'''Variable Definition Keywords:''' global upvar variable
:(With compound keywords, the word after the listed keyword should also be highlighted.) OK, they're not formally keywords, but they should be formatted like they are. Also, “{...}” is ''never'' an indication of a comment, and “$” followed by alphanumerics should be formatted as a variable reference. —[[User:Dkf|Donal Fellows]] 09:58, 17 June 2009 (UTC)
::'''Compound Keywords:''' after array binary chan clock dde dict encoding file info interp namespace package prefix registry string trace update zlib
:(With compound keywords, the word after the listed keyword should also be highlighted.) OK, they're not formally keywords, but they should be formatted like they are. Also, “{...}” is ''never'' an indication of a comment, and “$” followed by alphanumerics should be formatted as a variable reference. —[[User:Dkf|Donal Fellows]] 09:58, 17 June 2009 (UTC)
:The following words are linkable to <code><nowiki>http://www.tcl.tk/man/tcl8.6/TclCmd/</nowiki>''blah''<nowiki>.htm</nowiki></code>:
::proc global upvar variable after append apply array bgerror binary break catch cd chan clock close concat continue dde dict encoding eof error eval exec exit expr fblocked fconfigure fcopy file fileevent flush for foreach format gets glob if incr info interp join lappend lassign lindex linsert list llength load lrange lrepeat lreplace lreverse lsearch lset lsort my namespace next open package parray pid prefix puts pwd read regexp registry regsub rename return scan seek self set socket source split string subst switch tell throw time trace try unload unset update uplevel vwait while zlib
:Alternatively go to <code><nowiki>http://wiki.tcl.tk/</nowiki>''blah''</code> for any identified keyword and, if the page isn't there now it soon will be... ;-) —[[User:Dkf|Donal Fellows]] 14:14, 17 June 2009 (UTC)
===Variables===
A “$” followed by alphanumerics should be highlighted as a variable reference (if you highlight such things in other languages, of course). —[[User:Dkf|Donal Fellows]] 14:34, 17 June 2009 (UTC)
===Comments===
The comment regexp should (probably) be:
(?:^|[[{;])[ \t]*(#[^\n]*)
(However that is encoded in PHP, I don't know.) It doesn't handle multi-line comments but we're not really using those on RC anyway. —[[User:Dkf|Donal Fellows]] 14:34, 17 June 2009 (UTC)
 
==Java5 messed up==
Line 322 ⟶ 334:
It appears that some "span" tags got inserted in the middle of the URL for the link. --[[Special:Contributions/76.173.203.58|76.173.203.58]] 07:03, 14 June 2009 (UTC)
: Upgraded GeSHi last night. Will look to see what changed in the java5 language file. --[[User:Short Circuit|Short Circuit]] 19:34, 14 June 2009 (UTC)
:: It seems to be fixed now. Thanks. --[[Special:Contributions/76.173.203.58|76.173.203.58]] 05:37, 18 June 2009 (UTC)
 
==Smalltalk oddness==
Line 336 ⟶ 349:
<lang groovy>Binding</lang>
Just for the record, so that future generations will know what the heck we were talking about even after the bug is fixed, the above looks something like this when rendered:
<pre style="color:blue;">5.0%2Fdocs%2Fapi%2F">Binding</pre>
Maybe somebody has something against the JVM? (besides the usual, I mean) --[[User:Balrog|Balrog]] 03:29, 17 June 2009 (UTC)
: For some reason the updating of geshi seems to have messed up several languages; my current list has Java (fixed?), Smalltalk, Matlab, Groovy ... open eyes for more... --[[User:ShinTakezou|ShinTakezou]] 13:00, 17 June 2009 (UTC)
::Java isn't fixed. The tag "java" was never broken, but "java5" is the problem. Check it out:
::<lang java5>this is a test String</lang>
::Which (for future generations) renders as:
::<pre>this is a test 1.5.0/docs/api/java/lang/String.html">String</pre>
::--[[User:Mwn3d|Mwn3d]] 13:16, 17 June 2009 (UTC)
:::I hearby move that we ask [[User:Short Circuit|Short Circuit]] to back out the most recent geshi update if that's possible. Do we have a second? --[[User:Balrog|Balrog]] 21:43, 17 June 2009 (UTC)
:::Java 5 appears to be fixed. Groovy is still hosed. --[[User:Balrog|Balrog]] 00:26, 18 June 2009 (UTC)
 
::::From the moment I woke up this morning to a couple hours past when I was supposed to be at work, I've been working with the GeSHi and Tcl folks to get things fixed. I now have GeSHi SVN commit access, and I appear to have been handed some degree of responsibility to intake and process new language files, as well as finish the langfile creation wizard they started working on at my behest a couple weeks ago. I'm also planning on adding a JavaScript widget that allows the user to change the syntax highlighting CSS on the local side, so I can get better defaults for sitewide CSS. Syntax highlighting on RC is about to improve significantly.
::::I apologize for the issues we've been having lately. I'll roll back GeSHi this evening, and modify the tag extension to enable the old version of GeSHi for most users, and use GeSHi 1.0.x HEAD for anyone interested in helping test new languages and language support. (All anonymous visits would still see the old system, or at least some working intermediate revision.) The enabling of devel version of GeSHi for any given account will have to be done by someone with Bureaucrat access or higher (not a lot of these right now, but if someone wants to volunteer for the role, email me and we'll discuss it.).
::::Oh, and for the record, I hate [[wp:Robert's Rules of Order]]...They always seem to create more problems than they solve. --[[User:Short Circuit|Short Circuit]] 03:32, 18 June 2009 (UTC)
:::::Just in case I haven't said that you're amazing lately, let me just say (for future generations) that you're amazing. --[[User:Balrog|Balrog]] 03:54, 18 June 2009 (UTC) (hoping that you're okay with emoticons :-)
:::::Hmmmm... I don't know if [[User:Short Circuit|Short Circuit]] has rolled back GeSHi yet (is there a way I could check?), but Groovy still has junk in the GeSHi rendering --[[User:Balrog|Balrog]] 17:00, 18 June 2009 (UTC)
::::::I thought I had, but I may have erred. I'll have to double-check when I get home tonight.