views:

21

answers:

1

I am using markaby for the first time and would like to use a variable as a class id. Something along the lines of ...

mab = Markaby::Builder.new
val = 1
id_name = "this_id-#{val}"
mab.p.id_name!, "Hello world"

This, of course, yields

<p id=name>Hello world</p> 

and what I am hoping for is

<p id=this_id-1>Hello world</p>

How does one go about doing this?

+1  A: 

You could use the tag! method like this:

id_name = "this_id-#{val}"
mab.tag! :p, :id => id_name do
    "Hello World"
end
zacsek
That did it. Thank you!
Paul