2004-01-28 10:19:56 -05:00
|
|
|
require "rss/parser"
|
2004-01-27 22:46:13 -05:00
|
|
|
|
|
|
|
module RSS
|
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
module RSS10
|
|
|
|
NSPOOL = {}
|
|
|
|
ELEMENTS = []
|
2004-07-06 13:43:05 -04:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def self.append_features(klass)
|
|
|
|
super
|
|
|
|
|
|
|
|
klass.install_must_call_validator('', ::RSS::URI)
|
|
|
|
end
|
2004-07-06 13:43:05 -04:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
class RDF < Element
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
include RSS10
|
|
|
|
include RootElementMixin
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
class << self
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
def required_uri
|
|
|
|
URI
|
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
@tag_name = 'RDF'
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
PREFIX = 'rdf'
|
|
|
|
URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
install_ns('', ::RSS::URI)
|
|
|
|
install_ns(PREFIX, URI)
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
[
|
|
|
|
["channel", nil],
|
|
|
|
["image", "?"],
|
|
|
|
["item", "+"],
|
|
|
|
["textinput", "?"],
|
|
|
|
].each do |tag, occurs|
|
|
|
|
install_model(tag, occurs)
|
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(channel image textinput).each do |name|
|
|
|
|
install_have_child_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
install_have_children_element("item")
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
attr_accessor :rss_version, :version, :encoding, :standalone
|
|
|
|
|
|
|
|
def initialize(version=nil, encoding=nil, standalone=nil)
|
|
|
|
super('1.0', version, encoding, standalone)
|
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-11-19 03:25:25 -05:00
|
|
|
def full_name
|
|
|
|
tag_name_with_prefix(PREFIX)
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent, ns_declarations) do |next_indent|
|
|
|
|
[
|
|
|
|
channel_element(false, next_indent),
|
|
|
|
image_element(false, next_indent),
|
|
|
|
item_elements(false, next_indent),
|
|
|
|
textinput_element(false, next_indent),
|
|
|
|
other_element(false, next_indent),
|
|
|
|
]
|
|
|
|
end
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-11-19 03:25:25 -05:00
|
|
|
rv
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def rdf_validate(tags)
|
|
|
|
_validate(tags, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
def children
|
|
|
|
[@channel, @image, @textinput, *@item]
|
|
|
|
end
|
|
|
|
|
|
|
|
def _tags
|
|
|
|
rv = [
|
|
|
|
[::RSS::URI, "channel"],
|
|
|
|
[::RSS::URI, "image"],
|
2005-04-05 03:03:43 -04:00
|
|
|
].delete_if {|uri, name| send(name).nil?}
|
|
|
|
@item.each do |item|
|
2004-10-16 00:51:15 -04:00
|
|
|
rv << [::RSS::URI, "item"]
|
|
|
|
end
|
|
|
|
rv << [::RSS::URI, "textinput"] if @textinput
|
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
class Seq < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@tag_name = 'Seq'
|
|
|
|
|
|
|
|
install_have_children_element("li")
|
|
|
|
|
|
|
|
install_must_call_validator('rdf', ::RSS::RDF::URI)
|
|
|
|
|
|
|
|
def initialize(li=[])
|
|
|
|
super()
|
|
|
|
@li = li
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
tag(indent) do |next_indent|
|
|
|
|
[
|
2005-02-02 08:00:31 -05:00
|
|
|
li_elements(need_convert, next_indent),
|
|
|
|
other_element(need_convert, next_indent),
|
2004-11-19 03:25:25 -05:00
|
|
|
]
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-11-19 03:25:25 -05:00
|
|
|
def full_name
|
|
|
|
tag_name_with_prefix(PREFIX)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2004-10-16 00:51:15 -04:00
|
|
|
def children
|
|
|
|
@li
|
|
|
|
end
|
|
|
|
|
|
|
|
def rdf_validate(tags)
|
|
|
|
_validate(tags, [["li", '*']])
|
|
|
|
end
|
|
|
|
|
|
|
|
def _tags
|
|
|
|
rv = []
|
2005-04-05 03:03:43 -04:00
|
|
|
@li.each do |li|
|
2004-10-16 00:51:15 -04:00
|
|
|
rv << [URI, "li"]
|
|
|
|
end
|
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Li < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["resource", [URI, nil], true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(resource=nil)
|
|
|
|
super()
|
|
|
|
@resource = resource
|
|
|
|
end
|
2004-11-19 03:25:25 -05:00
|
|
|
|
|
|
|
def full_name
|
|
|
|
tag_name_with_prefix(PREFIX)
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent)
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-11-19 03:25:25 -05:00
|
|
|
rv
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _attrs
|
|
|
|
[
|
|
|
|
["resource", true]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Channel < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
[
|
2004-10-16 00:51:15 -04:00
|
|
|
["about", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(title link description).each do |name|
|
|
|
|
install_text_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(image items textinput).each do |name|
|
|
|
|
install_have_child_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
['title', nil],
|
|
|
|
['link', nil],
|
|
|
|
['description', nil],
|
|
|
|
['image', '?'],
|
|
|
|
['items', nil],
|
|
|
|
['textinput', '?'],
|
|
|
|
].each do |tag, occurs|
|
|
|
|
install_model(tag, occurs)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(about=nil)
|
|
|
|
super()
|
|
|
|
@about = about
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent) do |next_indent|
|
|
|
|
[
|
|
|
|
title_element(false, next_indent),
|
|
|
|
link_element(false, next_indent),
|
|
|
|
description_element(false, next_indent),
|
|
|
|
image_element(false, next_indent),
|
|
|
|
items_element(false, next_indent),
|
|
|
|
textinput_element(false, next_indent),
|
|
|
|
other_element(false, next_indent),
|
|
|
|
]
|
|
|
|
end
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
|
|
|
rv
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def children
|
|
|
|
[@image, @items, @textinput]
|
|
|
|
end
|
|
|
|
|
|
|
|
def _tags
|
|
|
|
[
|
|
|
|
[::RSS::URI, 'title'],
|
|
|
|
[::RSS::URI, 'link'],
|
|
|
|
[::RSS::URI, 'description'],
|
|
|
|
[::RSS::URI, 'image'],
|
|
|
|
[::RSS::URI, 'items'],
|
|
|
|
[::RSS::URI, 'textinput'],
|
2005-04-05 03:03:43 -04:00
|
|
|
].delete_if do |uri, name|
|
|
|
|
send(name).nil?
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:about", true, "about"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2004-11-27 03:47:28 -05:00
|
|
|
def maker_target(maker)
|
|
|
|
maker.channel
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup_maker_attributes(channel)
|
|
|
|
channel.about = self.about
|
|
|
|
end
|
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
class Image < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["resource", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(resource=nil)
|
|
|
|
super()
|
|
|
|
@resource = resource
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent)
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-11-19 03:25:25 -05:00
|
|
|
rv
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:resource", true, "resource"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Textinput < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["resource", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(resource=nil)
|
|
|
|
super()
|
|
|
|
@resource = resource
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent)
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-11-19 03:25:25 -05:00
|
|
|
rv
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:resource", true, "resource"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Items < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
Seq = ::RSS::RDF::Seq
|
|
|
|
class Seq
|
|
|
|
unless const_defined?(:Li)
|
|
|
|
Li = ::RSS::RDF::Li
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
install_have_child_element("Seq")
|
|
|
|
|
|
|
|
install_must_call_validator('rdf', ::RSS::RDF::URI)
|
|
|
|
|
|
|
|
def initialize(seq=Seq.new)
|
|
|
|
super()
|
|
|
|
@Seq = seq
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent) do |next_indent|
|
|
|
|
[
|
2005-02-02 08:00:31 -05:00
|
|
|
Seq_element(need_convert, next_indent),
|
|
|
|
other_element(need_convert, next_indent),
|
2004-11-19 03:25:25 -05:00
|
|
|
]
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def children
|
|
|
|
[@Seq]
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _tags
|
|
|
|
rv = []
|
|
|
|
rv << [URI, 'Seq'] unless @Seq.nil?
|
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
def rdf_validate(tags)
|
|
|
|
_validate(tags, [["Seq", nil]])
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Image < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["about", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(title url link).each do |name|
|
|
|
|
install_text_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
['title', nil],
|
|
|
|
['url', nil],
|
|
|
|
['link', nil],
|
|
|
|
].each do |tag, occurs|
|
|
|
|
install_model(tag, occurs)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(about=nil)
|
|
|
|
super()
|
|
|
|
@about = about
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent) do |next_indent|
|
|
|
|
[
|
|
|
|
title_element(false, next_indent),
|
|
|
|
url_element(false, next_indent),
|
|
|
|
link_element(false, next_indent),
|
|
|
|
other_element(false, next_indent),
|
|
|
|
]
|
|
|
|
end
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-10-16 00:51:15 -04:00
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _tags
|
|
|
|
[
|
|
|
|
[::RSS::URI, 'title'],
|
|
|
|
[::RSS::URI, 'url'],
|
|
|
|
[::RSS::URI, 'link'],
|
2005-04-05 03:03:43 -04:00
|
|
|
].delete_if do |uri, name|
|
|
|
|
send(name).nil?
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:about", true, "about"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
2004-11-27 03:47:28 -05:00
|
|
|
|
|
|
|
def maker_target(maker)
|
|
|
|
maker.image
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class Item < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["about", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(title link description).each do |name|
|
|
|
|
install_text_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["title", nil],
|
|
|
|
["link", nil],
|
|
|
|
["description", "?"],
|
|
|
|
].each do |tag, occurs|
|
|
|
|
install_model(tag, occurs)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(about=nil)
|
|
|
|
super()
|
|
|
|
@about = about
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent) do |next_indent|
|
|
|
|
[
|
|
|
|
title_element(false, next_indent),
|
|
|
|
link_element(false, next_indent),
|
|
|
|
description_element(false, next_indent),
|
|
|
|
other_element(false, next_indent),
|
|
|
|
]
|
|
|
|
end
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-10-16 00:51:15 -04:00
|
|
|
rv
|
|
|
|
end
|
2004-01-27 22:46:13 -05:00
|
|
|
|
2004-10-16 00:51:15 -04:00
|
|
|
private
|
|
|
|
def _tags
|
|
|
|
[
|
|
|
|
[::RSS::URI, 'title'],
|
|
|
|
[::RSS::URI, 'link'],
|
|
|
|
[::RSS::URI, 'description'],
|
2005-04-05 03:03:43 -04:00
|
|
|
].delete_if do |uri, name|
|
|
|
|
send(name).nil?
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:about", true, "about"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
2004-11-27 03:47:28 -05:00
|
|
|
|
|
|
|
def maker_target(maker)
|
|
|
|
maker.items.new_item
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class Textinput < Element
|
|
|
|
|
|
|
|
include RSS10
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def required_uri
|
|
|
|
::RSS::URI
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["about", URI, true]
|
|
|
|
].each do |name, uri, required|
|
|
|
|
install_get_attribute(name, uri, required)
|
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
%w(title description name link).each do |name|
|
|
|
|
install_text_element(name)
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
[
|
|
|
|
["title", nil],
|
|
|
|
["description", nil],
|
|
|
|
["name", nil],
|
|
|
|
["link", nil],
|
|
|
|
].each do |tag, occurs|
|
|
|
|
install_model(tag, occurs)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(about=nil)
|
|
|
|
super()
|
|
|
|
@about = about
|
|
|
|
end
|
|
|
|
|
2005-02-02 08:00:31 -05:00
|
|
|
def to_s(need_convert=true, indent=calc_indent)
|
2004-11-19 03:25:25 -05:00
|
|
|
rv = tag(indent) do |next_indent|
|
|
|
|
[
|
|
|
|
title_element(false, next_indent),
|
|
|
|
description_element(false, next_indent),
|
|
|
|
name_element(false, next_indent),
|
|
|
|
link_element(false, next_indent),
|
|
|
|
other_element(false, next_indent),
|
|
|
|
]
|
|
|
|
end
|
2005-02-02 08:00:31 -05:00
|
|
|
rv = convert(rv) if need_convert
|
2004-10-16 00:51:15 -04:00
|
|
|
rv
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def _tags
|
|
|
|
[
|
|
|
|
[::RSS::URI, 'title'],
|
|
|
|
[::RSS::URI, 'description'],
|
|
|
|
[::RSS::URI, 'name'],
|
|
|
|
[::RSS::URI, 'link'],
|
2005-04-05 03:03:43 -04:00
|
|
|
].delete_if do |uri, name|
|
|
|
|
send(name).nil?
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def _attrs
|
|
|
|
[
|
2004-11-19 03:25:25 -05:00
|
|
|
["#{PREFIX}:about", true, "about"]
|
2004-10-16 00:51:15 -04:00
|
|
|
]
|
|
|
|
end
|
2004-11-27 03:47:28 -05:00
|
|
|
|
|
|
|
def maker_target(maker)
|
|
|
|
maker.textinput
|
|
|
|
end
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2005-04-05 03:03:43 -04:00
|
|
|
RSS10::ELEMENTS.each do |name|
|
|
|
|
BaseListener.install_get_text_element(URI, name, "#{name}=")
|
2004-10-16 00:51:15 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
module ListenerMixin
|
|
|
|
private
|
|
|
|
def start_RDF(tag_name, prefix, attrs, ns)
|
|
|
|
check_ns(tag_name, prefix, ns, RDF::URI)
|
|
|
|
|
|
|
|
@rss = RDF.new(@version, @encoding, @standalone)
|
|
|
|
@rss.do_validate = @do_validate
|
|
|
|
@rss.xml_stylesheets = @xml_stylesheets
|
|
|
|
@last_element = @rss
|
|
|
|
@proc_stack.push Proc.new { |text, tags|
|
|
|
|
@rss.validate_for_stream(tags) if @do_validate
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2004-03-21 04:20:47 -05:00
|
|
|
|
2004-01-27 22:46:13 -05:00
|
|
|
end
|