Preventing Nokogiri from escaping characters?
问题 I have created a text node and inserted into my document like so: #<Nokogiri::XML::Text:0x3fcce081481c "<%= stylesheet_link_tag 'style'%>">]> When I try to save the document with this: File.open('ng.html', 'w+'){|f| f << page.to_html} I get this in the actual document: <%= stylesheet_link_tag 'style'%> Is there a way to disable the escaping and save my page with my erb tags intact? Thanks! 回答1: You are obliged to escape some characters in text elements like: " " ' ' < < > > & & If you