* lib/rss/image.rb: added Image prefix.
* lib/rss/maker/image.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ce4befa488
commit
ea0e7c1599
@ -1,3 +1,9 @@
|
|||||||
|
Fri Nov 25 10:38:20 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* lib/rss/image.rb: added Image prefix.
|
||||||
|
|
||||||
|
* lib/rss/maker/image.rb: ditto.
|
||||||
|
|
||||||
Fri Nov 25 10:33:02 2005 Kouhei Sutou <kou@cozmixng.org>
|
Fri Nov 25 10:33:02 2005 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* test/rss/test_2.0.rb: added RSS 2.0 tests.
|
* test/rss/test_2.0.rb: added RSS 2.0 tests.
|
||||||
|
@ -8,6 +8,14 @@ module RSS
|
|||||||
|
|
||||||
RDF.install_ns(IMAGE_PREFIX, IMAGE_URI)
|
RDF.install_ns(IMAGE_PREFIX, IMAGE_URI)
|
||||||
|
|
||||||
|
IMAGE_ELEMENTS = []
|
||||||
|
|
||||||
|
%w(item favicon).each do |name|
|
||||||
|
class_name = Utils.to_class_name(name)
|
||||||
|
BaseListener.install_class_name(IMAGE_URI, name, "Image#{class_name}")
|
||||||
|
IMAGE_ELEMENTS << "#{IMAGE_PREFIX}_#{name}"
|
||||||
|
end
|
||||||
|
|
||||||
module ImageModelUtils
|
module ImageModelUtils
|
||||||
def validate_one_tag_name(name, tags)
|
def validate_one_tag_name(name, tags)
|
||||||
invalid = tags.find {|tag| tag != name}
|
invalid = tags.find {|tag| tag != name}
|
||||||
@ -30,10 +38,12 @@ module RSS
|
|||||||
validate_one_tag_name("item", tags)
|
validate_one_tag_name("item", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
class Item < Element
|
class ImageItem < Element
|
||||||
include RSS10
|
include RSS10
|
||||||
include DublinCoreModel
|
include DublinCoreModel
|
||||||
|
|
||||||
|
@tag_name = "item"
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def required_prefix
|
def required_prefix
|
||||||
IMAGE_PREFIX
|
IMAGE_PREFIX
|
||||||
@ -144,10 +154,12 @@ module RSS
|
|||||||
validate_one_tag_name("favicon", tags)
|
validate_one_tag_name("favicon", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
class Favicon < Element
|
class ImageFavicon < Element
|
||||||
include RSS10
|
include RSS10
|
||||||
include DublinCoreModel
|
include DublinCoreModel
|
||||||
|
|
||||||
|
@tag_name = "favicon"
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def required_prefix
|
def required_prefix
|
||||||
IMAGE_PREFIX
|
IMAGE_PREFIX
|
||||||
|
@ -95,7 +95,7 @@ EOC
|
|||||||
DublinCoreModel.install_dublin_core(self)
|
DublinCoreModel.install_dublin_core(self)
|
||||||
def to_rss(rss, current)
|
def to_rss(rss, current)
|
||||||
if @about
|
if @about
|
||||||
item = ::RSS::ImageItemModel::Item.new(@about, @resource)
|
item = ::RSS::ImageItemModel::ImageItem.new(@about, @resource)
|
||||||
setup_values(item)
|
setup_values(item)
|
||||||
setup_other_elements(item)
|
setup_other_elements(item)
|
||||||
current.image_item = item
|
current.image_item = item
|
||||||
@ -111,7 +111,7 @@ EOC
|
|||||||
def to_rss(rss, current)
|
def to_rss(rss, current)
|
||||||
if @about and @image_size
|
if @about and @image_size
|
||||||
args = [@about, @image_size]
|
args = [@about, @image_size]
|
||||||
favicon = ::RSS::ImageFaviconModel::Favicon.new(*args)
|
favicon = ::RSS::ImageFaviconModel::ImageFavicon.new(*args)
|
||||||
setup_values(favicon)
|
setup_values(favicon)
|
||||||
setup_other_elements(favicon)
|
setup_other_elements(favicon)
|
||||||
current.image_favicon = favicon
|
current.image_favicon = favicon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user