Module | FeedParser |
In: |
lib/feedparser/sgml-parser.rb
lib/feedparser/html2text-parser.rb lib/feedparser/feedparser.rb lib/feedparser/text-output.rb lib/feedparser/html-output.rb |
A parser for SGML, using the derived class as static DTD. from raa.ruby-lang.org/project/html-parser
# File lib/feedparser/feedparser.rb, line 241 241: def FeedParser::getcontent(e, feed = nil) 242: encoding = feed ? feed.encoding : 'utf-8' 243: children = e.children.reject do |i| 244: i.class == REXML::Text and i.to_s.chomp == '' 245: end 246: if children.length > 1 247: s = '' 248: children.each { |c| s += c.to_s } 249: return s.toUTF8(encoding).rmWhiteSpace!.text2html 250: elsif children.length == 1 251: c = children[0] 252: if c.class == REXML::Text 253: return e.text.toUTF8(encoding).rmWhiteSpace!.text2html 254: else 255: if c.class == REXML::CData 256: return c.to_s.toUTF8(encoding).rmWhiteSpace!.text2html 257: elsif c.text 258: return c.text.toUTF8(encoding).text2html 259: end 260: end 261: end 262: end