FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Idea for adding D highlighting to the Trac code browser

 
Post new topic   Reply to topic     Forum Index -> Site
View previous topic :: View next topic  
Author Message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Mon Jan 09, 2006 12:45 pm    Post subject: Idea for adding D highlighting to the Trac code browser Reply with quote

Today, I noticed the dsource ticket#8: Code Browser uses D syntax highlighting. I don't think that my parser will work for this either.

According to the SilverCity documentation (which the Trac docs refer to), if a language can be lexed by Scintilla, SilverCity can be modified to highlight it: How to add syntax-highlighting to SilverCity that exists in Scintilla.

Well, the standard Scintilla doesn't have the best support for D (in particular good luck trying to get it to handle all of D's comment's properly). But Vathix has made some changes to Scintilla and called it DLex. (IIRC, DLex is used by DCode, a D-enabled SciTE, and Poseidon.) I don't know if it'd need more modifications to compile and run on Linux, but using DLex might be the easiest way to add D to SilverCity (which should allow us to use it in Trac's "Browse Source").

I haven't tried any this myself, but it seems like it might work.
Back to top
View user's profile Send private message AIM Address
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Jan 09, 2006 5:49 pm    Post subject: Reply with quote

Bring it on. That sounds like what we need, and potentially, can set it as the default code highlighter for all wiki pages, getting rid of the slower python script you wrote (slower b/c of python, not you).

BA
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Tue Jan 10, 2006 3:17 am    Post subject: Reply with quote

brad wrote:
Bring it on. That sounds like what we need, and potentially, can set it as the default code highlighter for all wiki pages, getting rid of the slower python script you wrote (slower b/c of python, not you).
Well, I just mentioned it just as an idea. I like to have syntax highlighting for D code as often as possible. Wink

I don't have Linux installed on my machine, but I guess I might be able to get Trac up-and-running on my computer and try it out that way at least. Do you know if Trac is any easier to install than it was a few months ago?
Back to top
View user's profile Send private message AIM Address
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Tue Jan 10, 2006 7:42 am    Post subject: Reply with quote

jcc7 wrote:
I guess I might be able to get Trac up-and-running on my computer and try it out that way at least. Do you know if Trac is any easier to install than it was a few months ago?

Um, it's not great, still. If you want, you can send to me and I'll work through it on my Gentoo laptop. Or you could suffer thru install, and be like Nod, who has Trac running, and is going to help a bit with plugin development...

More the merrier.

BA
Back to top
View user's profile Send private message
dan.lewis



Joined: 21 Feb 2007
Posts: 69
Location: Canada

PostPosted: Wed Mar 14, 2007 9:27 am    Post subject: Scintilla Reply with quote

Umm.. The SciTE/Scintilla support for D can be enhanced readily. I have mine properly handling it. Before I last formatted my drive, I even had it highlighting the inline assembler for me (copy and paste from asm.properties)

I think your biggest problem is that D is listed underneath the C++ file, along with C, Java and JavaScript. You'd have to rip it all out.

Best of luck, and I hope this happens. Very Happy
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Wed Mar 14, 2007 2:33 pm    Post subject: Re: Scintilla Reply with quote

Since the official version of Scintilla now supports D, this should be easier to do now.

It's probably just a matter of where this ranks on Brad's priority list and when he has a chance to work on it.

In fact, Brad has already posted that he intends to use the new Scintilla lexer.
Back to top
View user's profile Send private message AIM Address
dan.lewis



Joined: 21 Feb 2007
Posts: 69
Location: Canada

PostPosted: Thu Mar 15, 2007 10:12 am    Post subject: Reply with quote

Well, yeah... but like I said, the official Scintilla properties file is somewhat lacking for D.

It doesn't support bool or d_time types or any inline assembler. It was only recently they finally got /+ +/ comments to work.

It uses the same parser and whatnot as javascript, c, c++ and java.. that might not be a bad thing - in case we post source in one of those languages for porting.

It's just a few minor corrections, and the source is editable. You can wing it and first instinct on how to do so will probably be the right one. Smile
Back to top
View user's profile Send private message
KirkMcDonald



Joined: 22 Jun 2006
Posts: 23

PostPosted: Thu Jun 07, 2007 2:52 pm    Post subject: Pygments Reply with quote

FYI, the dsource code browser is now using Pygments for source code highlighting, for which I wrote a D lexer (and which Jarrett also added a MiniD lexer for). Enjoy!
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Jun 08, 2007 12:17 pm    Post subject: Re: Pygments Reply with quote

KirkMcDonald wrote:
FYI, the dsource code browser is now using Pygments for source code highlighting, for which I wrote a D lexer (and which Jarrett also added a MiniD lexer for). Enjoy!

Cool!

It looks pretty good, but I found a bug (not that d2html was perfect).

Apparently, it gets confused if one tries to escape a backslash in a string literal. For example, in the Escape Sequences Example, it goes haywire below the backslashReg line.
Back to top
View user's profile Send private message AIM Address
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Jun 08, 2007 2:05 pm    Post subject: Reply with quote

In case you find it helpful, I made a page listing more examples of what I believe is a bug that's related to escaped backslashes.

http://www.dsource.org/projects/tutorials/wiki/SyntaxHighlightingBugs

I can come up with a minimal test case if necessary, but I think some of the examples are already short enough to make the issue clear.

If you think the bug will be hard to fix, I probably can "code around" the issue for the examples, but I hope that it's just an easy fix.
Back to top
View user's profile Send private message AIM Address
KirkMcDonald



Joined: 22 Jun 2006
Posts: 23

PostPosted: Thu Jul 19, 2007 3:15 pm    Post subject: Reply with quote

Pygments r3772 fixes the issue, and it should be working now.
Back to top
View user's profile Send private message
jcc7



Joined: 22 Feb 2004
Posts: 657
Location: Muskogee, OK, USA

PostPosted: Fri Jul 20, 2007 9:13 am    Post subject: Reply with quote

KirkMcDonald wrote:
Pygments r3772 fixes the issue, and it should be working now.
Looks great!

Thanks for fixing it and letting me know.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Site All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group