如何告诉Builder不要转义值 [英] How to tell Builder to not to escape values

查看:101
本文介绍了如何告诉Builder不要转义值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ruby-1.8.7-p249 > xml = Builder::XmlMarkup.new
 => <inspect/> 
ruby-1.8.7-p249 > xml.foo '<b>wow</b>'
 => "<inspect/><foo>&lt;b&gt;wow&lt;/b&gt;</foo>" 
ruby-1.8.7-p249 > 

Builder正在转义内容并将b标签转换为转义值。我如何告诉Builder不要逃避它?我正在使用Ruby 1.8.7。

Builder is escaping the content and is converting the b tag into an escaped value. How do I tell Builder to not escape it? I am using Ruby 1.8.7.

推荐答案

Builder :: XmlMarkup#<<

xml.foo do
  xml << '<b>wow</b>'
end

这篇关于如何告诉Builder不要转义值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆