mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
3 changed files with 22 additions and 4 deletions
|
@ -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>
|
||||
|
||||
* test/rss/test_2.0.rb: added RSS 2.0 tests.
|
||||
|
|
|
@ -8,6 +8,14 @@ module RSS
|
|||
|
||||
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
|
||||
def validate_one_tag_name(name, tags)
|
||||
invalid = tags.find {|tag| tag != name}
|
||||
|
@ -30,10 +38,12 @@ module RSS
|
|||
validate_one_tag_name("item", tags)
|
||||
end
|
||||
|
||||
class Item < Element
|
||||
class ImageItem < Element
|
||||
include RSS10
|
||||
include DublinCoreModel
|
||||
|
||||
@tag_name = "item"
|
||||
|
||||
class << self
|
||||
def required_prefix
|
||||
IMAGE_PREFIX
|
||||
|
@ -144,10 +154,12 @@ module RSS
|
|||
validate_one_tag_name("favicon", tags)
|
||||
end
|
||||
|
||||
class Favicon < Element
|
||||
class ImageFavicon < Element
|
||||
include RSS10
|
||||
include DublinCoreModel
|
||||
|
||||
@tag_name = "favicon"
|
||||
|
||||
class << self
|
||||
def required_prefix
|
||||
IMAGE_PREFIX
|
||||
|
|
|
@ -95,7 +95,7 @@ EOC
|
|||
DublinCoreModel.install_dublin_core(self)
|
||||
def to_rss(rss, current)
|
||||
if @about
|
||||
item = ::RSS::ImageItemModel::Item.new(@about, @resource)
|
||||
item = ::RSS::ImageItemModel::ImageItem.new(@about, @resource)
|
||||
setup_values(item)
|
||||
setup_other_elements(item)
|
||||
current.image_item = item
|
||||
|
@ -111,7 +111,7 @@ EOC
|
|||
def to_rss(rss, current)
|
||||
if @about and @image_size
|
||||
args = [@about, @image_size]
|
||||
favicon = ::RSS::ImageFaviconModel::Favicon.new(*args)
|
||||
favicon = ::RSS::ImageFaviconModel::ImageFavicon.new(*args)
|
||||
setup_values(favicon)
|
||||
setup_other_elements(favicon)
|
||||
current.image_favicon = favicon
|
||||
|
|
Loading…
Reference in a new issue