We were asked recently when Komodo would provide syntax highlighting for http://haml.hamptoncatlin.com/, a rails markup language for showing views.
It didn't take long to whip up an extension with UDL, only it doesn't handle indent blocks, since we haven't implemented indentation-based parsing yet. Still, since all a syntax highlighter has to do is color text, but not understand it (most of the time), it works until indentation becomes significant.
This screenshot of the standard.haml test file in Komodo shows what you'll get if you install this extension:

Those yellow strings are my doing; I like to see what's going on when I write a syntax highlighter, but I don't want the scheme to be too hard on the eyes.
The attached zipfile contains two nested zip files:
haml_language-0.1.0-ko.xpi : install this into Komodo to get Haml syntax highlighting
haml.zip : contains the source code for building the xpi. See my tutorial on supporting Kid to see how to merge this source code with the Luddite build system. The instructions are in the first part.
I give this xpi a version 0.1 because indentation is significant in Haml the same way it is in Python, and we need to add that to UDL. For example, this will work in this version:
/ a comment
but this won't:
/ indentation means this is a comment but this line is data content
Anyone who figures out how to make indentation blocks work with this version of UDL, please let me know how you did it.
| Attachment | Size |
|---|---|
| haml_bundle.zip | 5.46 KB |
That's fantastic! Now, if we can get real Perl Template Toolkit syntax highlighting, that would be great :-) Right now, it treats Perl TT as HTML and while it's very common for TT users to code in HTML, TT has its own syntax and I believe it's appropriate to deal with the two separately so the TT portions of the page stand out more than the HTML (or other) portions. Generally, when I'm coding a HTML page for TT, I prototype it in HTML, then add the TT stuff later. It's that time when I would really benefit from real TT syntax highlighting.
---
KB
By default, Komodo treats *.ttkt.html files as Template Toolkit files, and
*.html files as HTML files (where the root part doesn't contain a ".").
You can use Prefs|File Assocations to indicate that you always want .html
files to be treated as Template Toolkit files.
The gain here is that you won't have to manually change file views with
the View|View As Language|... command. You'll even have the benefits
of HTML syntax-checking and auto-completion.
Hi Eric,
I installed the XPI file by using extensions manager, but syntax highlighting doesn't appear to work, even though the document type is recognised as haml. Any ideas as to where to look?
Mac
Which platform are you on, and which version of Komodo?
Can you post the first few lines?
I installed the .xpi from the community site, not my own, on Windows XP,
restarted Komodo (4.3), and it worked fine. No fiddling under the hood
needed.
Fresh install of Komodo Edit 4.3 from src on Ubuntu 7.10, and Haml doesn't highlight for me either. Same symptoms too, document type is detected as Haml, and a Haml filter is in the "open file" menu.