1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
require "rss/0.9"
module RSS
class Rss
URI = "http://backend.userland.com/rss2"
install_ns('', URI)
def self.required_uri
URI
end
class Channel
def self.required_uri
URI
end
%w(generator ttl).each do |x|
install_text_element(x)
end
%w(category).each do |x|
install_have_child_element(x)
end
[
["image", "?"],
].each do |x, occurs|
install_model(x, occurs)
end
def other_element(convert, indent='')
rv = <<-EOT
#{indent}#{category_element(convert)}
#{indent}#{generator_element(convert)}
#{indent}#{ttl_element(convert)}
EOT
rv << super
end
Category = Item::Category
def Category.required_uri
URI
end
class Item
def self.required_uri
URI
end
[
["pubDate", '?'],
].each do |x, occurs|
install_date_element(x, 'rfc822')
install_model(x, occurs)
end
[
["guid", '?'],
].each do |x, occurs|
install_have_child_element(x)
install_model(x, occurs)
end
def other_element(convert, indent='')
rv = <<-EOT
#{indent}#{pubDate_element(false)}
#{indent}#{guid_element(false)}
EOT
rv << super
end
class Guid < Element
include RSS09
def self.required_uri
URI
end
[
["isPermaLink", nil, false]
].each do |name, uri, required|
install_get_attribute(name, uri, required)
end
content_setup
def initialize(isPermaLink=nil, content=nil)
super()
@isPermaLink = isPermaLink
@content = content
end
def to_s(convert=true)
if @content
rv = %Q!<guid!
rv << %Q! isPermaLink="#{h @isPermaLink}"! if @isPermaLink
rv << %Q!>#{h @content}</guid>!
rv = @converter.convert(rv) if convert and @converter
rv
else
''
end
end
private
def _attrs
[
["isPermaLink", false]
]
end
end
end
end
end
if const_defined?(:BaseListener)
RSS09::ELEMENTS.each do |x|
BaseListener.install_get_text_element(x, Rss::URI, "#{x}=")
end
end
if const_defined?(:ListenerMixin)
module ListenerMixin
private
def start_rss(tag_name, prefix, attrs, ns)
check_ns(tag_name, prefix, ns, Rss::URI)
@rss = Rss.new(attrs['version'], @version, @encoding, @standalone)
@last_element = @rss
@proc_stack.push Proc.new { |text, tags|
@rss.validate_for_stream(tags) if @do_validate
}
end
end
end
end
|