Module | FeedParser |
In: |
lib/feedparser/text-output.rb
lib/feedparser/sgml-parser.rb lib/feedparser/html-output.rb lib/feedparser/feedparser.rb lib/feedparser/html2text-parser.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 272 272: def FeedParser::getcontent(e, feed = nil) 273: encoding = feed ? feed.encoding : 'utf-8' 274: children = e.children.reject do |i| 275: i.class == REXML::Text and i.to_s.chomp == '' 276: end 277: if children.length > 1 278: s = '' 279: children.each { |c| s += c.to_s } 280: return s.toUTF8(encoding).rmWhiteSpace!.text2html 281: elsif children.length == 1 282: c = children[0] 283: if c.class == REXML::Text 284: return e.text.toUTF8(encoding).rmWhiteSpace!.text2html 285: else 286: if c.class == REXML::CData 287: return c.to_s.toUTF8(encoding).rmWhiteSpace!.text2html 288: elsif c.text 289: return c.text.toUTF8(encoding).text2html 290: end 291: end 292: end 293: end