All I want to be able to do is to create an HTML page with a list of links and names/text associated with that text.
E.g. <a href="www.google.com">Google</a>
Where I can change Google to be any text I want (including data from a variable).
I have this:
builder = Nokogiri::HTML::Builder.new do |doc|
doc.html {
doc.body {
contents.each do |i|
doc.p {
doc.a(:href => list.first)
}
end
}
}
end
This just produces this:
<html><body><p><a href="someurl.com"></a></p></body></html>
What I want that to be though is:
<html><body><p><a href="someurl.com">First Link</a></p></body></html>
How do I do that in Nokogiri?
Thanks.
1 Answer