Module | FeedParser |
In: |
lib/feedparser/feedparser.rb
lib/feedparser/html2text-parser.rb lib/feedparser/html-output.rb lib/feedparser/text-output.rb lib/feedparser/sgml-parser.rb |
A parser for SGML, using the derived class as static DTD. from raa.ruby-lang.org/project/html-parser
VERSION | = | "0.5" |
# File lib/feedparser/feedparser.rb, line 276 276: def FeedParser::getcontent(e, feed = nil) 277: encoding = feed ? feed.encoding : 'utf-8' 278: children = e.children.reject do |i| 279: i.class == REXML::Text and i.to_s.chomp == '' 280: end 281: if children.length > 1 282: s = '' 283: children.each do |c| 284: s += c.to_s if c.class != REXML::Comment 285: end 286: return s.toUTF8(encoding).rmWhiteSpace!.text2html(feed) 287: elsif children.length == 1 288: c = children[0] 289: if c.class == REXML::Text 290: return e.text.toUTF8(encoding).rmWhiteSpace!.text2html(feed) 291: else 292: if c.class == REXML::CData 293: return c.to_s.toUTF8(encoding).rmWhiteSpace!.text2html(feed) 294: elsif c.text 295: return c.text.toUTF8(encoding).text2html(feed) 296: end 297: end 298: end 299: end