Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
xpathが言うと
次のようなことはできますか:
doc.xpath("/html/body/a").wrap("<span></span>")
すべてのリンクをspanタグで囲みますか?
span
doc.xpath('/html/body/a').each{ |a| a.swap("<span>#{a}</span>") }
より良い解決策を見つけました(@Phrogzに従って編集)
doc.search('a').wrap('<span/>')