HTML代码清理库 Loofah
jopen
13年前
<p>Loofah 是一个 HTML 代码清理库,它可以修复被中断的HTML标签。</p> <p>示例代码:</p> <pre> doc = Loofah.fragment(unsafe_html) # returns a Nokogiri document ... doc.scrub!(:prune) # ... with one extra method doc.to_s # => "ohai! <div>div is safe</div> " doc.text # => "ohai! div is safe "</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324394707921" target="_blank">http://www.open-open.com/lib/view/home/1324394707921</a></p>