a. Have // be equivalent to -#. It’s much easier to type.
b. Allow single line filters. That is, pass on the remainder of the :filtername line to the filter.
If you decide against these, I’d appreciate it if you could point me to the right place so I can make the changes locally.
Also, I got the syntax highlighting to work in emacs (on windows). The difference from the original is that my hack handles php code and allows indendation by tabs. If you are interested, let me know.
Attached the files needed for syntax highlighting in Emacs. The zip file contains php-mode.el and haml-mode.el. Copy these to your emacs/lisp/progmodes directory.
Add the line
(require 'haml-mode)
to your .emacs file (This file may need to be created).
The way to do what you want is with code interpolation - the #{<PHP code>} construct. Code interpolation isn’t supported (yet) in the class and id shortcuts, so you need to declare the class as an attribute. I will investigate to see if I can get interpolation working in the shortcuts. If I can I’ll put in the next release.
To take your example verbatim, here is the Haml code (I’ve put the text on the same line as it’s short, but can be on the next line and indented)
Chris, you might also want to include all this in the documentation. I would also suggest going through the Haml doc and at least rewriting the ones that mention Ruby. For example, how would {} attributes work, or attribute methods, Object Reference: []
Question: How do I create an empty textarea. I had to resort to plain HTML.
and so do Object references - though use the latest SVN version of HamlParser (there was an issue with class and id having a leading space in earlier versions)
%p[$object, prefix] Text
will become ($object instanceof MyObject, $object->id == 23)
%form
%textarea(rows="6" cols="80" name="body" id="body")
-# Doesn't have to be in a form to work
%textarea(rows="6" cols="80" name="body" id="body1")
-# Using .class#id and attributes works fine
%textarea.class#body2(rows="6" cols="80" name="body")
Are you the only developer of Phamlp and why did you choose the yii framework as an ‘framework implementation’ example? PhamlP being framework-independent…
I am just going to switch all my view templates to haml. Really like it. Unfortunately the html2haml script contributed by the haml ruby gem breaks some -> to ?> in many cases… but that’s ok since there aren’t man views yet to convince
Why Yii as the first framework example? Because I’ve been using Yii for a while and it’s the best framework I’ve used. There is now a CakePHP wrapper and someone is working on a Kohana wrapper (am I allowed to mention those here? ).
Glad you like it. Personally I would not go back to plain old PHP/HTML templates or CSS; for me the claims Haml and Sass make about readability and manageability are true.
This does indeed make the templates more readable.
I don’t know if this is a bug or a feature but consider it an enhancement request anyway.
When we are within a filter block (php, plain or something else), any extra indentation should not throw an exception. I keep getting errors like the following in my php and javascript filters.
Illegal indentation level (4); indentation level can only increase by one.
I’ve been tracking the Development of V3 and have implemented the new SassScript functions in my dev environment. The next step is to implement the parser for the new .scss syntax and it should be good to go. I’ll try to make some time to do this, but no promises as to when. Would you be OK to test some early code and report the bugs - of which there will be many I’m sure
Very good Work Yeti, we are planning to use this template engine for our next large web project.
There are a bunch of good php templates out there, but most of them downgrade the performance considerably, do you have any benchmark or performance numbers for this template engine? I mean: phaml vs php.
Another question in relation with this, do you support the ugly haml mode?