jessemiller/HamlPy — pull request #109 by andreif (2012-11-14 09:25:05+00:00)
Title: added compact notation for dynamic attributes

In case you are using Jinja2 with HamlPy, you may be interested in more compact expressions for dynamic attributes, for example

```haml
- extends 'campaign/base.html'

- block main_content
%h1 Campaigns
%ol
- for campaign in campaigns
%li{class: "campaign"}
%a{style: "color:red", href: h.url_to(campaign), style:'color:green'}= campaign.title
%a{href: h.url_to(campaign)} Show
%a{href: h.url_to(campaign, "edit")} Edit
%a{href: h.url_to(campaign, "delete")} Delete

.well
%a{href: url('campaign.new')} New
```

The proposed commit allows successful compiling of such code, however, it is currently posted more for the sake of discussion than pulling to master. Please, let me know what you think.

P.S. It needs an extra requirement, the well-known codegen by Armin from 2008, which I have just submitted to pypi to simplify its usage (it is under BSD). I don't intend to change it in the future, since the original code seems working perfectly for our case. There is a new package called astor which also provides codegen, but I was not confident in it.