Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put a hyperlink in the middle of a paragraph using the slim templating language?

How do you write the following in the slim templating language?

<p>Join the <a href="">Google group</a> and let us know what you think, or what other features you’d like to see.</p>

I tried the following:

p
  ' Join the
  a href="" Google Group
  ' and let us know what you think, or what other features you’d like to see

But that doesn't work because the words 'Group' and 'and' do not have whitespace between them.

like image 935
Erik Avatar asked Sep 27 '11 11:09

Erik


2 Answers

Apparently you can add extra spaces after the quote:

p
  ' Join the
  a href="" Google Group
  '  and let us know what you think, or what other features you’d like to see
like image 198
Erik Avatar answered Oct 05 '22 10:10

Erik


You can do

 p This is a paragraph with a link #{link_to 'embedded', 'http://google.com'}.

Rails tag helpers are just methods, so you can apply that logic to other methods inside views.

like image 36
whatAboutJohn Avatar answered Oct 05 '22 10:10

whatAboutJohn