2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2018-11-02 13:52:33 -04:00
|
|
|
require_relative "rss"
|
2004-01-27 22:46:13 -05:00
|
|
|
|
|
|
|
module RSS
|
2013-11-09 00:56:09 -05:00
|
|
|
# The prefix for the Content XML namespace.
|
2004-10-16 00:51:15 -04:00
|
|
|
CONTENT_PREFIX = 'content'
|
2013-11-09 00:56:09 -05:00
|
|
|
# The URI of the Content specification.
|
2004-10-16 00:51:15 -04:00
|
|
|
CONTENT_URI = "http://purl.org/rss/1.0/modules/content/"
|
|
|
|
|
|
|
|
module ContentModel
|
|
|
|
extend BaseModel
|
|
|
|
|
2007-11-02 07:58:03 -04:00
|
|
|
ELEMENTS = ["#{CONTENT_PREFIX}_encoded"]
|
2004-10-16 00:51:15 -04:00
|
|
|
|
|
|
|
def self.append_features(klass)
|
|
|
|
super
|
|
|
|
|
2007-03-17 06:13:25 -04:00
|
|
|
klass.install_must_call_validator(CONTENT_PREFIX, CONTENT_URI)
|
2007-11-02 07:58:03 -04:00
|
|
|
ELEMENTS.each do |full_name|
|
|
|
|
name = full_name[(CONTENT_PREFIX.size + 1)..-1]
|
|
|
|
klass.install_text_element(name, CONTENT_URI, "?", full_name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
prefix_size = CONTENT_PREFIX.size + 1
|
2005-04-05 03:03:43 -04:00
|
|
|
ContentModel::ELEMENTS.each do |full_name|
|
|
|
|
name = full_name[prefix_size..-1]
|
2007-03-17 06:13:25 -04:00
|
|
|
BaseListener.install_get_text_element(CONTENT_URI, name, full_name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
end
|
2007-11-02 07:58:03 -04:00
|
|
|
|
|
|
|
require 'rss/content/1.0'
|
|
|
|
require 'rss/content/2.0'
|