Parent

SimpleRSS

Monkey patches for outstanding issues logged in the simple-rss project.

  * Add support for issued time field:
    http://rubyforge.org/tracker/index.php?func=detail&aid=13980&group_id=893&atid=3517
  * The '+' symbol is lost when escaping fields.
    http://rubyforge.org/tracker/index.php?func=detail&aid=10852&group_id=893&atid=3517

Public Instance Methods

clean_content(tag, attrs, content) click to toggle source
    # File lib/parsers/simple-rss.rb, line 13
13:   def clean_content(tag, attrs, content)
14:     content = content.to_s
15:     case tag
16:       when :pubDate, :lastBuildDate, :published, :updated, :expirationDate, :modified, :'dc:date', :issued
17:         Time.parse(content) rescue unescape(content)
18:       when :author, :contributor, :skipHours, :skipDays
19:         unescape(content.gsub(/<.*?>/,''))
20:       else
21:         content.empty? && "#{attrs} " =~ /href=['"]?([^'"]*)['" ]/i ? $1.strip : unescape(content)
22:     end
23:   end
unescape(s) click to toggle source
    # File lib/parsers/simple-rss.rb, line 26
26:   def unescape(s)
27:    if s =~ /^\s*(<!\[CDATA\[|\]\]>)/
28:      # Raw HTML is inside the CDATA, so just remove the CDATA wrapper.
29:      s.gsub(/(<!\[CDATA\[|\]\]>)/,'')
30:    elsif s =~ /[<>]/
31:      # Already looks like HTML.
32:      s
33:    else
34:      # Make it HTML.
35:      FeedNormalizer::HtmlCleaner.unescapeHTML(s)
36:    end
37:  end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.