<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Wolfmans Howlings: A HAML edit mode for JEdit</title>
    <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>A programmers Blog about Ruby, Rails and a few other issues</description>
    <item>
      <title>A HAML edit mode for JEdit</title>
      <description>&lt;p&gt;I've just started a new RoR project and thought I'd try out
&lt;a href="http://haml.hamptoncatlin.com/"&gt;HAML&lt;/a&gt; for the views instead of rhtml.&lt;/p&gt;

&lt;p&gt;Seeing as I just switched to JEdit, I looked for a HAML language mode,
and to my surprise no one had done one yet.&lt;/p&gt;

&lt;p&gt;So here is my first attempt at a language mode for JEdit and version
1.0 of the HAML language mode. It needs more work, and I hope someone
with a better understanding of JEdit language modes will help out.&lt;/p&gt;

&lt;p&gt;This will set the indent to 2 spaces and auto-indent after a %tag that
has nothing else on the line...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;%p
  stuff
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It will not auto indent if there is more stuff on the line like in the
following example the line after &lt;code&gt;%p&lt;/code&gt; gets indented but the line
after &lt;code&gt;%label&lt;/code&gt; does not.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; %p
    %label{ :for =&amp;gt; "login" }Login
    %br/
    = f.text_field :login
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I have setup a basic syntax coloring scheme that should color &lt;code&gt;%tags&lt;/code&gt;
and &lt;code&gt;.classes&lt;/code&gt; and &lt;code&gt;#ids&lt;/code&gt; differently. It will color anything
following an &lt;code&gt;=&lt;/code&gt; or &lt;code&gt;~&lt;/code&gt; and defer the syntax highlighting to the ruby
mode for anything following them, ditto for anything inside &lt;code&gt;{ }&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Feedback and better ideas are welcome.&lt;/p&gt;

&lt;p&gt;Download from &lt;a href="http://blog.wolfman.com/files/haml.xml"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To install copy the file to ~/.jedit/modes, and edit the catalog file
in that directory and add this line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;MODE NAME="haml" FILE="haml.xml" FILE_NAME_GLOB="*.haml" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then restart jedit, and your haml files will be syntax highlighted.&lt;/p&gt;

&lt;p&gt;I like HAML but there simply is not enough example code out there
yet, so here are two simple conversions from well know rhtml files
into HAML...&lt;/p&gt;

&lt;p&gt;First the standard login form from &lt;code&gt;acts_as_authenticated&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;- form_tag sessions_path do
  %p
    %label{ :for =&amp;gt; "login"} Login
    %br/
    = text_field_tag 'login'

  %p
    %label{ :for =&amp;gt; "password" }Password
    %br/
    = password_field_tag 'password'

  %p
    %label{ :for =&amp;gt; "remember_me" }Remember me:
    = check_box_tag 'remember_me'

  %p
    = submit_tag 'Log in'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next the new user form from the same place...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;= error_messages_for :user

- form_for :user, :url =&amp;gt; users_path do |f|
  %p
    %label{ :for =&amp;gt; "login" }Login
    %br/
    = f.text_field :login
  %p
    %label{ :for =&amp;gt; "email" }Email
    %br/
    = f.text_field :email

  %p
    %label{ :for =&amp;gt; "password" }Password
    %br/
    = f.password_field :password

  %p
    %label{ :for =&amp;gt; "password_confirmation" } Confirm Password
    %br/
    = f.password_field :password_confirmation

  %p
    = submit_tag 'Sign up'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If this is dumb HAML coding please let me know how to improve it :)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://technorati.com/tag/jedit+haml" rel="tag"&gt;&lt;/a&gt;
&lt;a href="http://technorati.com/tag/jedit+rails+haml" rel="tag"&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 01 Dec 2006 18:09:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:51935488-ce66-4902-bfd7-b77acc710b0f</guid>
      <author>Jim Morris</author>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit</link>
      <category>Rails</category>
      <category>HAML</category>
      <category>JEdit</category>
      <category>rails</category>
      <category>jedit</category>
      <category>haml</category>
      <trackback:ping>http://blog.wolfman.com/articles/trackback/87</trackback:ping>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by Gabriel Medina</title>
      <description>&lt;p&gt;Hi there, I was inspired by your HAML jedit mode, and wrote a SASS mode myself,
it's here: &lt;/p&gt;

&lt;p&gt;&lt;a href="http://rha7dotcom.blogspot.com/2008_10_02_archive.html" rel="nofollow"&gt;SASS jEdit Mode for Syntax Highlighting&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this is useful for you.&lt;/p&gt;

&lt;p&gt;Gabriel Medina&lt;/p&gt;</description>
      <pubDate>Thu, 02 Oct 2008 04:39:29 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:b0e16fe1-e505-40f5-ab9e-5afd24d2d7b3</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-279</link>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by Gabriel Medina</title>
      <description>&lt;p&gt;Thanks a lot for your work.&lt;/p&gt;

&lt;p&gt;It's great. Just what I needed.&lt;/p&gt;</description>
      <pubDate>Thu, 02 Oct 2008 02:06:28 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:7076e2d3-7204-4103-ac8d-d5227248741d</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-278</link>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by wolfmanjm</title>
      <description>&lt;p&gt;Thanks I fixed the link&lt;/p&gt;</description>
      <pubDate>Wed, 11 Jul 2007 11:46:54 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:e5c96224-0ed3-4297-b36f-c82d9c1a8f32</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-88</link>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by Xarc</title>
      <description>&lt;p&gt;Sorry for repeat. i find the correct URL:
&lt;a href="http://haml.googlegroups.com/web/haml.xml" rel="nofollow"&gt;http://haml.googlegroups.com/web/haml.xml&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 11 Jul 2007 06:56:58 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:6a18077e-f85c-4487-bb2c-079a5ec50637</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-87</link>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by Xarc</title>
      <description>&lt;p&gt;haml.xml doesn't exist...
'Page not found'&lt;/p&gt;</description>
      <pubDate>Wed, 11 Jul 2007 06:51:21 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:605ff793-0b47-41e1-876e-6f1bc785d4ff</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-86</link>
    </item>
    <item>
      <title>"A HAML edit mode for JEdit" by Frederick</title>
      <description>&lt;p&gt;Hey, I've been looking for this. Thanks a lot for sparing me the pain of constructing an edit mode myself. Although I might have some energy to put into helping you improve it in the future. Seeing as I'm stuck with jEdit for some time before I earn enough money to go buy a Mac and use TextMate, I'm happy that at least now it's a bit more bearable.&lt;/p&gt;</description>
      <pubDate>Sat, 20 Jan 2007 22:00:02 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:473a2213-01c4-4d9d-a54d-0181cb73b654</guid>
      <link>http://blog.wolfman.com/articles/2006/12/01/a-haml-edit-mode-for-jedit#comment-50</link>
    </item>
  </channel>
</rss>
