1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss/trackback.rb: added TrackBack prefix.

* lib/rss/maker/trackback.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2005-11-15 16:31:31 +00:00
parent 0d2c16d145
commit d3f1204ede
3 changed files with 37 additions and 13 deletions

View file

@ -1,3 +1,9 @@
Wed Nov 16 01:29:31 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/trackback.rb: added TrackBack prefix.
* lib/rss/maker/trackback.rb: ditto.
Wed Nov 16 01:26:13 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/rss.rb (RSS::VERSION): 0.1.5 -> 0.1.6.

View file

@ -41,7 +41,7 @@ module RSS
def_array_element("abouts")
def new_about
about = self.class::About.new(@maker)
about = self.class::TrackBackAbout.new(@maker)
@abouts << about
about
end
@ -52,7 +52,7 @@ module RSS
end
end
class AboutBase
class TrackBackAboutBase
include Base
attr_accessor :value
@ -79,10 +79,10 @@ module RSS
class Items
class Item
class TrackBackAbouts < TrackBackAboutsBase
class About < AboutBase
class TrackBackAbout < TrackBackAboutBase
def to_rss(rss, current)
if resource
about = ::RSS::TrackBackModel10::About.new(resource)
about = ::RSS::TrackBackModel10::TrackBackAbout.new(resource)
current.trackback_abouts << about
end
end
@ -98,7 +98,7 @@ module RSS
class TrackBackAbouts < TrackBackAboutsBase
def to_rss(*args)
end
class About < AboutBase
class TrackBackAbout < TrackBackAboutBase
end
end
end
@ -109,10 +109,10 @@ module RSS
class Items
class Item
class TrackBackAbouts < TrackBackAboutsBase
class About < AboutBase
class TrackBackAbout < TrackBackAboutBase
def to_rss(rss, current)
if content
about = ::RSS::TrackBackModel20::About.new(content)
about = ::RSS::TrackBackModel20::TrackBackAbout.new(content)
current.trackback_abouts << about
end
end

View file

@ -34,6 +34,9 @@ module RSS
end
module BaseTrackBackModel
ELEMENTS = %w(ping about)
def append_features(klass)
super
@ -42,7 +45,7 @@ module RSS
%w(ping).each do |name|
var_name = "#{TRACKBACK_PREFIX}_#{name}"
klass_name = name.capitalize
klass_name = "TrackBack#{Utils.to_class_name(name)}"
klass.install_have_child_element(var_name)
klass.module_eval(<<-EOC, __FILE__, __LINE__)
remove_method :#{var_name}
@ -59,7 +62,7 @@ module RSS
[%w(about s)].each do |name, postfix|
var_name = "#{TRACKBACK_PREFIX}_#{name}"
klass_name = name.capitalize
klass_name = "TrackBack#{Utils.to_class_name(name)}"
klass.install_have_children_element(var_name)
klass.module_eval(<<-EOC, __FILE__, __LINE__)
remove_method :#{var_name}
@ -105,7 +108,7 @@ module RSS
extend BaseModel
extend BaseTrackBackModel
class Ping < Element
class TrackBackPing < Element
include RSS10
class << self
@ -119,6 +122,8 @@ module RSS
end
end
@tag_name = "ping"
[
["resource", ::RSS::RDF::URI, true]
@ -153,7 +158,7 @@ module RSS
end
class About < Element
class TrackBackAbout < Element
include RSS10
class << self
@ -168,6 +173,8 @@ module RSS
end
@tag_name = "about"
[
["resource", ::RSS::RDF::URI, true]
].each do |name, uri, required|
@ -214,9 +221,11 @@ module RSS
extend BaseModel
extend BaseTrackBackModel
class Ping < Element
class TrackBackPing < Element
include RSS09
@tag_name = "ping"
content_setup
class << self
@ -245,9 +254,11 @@ module RSS
end
class About < Element
class TrackBackAbout < Element
include RSS09
@tag_name = "about"
content_setup
class << self
@ -287,4 +298,11 @@ module RSS
end
end
BaseTrackBackModel::ELEMENTS.each do |name|
class_name = Utils.to_class_name(name)
BaseListener.install_class_name(TRACKBACK_URI, name,
"TrackBack#{class_name}")
end
BaseTrackBackModel::ELEMENTS.collect! {|name| "#{TRACKBACK_PREFIX}_#{name}"}
end