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