有谁知道我可以如何将html转换为纯文本。那么我真的需要将RedCloth转换为纯文本,无论哪种方式都可以。Ruby:将HTML/Redcloth转换为纯文本
我不是在谈论剥离标签(这是我迄今为止所做的所有)。例如,我想一个有序列表来保留号码,无序列表使用的子弹等星号
def red_cloth_to_plain_text(s)
s = RedCloth.new(s).to_html
s = strip_tags(s)
s = html_unescape(s) # reverse of html_escape
s = undo_red_cloths_html_codes(s)
return s
end
也许我不得不尝试RedCloth以纯文本格式