Hi, not sure if this is the place to ask this. I have a nodeset. Before iterating through it, i've created 2 new nodes. While iterating through the nodeset, I want to assign these nodes as the child of those 2 new set. So something like
nodeset.each do | node |
group1 = Nokogiri::HTML::DocumentFragment.parse("<div class='side'></div>")
group2 = Nokogiri::HTML::DocumentFragment.parse("<div class='main'></div>")
node.children.each do | child |
if some condition
But when I puts group1 or group2, i'm seeing <div class='group1'></div><child></child> instead of <div class='group1'><child></child></div> i.e. they became sibling instead of parent-child. Any idea why? The child is of type div too....
Hello everyone. What system dependencies does nokogiri have at runtime? For example, I know it needs libxml2/libxslt to compile native extensions, but do those libraries still need to be available at runtime?
Context: I'm making a bare-bones docker image for running a rails app, and I'm scrutinizing every system dependency to determine if it's really necessary at runtime.
When doing the following:
Nokogiri::HTML.fragment("<a href='https://foo.com?a=1&b=2").to_s # => "<a href=\"https://foo.com?a=1&b=2\"></a>"
in the output, the ampersand is escaped
a[href]s in the document and altering the URLS)
Nokogiri::HTML("<a href='https://foo.com'>foo</a>").search("//a").each do |n| n.attributes["href"].value = "https://foo.com?q=a&x=y" end.to_s