# \[haml\] simple question that would make my life a lot better

**URL:** <https://discuss.rubyonrails.org/t/haml-simple-question-that-would-make-my-life-a-lot-better/60631>\
**Category:** rubyonrails-talk\
**Created:** [August 29, 2011, 4:02pm UTC](https://discuss.rubyonrails.org/t/haml-simple-question-that-would-make-my-life-a-lot-better/60631 "2011-08-29T16:02:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Commander\_Johnson](https://avatars.discourse-cdn.com/v4/letter/c/4bbf92/32.png) [@Commander\_Johnson](https://discuss.rubyonrails.org/u/Commander_Johnson)\
**Post date:** [August 29, 2011, 4:02pm UTC](https://discuss.rubyonrails.org/t/haml-simple-question-that-would-make-my-life-a-lot-better/60631/1 "2011-08-29T16:02:20Z")

</div>

Hello,

In HAML, is it possible to get this result:

- link\_to “[http://www.example.com](http://www.example.com)” do

- “www”

- “example”

- “com”

=\> “wwwexamplecom”

So far I’ve only managed to get:

=\> “com”

Which is logical because of the way Ruby blocks work. But, it defeats the HAML purpose of concatenating the things you put underneath each other.

CmdJohnson

---

<div class="post-metadata">

**Author:** ![Jeffrey](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jeffrey](https://discuss.rubyonrails.org/u/Jeffrey)\
**Post date:** [August 29, 2011, 4:12pm UTC](https://discuss.rubyonrails.org/t/haml-simple-question-that-would-make-my-life-a-lot-better/60631/2 "2011-08-29T16:12:49Z")

</div>

Quoting Commander Johnson \<commanderjohnson@gmail.com\>:

> Hello,
> 
> In HAML, is it possible to get this result:
> 
> - link\_to "[http://www.example.com](http://www.example.com)" do - "www" - "example" - "com"

What about: - link\_to "[http://www.example.com](http://www.example.com)" do &nbsp;&nbsp;- ["www", "example", "com"]

Jeffrey

---

<div class="post-metadata">

**Author:** ![Jim\_Ruther\_Nill](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@Jim\_Ruther\_Nill](https://discuss.rubyonrails.org/u/Jim_Ruther_Nill)\
**Post date:** [August 29, 2011, 4:17pm UTC](https://discuss.rubyonrails.org/t/haml-simple-question-that-would-make-my-life-a-lot-better/60631/3 "2011-08-29T16:17:39Z")

</div>

> Hello,

> In HAML, is it possible to get this result:

> 

> - link\_to “[http://www.example.com](http://www.example.com)” do

> - “www”

> - “example”

> - “com”

> 

> =\> “wwwexamplecom”

this is because you use -, use =. but that would leave a space in between the words. you might want to wrap

each word in a span and remove the whitespace

= link\_to url do

%span\>= ‘www’

%span\>= ‘example’

%span\>= ‘com’
