summaryrefslogtreecommitdiffstats
path: root/lib/rss
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rss')
-rw-r--r--lib/rss/0.9.rb38
-rw-r--r--lib/rss/1.0.rb46
-rw-r--r--lib/rss/2.0.rb6
-rw-r--r--lib/rss/converter.rb26
-rw-r--r--lib/rss/dublincore.rb16
-rw-r--r--lib/rss/image.rb18
-rw-r--r--lib/rss/maker/0.9.rb28
-rw-r--r--lib/rss/maker/1.0.rb10
-rw-r--r--lib/rss/maker/2.0.rb22
-rw-r--r--lib/rss/maker/base.rb22
-rw-r--r--lib/rss/maker/dublincore.rb2
-rw-r--r--lib/rss/maker/image.rb2
-rw-r--r--lib/rss/maker/taxonomy.rb8
-rw-r--r--lib/rss/maker/trackback.rb2
-rw-r--r--lib/rss/parser.rb14
-rw-r--r--lib/rss/rexmlparser.rb10
-rw-r--r--lib/rss/rss.rb16
-rw-r--r--lib/rss/syndication.rb6
-rw-r--r--lib/rss/taxonomy.rb18
-rw-r--r--lib/rss/trackback.rb36
-rw-r--r--lib/rss/utils.rb4
-rw-r--r--lib/rss/xml-stylesheet.rb4
-rw-r--r--lib/rss/xmlparser.rb14
-rw-r--r--lib/rss/xmlscanner.rb10
24 files changed, 189 insertions, 189 deletions
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb
index 7b24e7596..37dc7af94 100644
--- a/lib/rss/0.9.rb
+++ b/lib/rss/0.9.rb
@@ -8,7 +8,7 @@ module RSS
def self.append_features(klass)
super
-
+
klass.install_must_call_validator('', "")
end
end
@@ -123,7 +123,7 @@ module RSS
def not_need_to_call_setup_maker_variables
%w(image textInput)
end
-
+
class SkipDays < Element
include RSS09
@@ -146,11 +146,11 @@ module RSS
self.content = args[0]
end
end
-
+
end
-
+
end
-
+
class SkipHours < Element
include RSS09
@@ -174,13 +174,13 @@ module RSS
end
end
end
-
+
end
-
+
class Image < Element
include RSS09
-
+
%w(url title link).each do |name|
install_text_element(name, "", nil)
end
@@ -239,9 +239,9 @@ module RSS
end
end
end
-
+
class Item < Element
-
+
include RSS09
[
@@ -269,7 +269,7 @@ module RSS
@enclosure.setup_maker(item) if @enclosure
@source.setup_maker(item) if @source
end
-
+
class Source < Element
include RSS09
@@ -279,7 +279,7 @@ module RSS
].each do |name, uri, required|
install_get_attribute(name, uri, required)
end
-
+
content_setup
def initialize(*args)
@@ -341,7 +341,7 @@ module RSS
class Category < Element
include RSS09
-
+
[
["domain", "", false]
].each do |name, uri, required|
@@ -369,11 +369,11 @@ module RSS
category.domain = domain
category.content = content
end
-
+
end
end
-
+
class TextInput < Element
include RSS09
@@ -399,9 +399,9 @@ module RSS
maker.textinput
end
end
-
+
end
-
+
end
RSS09::ELEMENTS.each do |name|
@@ -412,7 +412,7 @@ module RSS
private
def initial_start_rss(tag_name, prefix, attrs, ns)
check_ns(tag_name, prefix, ns, "")
-
+
@rss = Rss.new(attrs['version'], @version, @encoding, @standalone)
@rss.do_validate = @do_validate
@rss.xml_stylesheets = @xml_stylesheets
@@ -422,7 +422,7 @@ module RSS
end
@proc_stack.push(pr)
end
-
+
end
end
diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb
index f04e61c5e..f2f89739b 100644
--- a/lib/rss/1.0.rb
+++ b/lib/rss/1.0.rb
@@ -8,7 +8,7 @@ module RSS
def self.append_features(klass)
super
-
+
klass.install_must_call_validator('', ::RSS::URI)
end
@@ -64,13 +64,13 @@ module RSS
URI
end
end
-
+
[
["resource", [URI, ""], true]
].each do |name, uri, required|
install_get_attribute(name, uri, required)
end
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -98,10 +98,10 @@ module RSS
end
@tag_name = 'Seq'
-
+
install_have_children_element("li", URI, "*")
install_must_call_validator('rdf', ::RSS::RDF::URI)
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -114,7 +114,7 @@ module RSS
def full_name
tag_name_with_prefix(PREFIX)
end
-
+
def setup_maker(target)
lis.each do |li|
target << li.resource
@@ -135,10 +135,10 @@ module RSS
end
@tag_name = 'Bag'
-
+
install_have_children_element("li", URI, "*")
install_must_call_validator('rdf', URI)
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -151,7 +151,7 @@ module RSS
def full_name
tag_name_with_prefix(PREFIX)
end
-
+
def setup_maker(target)
lis.each do |li|
target << li.resource
@@ -162,7 +162,7 @@ module RSS
class Channel < Element
include RSS10
-
+
class << self
def required_uri
@@ -202,17 +202,17 @@ module RSS
def maker_target(maker)
maker.channel
end
-
+
def setup_maker_attributes(channel)
channel.about = about
end
class Image < Element
-
+
include RSS10
class << self
-
+
def required_uri
::RSS::URI
end
@@ -225,7 +225,7 @@ module RSS
install_get_attribute(name, uri, required, nil, nil,
"#{PREFIX}:#{name}")
end
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -237,11 +237,11 @@ module RSS
end
class Textinput < Element
-
+
include RSS10
class << self
-
+
def required_uri
::RSS::URI
end
@@ -254,7 +254,7 @@ module RSS
install_get_attribute(name, uri, required, nil, nil,
"#{PREFIX}:#{name}")
end
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -264,7 +264,7 @@ module RSS
end
end
end
-
+
class Items < Element
include RSS10
@@ -272,16 +272,16 @@ module RSS
Seq = ::RSS::RDF::Seq
class << self
-
+
def required_uri
::RSS::URI
end
-
+
end
install_have_child_element("Seq", URI, nil)
install_must_call_validator('rdf', URI)
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -309,7 +309,7 @@ module RSS
include RSS10
class << self
-
+
def required_uri
::RSS::URI
end
@@ -351,7 +351,7 @@ module RSS
def required_uri
::RSS::URI
end
-
+
end
diff --git a/lib/rss/2.0.rb b/lib/rss/2.0.rb
index 3798da4eb..9622c598d 100644
--- a/lib/rss/2.0.rb
+++ b/lib/rss/2.0.rb
@@ -29,7 +29,7 @@ module RSS
Category = Item::Category
class Item
-
+
[
["comments", "?"],
["author", "?"],
@@ -57,9 +57,9 @@ module RSS
_setup_maker_element(item)
@guid.setup_maker(item) if @guid
end
-
+
class Guid < Element
-
+
include RSS09
[
diff --git a/lib/rss/converter.rb b/lib/rss/converter.rb
index 745d6de96..3e79eba4f 100644
--- a/lib/rss/converter.rb
+++ b/lib/rss/converter.rb
@@ -3,7 +3,7 @@ require "rss/utils"
module RSS
class Converter
-
+
include Utils
def initialize(to_enc, from_enc=nil)
@@ -63,11 +63,11 @@ module RSS
raise UnknownConversionMethodError.new(to_enc, from_enc)
end
end
-
+
def def_else_enc(to_enc, from_enc)
def_iconv_convert(to_enc, from_enc, 0)
end
-
+
def def_same_enc()
def_convert do |value|
value
@@ -101,40 +101,40 @@ module RSS
def def_to_euc_jp_from_utf_8
def_uconv_convert_if_can('u8toeuc', 'EUC-JP', 'UTF-8', '-We')
end
-
+
def def_to_utf_8_from_euc_jp
def_uconv_convert_if_can('euctou8', 'UTF-8', 'EUC-JP', '-Ew')
end
-
+
def def_to_shift_jis_from_utf_8
def_uconv_convert_if_can('u8tosjis', 'Shift_JIS', 'UTF-8', '-Ws')
end
-
+
def def_to_utf_8_from_shift_jis
def_uconv_convert_if_can('sjistou8', 'UTF-8', 'Shift_JIS', '-Sw')
end
-
+
def def_to_euc_jp_from_shift_jis
require "nkf"
def_convert do |value|
"NKF.nkf('-Se', #{value})"
end
end
-
+
def def_to_shift_jis_from_euc_jp
require "nkf"
def_convert do |value|
"NKF.nkf('-Es', #{value})"
end
end
-
+
def def_to_euc_jp_from_iso_2022_jp
require "nkf"
def_convert do |value|
"NKF.nkf('-Je', #{value})"
end
end
-
+
def def_to_iso_2022_jp_from_euc_jp
require "nkf"
def_convert do |value|
@@ -147,7 +147,7 @@ module RSS
"#{value}.unpack('C*').pack('U*')"
end
end
-
+
def def_to_iso_8859_1_from_utf_8
def_convert do |value|
<<-EOC
@@ -164,7 +164,7 @@ module RSS
EOC
end
end
-
+
end
-
+
end
diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb
index 7ba239f8f..53a4ca70d 100644
--- a/lib/rss/dublincore.rb
+++ b/lib/rss/dublincore.rb
@@ -25,7 +25,7 @@ module RSS
def #{full_name}
@#{full_name}.first and @#{full_name}.first.value
end
-
+
def #{full_name}=(new_value)
@#{full_name}[0] = Utils.new_with_value_if_need(#{klass_name}, new_value)
end
@@ -50,7 +50,7 @@ module RSS
EOC
end
end
-
+
module DublinCoreModel
extend BaseModel
@@ -76,26 +76,26 @@ module RSS
DATE_ELEMENTS = {
"date" => "w3cdtf",
}
-
+
ELEMENT_NAME_INFOS = DublinCoreModel::TEXT_ELEMENTS.to_a
DublinCoreModel::DATE_ELEMENTS.each do |name, |
ELEMENT_NAME_INFOS << [name, nil]
end
-
+
ELEMENTS = TEXT_ELEMENTS.keys + DATE_ELEMENTS.keys
ELEMENTS.each do |name, plural_name|
module_eval(<<-EOC, *get_file_and_line_from_caller(0))
class DublinCore#{Utils.to_class_name(name)} < Element
include RSS10
-
+
content_setup
class << self
def required_prefix
DC_PREFIX
end
-
+
def required_uri
DC_URI
end
@@ -105,7 +105,7 @@ module RSS
alias_method(:value, :content)
alias_method(:value=, :content=)
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -114,7 +114,7 @@ module RSS
self.content = args[0]
end
end
-
+
def full_name
tag_name_with_prefix(DC_PREFIX)
end
diff --git a/lib/rss/image.rb b/lib/rss/image.rb
index c4714aea1..e79e9f5e6 100644
--- a/lib/rss/image.rb
+++ b/lib/rss/image.rb
@@ -15,7 +15,7 @@ module RSS
BaseListener.install_class_name(IMAGE_URI, name, "Image#{class_name}")
IMAGE_ELEMENTS << "#{IMAGE_PREFIX}_#{name}"
end
-
+
module ImageModelUtils
def validate_one_tag_name(ignore_unknown_element, name, tags)
if !ignore_unknown_element
@@ -25,7 +25,7 @@ module RSS
raise TooMuchTagError.new(name, tag_name) if tags.size > 1
end
end
-
+
module ImageItemModel
include ImageModelUtils
extend BaseModel
@@ -43,12 +43,12 @@ module RSS
include DublinCoreModel
@tag_name = "item"
-
+
class << self
def required_prefix
IMAGE_PREFIX
end
-
+
def required_uri
IMAGE_URI
end
@@ -102,11 +102,11 @@ module RSS
end
end
end
-
+
module ImageFaviconModel
include ImageModelUtils
extend BaseModel
-
+
def self.append_features(klass)
super
@@ -122,12 +122,12 @@ module RSS
include DublinCoreModel
@tag_name = "favicon"
-
+
class << self
def required_prefix
IMAGE_PREFIX
end
-
+
def required_uri
IMAGE_URI
end
@@ -154,7 +154,7 @@ module RSS
end
set_size(new_value)
end
-
+
alias image_size= size=
alias image_size size
diff --git a/lib/rss/maker/0.9.rb b/lib/rss/maker/0.9.rb
index cc7db8c63..ed992028c 100644
--- a/lib/rss/maker/0.9.rb
+++ b/lib/rss/maker/0.9.rb
@@ -4,14 +4,14 @@ require "rss/maker/base"
module RSS
module Maker
-
+
class RSS09 < RSSBase
-
+
def initialize(feed_version)
super
@feed_type = "rss"
end
-
+
private
def make_feed
Rss.new(@feed_version, @version, @encoding, @standalone)
@@ -38,20 +38,20 @@ module RSS
raise NotSetError.new("maker.channel", _not_set_required_variables)
end
end
-
+
private
def setup_items(rss)
@maker.items.to_feed(rss)
end
-
+
def setup_image(rss)
@maker.image.to_feed(rss)
end
-
+
def setup_textinput(rss)
@maker.textinput.to_feed(rss)
end
-
+
def variables
super + ["pubDate"]
end
@@ -78,7 +78,7 @@ module RSS
end
end
end
-
+
class Day < DayBase
def to_feed(rss, days)
day = Rss::Channel::SkipDays::Day.new
@@ -96,7 +96,7 @@ module RSS
end
end
end
-
+
class SkipHours < SkipHoursBase
def to_feed(rss, channel)
unless @hours.empty?
@@ -108,7 +108,7 @@ module RSS
end
end
end
-
+
class Hour < HourBase
def to_feed(rss, hours)
hour = Rss::Channel::SkipHours::Hour.new
@@ -126,7 +126,7 @@ module RSS
end
end
end
-
+
class Cloud < CloudBase
def to_feed(*args)
end
@@ -243,7 +243,7 @@ module RSS
true
end
end
-
+
class Items < ItemsBase
def to_feed(rss)
if rss.channel
@@ -253,7 +253,7 @@ module RSS
setup_other_elements(rss, rss.items)
end
end
-
+
class Item < ItemBase
def to_feed(rss)
item = Rss::Channel::Item.new
@@ -439,7 +439,7 @@ module RSS
end
end
end
-
+
class Textinput < TextinputBase
def to_feed(rss)
textInput = Rss::Channel::TextInput.new
diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb
index a1e2594f7..676f66291 100644
--- a/lib/rss/maker/1.0.rb
+++ b/lib/rss/maker/1.0.rb
@@ -60,7 +60,7 @@ module RSS
rss.channel.items = items
set_parent(rss.channel, items)
end
-
+
def setup_image(rss)
if @maker.image.have_required_values?
image = RDF::Channel::Image.new(@maker.image.url)
@@ -91,11 +91,11 @@ module RSS
class SkipDays < SkipDaysBase
def to_feed(*args)
end
-
+
class Day < DayBase
end
end
-
+
class SkipHours < SkipHoursBase
def to_feed(*args)
end
@@ -103,7 +103,7 @@ module RSS
class Hour < HourBase
end
end
-
+
class Cloud < CloudBase
def to_feed(*args)
end
@@ -403,7 +403,7 @@ module RSS
end
end
end
-
+
class Textinput < TextinputBase
def to_feed(rss)
if @link
diff --git a/lib/rss/maker/2.0.rb b/lib/rss/maker/2.0.rb
index 67d68126a..15b1349c2 100644
--- a/lib/rss/maker/2.0.rb
+++ b/lib/rss/maker/2.0.rb
@@ -4,9 +4,9 @@ require "rss/maker/0.9"
module RSS
module Maker
-
+
class RSS20 < RSS09
-
+
def initialize(feed_version="2.0")
super
end
@@ -17,17 +17,17 @@ module RSS
def required_variable_names
%w(link)
end
-
+
class SkipDays < RSS09::Channel::SkipDays
class Day < RSS09::Channel::SkipDays::Day
end
end
-
+
class SkipHours < RSS09::Channel::SkipHours
class Hour < RSS09::Channel::SkipHours::Hour
end
end
-
+
class Cloud < RSS09::Channel::Cloud
def to_feed(rss, channel)
cloud = Rss::Channel::Cloud.new
@@ -51,7 +51,7 @@ module RSS
category.to_feed(rss, channel)
end
end
-
+
class Category < RSS09::Channel::Categories::Category
def to_feed(rss, channel)
category = Rss::Channel::Category.new
@@ -81,14 +81,14 @@ module RSS
end
end
end
-
+
class Image < RSS09::Image
private
def required_element?
false
end
end
-
+
class Items < RSS09::Items
class Item < RSS09::Items::Item
private
@@ -179,7 +179,7 @@ module RSS
category.to_feed(rss, item)
end
end
-
+
class Category < RSS09::Items::Item::Categories::Category
def to_feed(rss, item)
category = Rss::Channel::Item::Category.new
@@ -212,11 +212,11 @@ module RSS
end
end
end
-
+
class Textinput < RSS09::Textinput
end
end
-
+
add_maker("2.0", "2.0", RSS20)
add_maker("rss2.0", "2.0", RSS20)
end
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index 3a7d255ae..615088f8f 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -395,7 +395,7 @@ module RSS
end
EOC
end
-
+
attr_reader :feed_version
alias_method(:rss_version, :feed_version)
attr_accessor :version, :encoding, :standalone
@@ -409,7 +409,7 @@ module RSS
@encoding = "UTF-8"
@standalone = nil
end
-
+
def make
yield(self)
to_feed
@@ -423,7 +423,7 @@ module RSS
feed.validate
feed
end
-
+
private
remove_method :make_xml_stylesheets
def make_xml_stylesheets
@@ -440,7 +440,7 @@ module RSS
attr_accessor attribute
add_need_initialize_variable(attribute)
end
-
+
def to_feed(feed)
xss = ::RSS::XMLStyleSheet.new
guess_type_if_need(xss)
@@ -463,7 +463,7 @@ module RSS
end
end
end
-
+
class ChannelBase < Base
include SetupDefaultDate
@@ -538,7 +538,7 @@ module RSS
end
end
end
-
+
class SkipHoursBase < Base
def_array_element("hour")
@@ -549,7 +549,7 @@ module RSS
end
end
end
-
+
class CloudBase < Base
%w(domain port path registerProcedure protocol).each do |element|
attr_accessor element
@@ -619,7 +619,7 @@ module RSS
include AtomTextConstructBase
end
end
-
+
class ImageBase < Base
%w(title url width height description).each do |element|
attr_accessor element
@@ -630,18 +630,18 @@ module RSS
@maker.channel.link
end
end
-
+
class ItemsBase < Base
def_array_element("item")
attr_accessor :do_sort, :max_size
-
+
def initialize(maker)
super
@do_sort = false
@max_size = -1
end
-
+
def normalize
if @max_size >= 0
sort_if_need[0...@max_size]
diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb
index ff4813fe1..9069c27d0 100644
--- a/lib/rss/maker/dublincore.rb
+++ b/lib/rss/maker/dublincore.rb
@@ -90,7 +90,7 @@ EOC
class ChannelBase
include DublinCoreModel
end
-
+
class ImageBase; include DublinCoreModel; end
class ItemsBase
class ItemBase
diff --git a/lib/rss/maker/image.rb b/lib/rss/maker/image.rb
index b95cf4c71..e2b36e0a0 100644
--- a/lib/rss/maker/image.rb
+++ b/lib/rss/maker/image.rb
@@ -89,7 +89,7 @@ EOC
end
class ChannelBase; include Maker::ImageFaviconModel; end
-
+
class ItemsBase
class ItemBase; include Maker::ImageItemModel; end
end
diff --git a/lib/rss/maker/taxonomy.rb b/lib/rss/maker/taxonomy.rb
index 211603840..13ae9aa80 100644
--- a/lib/rss/maker/taxonomy.rb
+++ b/lib/rss/maker/taxonomy.rb
@@ -72,12 +72,12 @@ EOC
class TaxonomyTopicBase < Base
include DublinCoreModel
include TaxonomyTopicsModel
-
+
attr_accessor :value
add_need_initialize_variable("value")
alias_method(:taxo_link, :value)
alias_method(:taxo_link=, :value=)
-
+
def have_required_values?
@value
end
@@ -88,11 +88,11 @@ EOC
class RSSBase
include TaxonomyTopicModel
end
-
+
class ChannelBase
include TaxonomyTopicsModel
end
-
+
class ItemsBase
class ItemBase
include TaxonomyTopicsModel
diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb
index 278fe53eb..00f001cb8 100644
--- a/lib/rss/maker/trackback.rb
+++ b/lib/rss/maker/trackback.rb
@@ -19,7 +19,7 @@ module RSS
class TrackBackAboutBase < Base
attr_accessor :value
add_need_initialize_variable("value")
-
+
alias_method(:resource, :value)
alias_method(:resource=, :value=)
alias_method(:content, :value)
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
index 9b28f0fa8..225e07d50 100644
--- a/lib/rss/parser.rb
+++ b/lib/rss/parser.rb
@@ -98,7 +98,7 @@ module RSS
return rss if maybe_xml?(rss)
uri = to_uri(rss)
-
+
if uri.respond_to?(:read)
uri.read
elsif !rss.tainted? and File.readable?(rss)
@@ -133,7 +133,7 @@ module RSS
listener.raise_for_undefined_entity?
end
end
-
+
def initialize(rss)
@listener = self.class.listener.new
@rss = rss
@@ -196,13 +196,13 @@ module RSS
def available_tags(uri)
(@@accessor_bases[uri] || {}).keys
end
-
+
# register uri against this name.
def register_uri(uri, name)
@@registered_uris[name] ||= {}
@@registered_uris[name][uri] = nil
end
-
+
# test if this uri is registered against this name
def uri_registered?(uri, name)
@@registered_uris[name].has_key?(uri)
@@ -228,11 +228,11 @@ module RSS
install_accessor_base(uri, name, accessor_base)
def_get_text_element(uri, name, *get_file_and_line_from_caller(1))
end
-
+
def raise_for_undefined_entity?
true
end
-
+
private
# set the accessor for the uri, tag_name pair
def install_accessor_base(uri, tag_name, accessor_base)
@@ -279,7 +279,7 @@ module RSS
@xml_element = nil
@last_xml_element = nil
end
-
+
# set instance vars for version, encoding, standalone
def xmldecl(version, encoding, standalone)
@version, @encoding, @standalone = version, encoding, standalone
diff --git a/lib/rss/rexmlparser.rb b/lib/rss/rexmlparser.rb
index 4dabf5919..7112ac366 100644
--- a/lib/rss/rexmlparser.rb
+++ b/lib/rss/rexmlparser.rb
@@ -7,7 +7,7 @@ if ([$1.to_i, $2.to_i] <=> [2, 5]) < 0
end
module RSS
-
+
class REXMLParser < BaseParser
class << self
@@ -15,7 +15,7 @@ module RSS
REXMLListener
end
end
-
+
private
def _parse
begin
@@ -28,9 +28,9 @@ module RSS
raise NotWellFormedError.new(line){e.message}
end
end
-
+
end
-
+
class REXMLListener < BaseListener
include REXML::StreamListener
@@ -41,7 +41,7 @@ module RSS
false
end
end
-
+
def xmldecl(version, encoding, standalone)
super(version, encoding, standalone == "yes")
# Encoding is converted to UTF-8 when REXML parse XML.
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 4b943ec55..d1f6181a4 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -249,7 +249,7 @@ EOC
# accessor
convert_attr_reader name
date_writer(name, type, disp_name)
-
+
install_element(name) do |n, elem_name|
<<-EOC
if @#{n}
@@ -634,7 +634,7 @@ EOC
include SetupMaker
INDENT = " "
-
+
MUST_CALL_VALIDATORS = {}
MODELS = []
GET_ATTRIBUTES = []
@@ -830,7 +830,7 @@ EOC
def full_name
tag_name
end
-
+
def converter=(converter)
@converter = converter
targets = children.dup
@@ -865,7 +865,7 @@ EOC
ensure
@do_validate = do_validate
end
-
+
def validate_for_stream(tags, ignore_unknown_element=true)
validate_attribute
__validate(ignore_unknown_element, tags, false)
@@ -985,7 +985,7 @@ EOC
end_tag = "\n#{indent}</#{full_name}>"
end
end
-
+
start_tag + content.join("\n") + end_tag
end
@@ -1010,7 +1010,7 @@ EOC
end
attrs
end
-
+
def tag_name_with_prefix(prefix)
"#{prefix}:#{tag_name}"
end
@@ -1210,7 +1210,7 @@ EOC
module RootElementMixin
include XMLStyleSheetMixin
-
+
attr_reader :output_encoding
attr_reader :feed_type, :feed_subtype, :feed_version
attr_accessor :version, :encoding, :standalone
@@ -1296,7 +1296,7 @@ EOC
rv << "?>\n"
rv
end
-
+
def ns_declarations
decls = {}
self.class::NSPOOL.collect do |prefix, uri|
diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb
index 3eb15429f..c375645dd 100644
--- a/lib/rss/syndication.rb
+++ b/lib/rss/syndication.rb
@@ -8,11 +8,11 @@ module RSS
RDF.install_ns(SY_PREFIX, SY_URI)
module SyndicationModel
-
+
extend BaseModel
-
+
ELEMENTS = []
-
+
def self.append_features(klass)
super
diff --git a/lib/rss/taxonomy.rb b/lib/rss/taxonomy.rb
index 276f63b05..b82e55dac 100644
--- a/lib/rss/taxonomy.rb
+++ b/lib/rss/taxonomy.rb
@@ -24,7 +24,7 @@ module RSS
module TaxonomyTopicsModel
extend BaseModel
-
+
def self.append_features(klass)
super
@@ -37,21 +37,21 @@ module RSS
class TaxonomyTopics < Element
include RSS10
-
+
Bag = ::RSS::RDF::Bag
class << self
def required_prefix
TAXO_PREFIX
end
-
+
def required_uri
TAXO_URI
end
end
@tag_name = "topics"
-
+
install_have_child_element("Bag", RDF::URI, nil)
install_must_call_validator('rdf', RDF::URI)
@@ -84,10 +84,10 @@ module RSS
end
end
end
-
+
module TaxonomyTopicModel
extend BaseModel
-
+
def self.append_features(klass)
super
var_name = "#{TAXO_PREFIX}_topic"
@@ -99,12 +99,12 @@ module RSS
include DublinCoreModel
include TaxonomyTopicsModel
-
+
class << self
def required_prefix
TAXO_PREFIX
end
-
+
def required_uri
TAXO_URI
end
@@ -115,7 +115,7 @@ module RSS
install_get_attribute("about", ::RSS::RDF::URI, true, nil, nil,
"#{RDF::PREFIX}:about")
install_text_element("link", TAXO_URI, "?", "#{TAXO_PREFIX}_link")
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb
index ee2491f33..59fedb5f3 100644
--- a/lib/rss/trackback.rb
+++ b/lib/rss/trackback.rb
@@ -23,7 +23,7 @@ module RSS
module BaseTrackBackModel
ELEMENTS = %w(ping about)
-
+
def append_features(klass)
super
@@ -47,7 +47,7 @@ module RSS
end
EOC
end
-
+
[%w(about s)].each do |name, postfix|
var_name = "#{TRACKBACK_PREFIX}_#{name}"
klass_name = "TrackBack#{Utils.to_class_name(name)}"
@@ -105,7 +105,7 @@ module RSS
def required_prefix
TRACKBACK_PREFIX
end
-
+
def required_uri
TRACKBACK_URI
end
@@ -141,17 +141,17 @@ module RSS
include RSS10
class << self
-
+
def required_prefix
TRACKBACK_PREFIX
end
-
+
def required_uri
TRACKBACK_URI
end
end
-
+
@tag_name = "about"
[
@@ -163,7 +163,7 @@ module RSS
alias_method(:value, :resource)
alias_method(:value=, :resource=)
-
+
def initialize(*args)
if Utils.element_initialize_arguments?(args)
super
@@ -185,7 +185,7 @@ module RSS
def setup_maker_attributes(about)
about.resource = self.resource
end
-
+
end
end
@@ -197,7 +197,7 @@ module RSS
include RSS09
@tag_name = "ping"
-
+
content_setup
class << self
@@ -205,13 +205,13 @@ module RSS
def required_prefix
TRACKBACK_PREFIX
end
-
+
def required_uri
TRACKBACK_URI
end
end
-
+
alias_method(:value, :content)
alias_method(:value=, :content=)
@@ -223,26 +223,26 @@ module RSS
self.content = args[0]
end
end
-
+
def full_name
tag_name_with_prefix(TRACKBACK_PREFIX)
end
-
+
end
class TrackBackAbout < Element
include RSS09
@tag_name = "about"
-
+
content_setup
class << self
-
+
def required_prefix
TRACKBACK_PREFIX
end
-
+
def required_uri
TRACKBACK_URI
end
@@ -260,11 +260,11 @@ module RSS
self.content = args[0]
end
end
-
+
def full_name
tag_name_with_prefix(TRACKBACK_PREFIX)
end
-
+
end
end
diff --git a/lib/rss/utils.rb b/lib/rss/utils.rb
index 0e4001e1f..75b05d45c 100644
--- a/lib/rss/utils.rb
+++ b/lib/rss/utils.rb
@@ -8,7 +8,7 @@ module RSS
"#{part[0, 1].upcase}#{part[1..-1]}"
end.join("")
end
-
+
def get_file_and_line_from_caller(i=0)
file, line, = caller[i].split(':')
line = line.to_i
@@ -21,7 +21,7 @@ module RSS
s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
end
alias h html_escape
-
+
# If +value+ is an instance of class +klass+, return it, else
# create a new instance of +klass+ with value +value+.
def new_with_value_if_need(klass, value)
diff --git a/lib/rss/xml-stylesheet.rb b/lib/rss/xml-stylesheet.rb
index 559d6bcd5..96ee95050 100644
--- a/lib/rss/xml-stylesheet.rb
+++ b/lib/rss/xml-stylesheet.rb
@@ -8,7 +8,7 @@ module RSS
super
@xml_stylesheets = []
end
-
+
private
def xml_stylesheet_pi
xsss = @xml_stylesheets.collect do |xss|
@@ -94,7 +94,7 @@ module RSS
xss.__send__("#{attr}=", __send__(attr))
end
end
-
+
private
def guess_type(filename)
/\.([^.]+)$/ =~ filename
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb
index 3dfe7d461..aa902be39 100644
--- a/lib/rss/xmlparser.rb
+++ b/lib/rss/xmlparser.rb
@@ -26,9 +26,9 @@ module XML
end
module RSS
-
+
class REXMLLikeXMLParser < ::XML::Parser
-
+
include ::XML::Encoding_ja
def listener=(listener)
@@ -38,7 +38,7 @@ module RSS
def startElement(name, attrs)
@listener.tag_start(name, attrs)
end
-
+
def endElement(name)
@listener.tag_end(name)
end
@@ -64,7 +64,7 @@ module RSS
XMLParserListener
end
end
-
+
private
def _parse
begin
@@ -75,13 +75,13 @@ module RSS
raise NotWellFormedError.new(parser.line){e.message}
end
end
-
+
end
-
+
class XMLParserListener < BaseListener
include ListenerMixin
-
+
def xmldecl(version, encoding, standalone)
super
# Encoding is converted to UTF-8 when XMLParser parses XML.
diff --git a/lib/rss/xmlscanner.rb b/lib/rss/xmlscanner.rb
index 61b9fa6bf..1cdf81c0c 100644
--- a/lib/rss/xmlscanner.rb
+++ b/lib/rss/xmlscanner.rb
@@ -2,15 +2,15 @@ require 'xmlscan/scanner'
require 'stringio'
module RSS
-
+
class XMLScanParser < BaseParser
-
+
class << self
def listener
XMLScanListener
end
end
-
+
private
def _parse
begin
@@ -26,11 +26,11 @@ module RSS
raise NotWellFormedError.new(lineno){e.message}
end
end
-
+
end
class XMLScanListener < BaseListener
-
+
include XMLScan::Visitor
include ListenerMixin