[ANN] HAML.jl - Ruby's favourite templating language comes to Julia

I just released an early version of HAML.jl - a Julia-dialect of Ruby’s HAML templating language. (The release is pending this merge request.)

Thanks to Julia’s macros and code generation features, this package compiles the templates to native code. It also preserves file&line info for easier debugging.

This is mostly a for-fun effort, but I’m hoping to eventually use if I replace StatProfilerHTML.jl’s perl backend by a pure Julia version.

Thoughts and contributions welcome!


Awesome, thanks so much! I’ve wanted this for a while - I’ll check it out, I’d love to add HAML templates support to Genie (happy to read that it compiles to native Julia, I was afraid it would use string parsing and evaling!).

1 Like

Cool! Let me know if you’d need anything from my side (API changes, …) to make that a smooth experience for you and your users.

Thank you :slight_smile: How much of the HAML spec does the package implement?

Well, it’s obviously not actually implementing the spec because it’s a Julia-flavoured dialect. That affects, for example, the syntax for attributes.

Having said that, the parts that I haven’t done yet are:

  • eating whitespace with < and >
  • allowing non-escaped interpolations
  • allowing interpolations in text content
  • multiline with |
  • helper methods

Also, as a departure from haml, I’m considering disallowing literal html unless explicitly unescaped with !. Having worked in e-commerce, I’m paranoid about XSS :slight_smile:

1 Like

Just tried to install HAML from the Git URL, and it looks like you need to add DataStructures to the Project.toml [deps] section.

Oops thanks for catching that. Fixed!