arnaud-lb / MtHaml

Multi target HAML (HAML for PHP, Twig, <your language here>)
Other
359 stars 54 forks source link

Helpers (succeed, surround etc.) #52

Open dbulic opened 10 years ago

dbulic commented 10 years ago

I can't find a way to do equivalent of ruby's = succeed "." do %strong last words of a sentence = surround '(', ')' do %strong something inside parens

http://haml.info/docs/yardoc/Haml/Helpers.html

Is this supported?

arnaud-lb commented 10 years ago

Not yet :)

This kind of things should be the responsibility of the target language (Twig or PHP). Translating this syntax to Twig/PHP is not obvious however, as there is no anonymous functions (Twig), or no short syntax for anonymous functions.

Alternatives:

Using "<":

-# The "<" tells HAML not to output whitespaces before/after the strong tag
%strong< last words of a sentence
.

Using inline HTML:

<strong>last words of a sentence</strong>.