Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 584 Bytes

succeed-precede-and-surround-in-haml.md

File metadata and controls

24 lines (16 loc) · 584 Bytes

Succeed, Precede, and Surround in Haml

Haml's design makes HTML and Ruby tricky to mix inline. But we have Haml helper methods to make it easier.

Here is succeed in action:

Developer at
  = succeed ', ' do
    = link_to "Hashrocket", "https://hashrocket.com/"

This becomes:

Developer at
<a href="https://hashrocket.com/">Hashrocket</a>,

Notice the comma at the end, outside of the a tag?

precede and surround work in a similar fashion, and do what we'd expect.

http://haml.info/docs/yardoc/file.REFERENCE.html#succeed