Module Syndication::Content
In: lib/syndication/content.rb

Mixin for RSS 1.0 content module.

This is the approved way to include actual HTML text in an RSS feed. To use it, require ‘syndication/content’ to add the content_encoded and content_decoded methods to the Syndication::Item class.

Methods

Attributes

content_encoded  [RW]  Actual web content, entity encoded or CDATA-escaped.

Public Instance methods

Decoded version of content_encoded, as HTML.

[Source]

# File lib/syndication/content.rb, line 19
    def content_decoded
      if !@content_encoded or @content_encoded == ''
        return @content_encoded
      end
      # CDATA is the easier case
      if @content_encoded.match(/<!\[CDATA\[(.*)\]\]>/m)
        return $1
      end
      # Decode escaped entities
      x = @content_encoded.gsub(/&lt;/, '<')
      x.gsub!(/&gt;/, '>')
      return x.gsub(/&amp;/, '&')
    end

[Validate]