Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added compact notation for dynamic attributes #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andreif
Copy link
Contributor

@andreif andreif commented Nov 14, 2012

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

- extends 'campaign/base.html'

- block main_content
  %h1 Campaigns
  %ol
    - for campaign in campaigns
      %li{class: "campaign"}
        %a{style: "color:red", href: url_to(campaign), style:'color:green'}= campaign.title
        %a{href: url_to(campaign)} Show
        %a{href: url_to(campaign, "edit")} Edit
        %a{href: 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.

@andreif
Copy link
Contributor Author

andreif commented Nov 14, 2012

You may also want to look at barbuza@ed13d8c and consequent commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant