I have tried many permutations of this:
builder = Nokogiri::HTML::Builder.new do |doc|
doc.html {
doc.body {
links.each do |i|
doc.p {
doc.text "#{i.text}"
}
doc.a["href"] = i[:href]
end
}
}
end
Where links is an array that has the values needed for both test and :href.
What this produces is (abbreviated for brevity):
This is the HTML generated
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<p>10 ∙ Progamer Lim Yohwan, the E-Sports Icon</p>
<a href="http://boxerbiography.blogspot.com/2006/12/10-progamer-lim-yohwan-e-sports-icon.html"></a>
Where what I want it to produce is:
<p><a href="http://boxerbiography.blogspot.com/2006/12/10-progamer-lim-yohwan-e-sports-icon.html">10 ∙ Progamer Lim Yohwan, the E-Sports Icon</a></p>
How do I do that?
With the builder interface, attributes are supplied as arguments to the
doc.tagnamecall and the content goes inside the block. So something like this should do the trick: