Link here This is ...">

HAML embedded links, but with content

I'm trying to print something along the lines

<p>Hello, this is my text. <a href="#">Link here</a> This is more text</p> 

but using haml

How to do it? I keep finding examples, but no one shows how to do this, but with clear text on both sides of the link?

Neil

+6
source share
2 answers

If you want to make 1 liner:

 %p= "Hello, this is my text. #{link_to 'Link here', '#'} This is more text".html_safe 

multi-line

 %p Hello, this is my text. = link_to 'Link here', '#' This is more text 
+20
source

You should just do this:

 %p Hello, this is my text. <a href="#">Link here</a> This is more text 

This will work too:

 %p Hello, this is my test. %a{:href => '#'} Link here This is more text 
+2
source

Source: https://habr.com/ru/post/917485/


All Articles