rubysl-rss 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -6
- data/lib/rss/0.9.rb +20 -20
- data/lib/rss/1.0.rb +24 -24
- data/lib/rss/2.0.rb +3 -3
- data/lib/rss/atom.rb +94 -4
- data/lib/rss/content/1.0.rb +0 -1
- data/lib/rss/content/2.0.rb +0 -1
- data/lib/rss/converter.rb +22 -14
- data/lib/rss/dublincore.rb +8 -8
- data/lib/rss/dublincore/1.0.rb +0 -1
- data/lib/rss/dublincore/2.0.rb +0 -1
- data/lib/rss/dublincore/atom.rb +0 -1
- data/lib/rss/image.rb +9 -9
- data/lib/rss/maker.rb +40 -6
- data/lib/rss/maker/0.9.rb +64 -23
- data/lib/rss/maker/1.0.rb +7 -6
- data/lib/rss/maker/2.0.rb +11 -11
- data/lib/rss/maker/base.rb +118 -42
- data/lib/rss/maker/dublincore.rb +1 -4
- data/lib/rss/maker/entry.rb +3 -3
- data/lib/rss/maker/feed.rb +3 -6
- data/lib/rss/maker/image.rb +3 -3
- data/lib/rss/maker/itunes.rb +1 -1
- data/lib/rss/maker/taxonomy.rb +4 -4
- data/lib/rss/maker/trackback.rb +1 -1
- data/lib/rss/parser.rb +54 -27
- data/lib/rss/rexmlparser.rb +5 -5
- data/lib/rss/rss.rb +54 -24
- data/lib/rss/syndication.rb +3 -3
- data/lib/rss/taxonomy.rb +9 -9
- data/lib/rss/trackback.rb +18 -18
- data/lib/rss/utils.rb +2 -2
- data/lib/rss/xml-stylesheet.rb +2 -2
- data/lib/rss/xmlparser.rb +7 -7
- data/lib/rss/xmlscanner.rb +5 -5
- data/lib/rubysl/rss/rss.rb +76 -4
- data/lib/rubysl/rss/version.rb +1 -1
- data/rubysl-rss.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1177001fe685f528a4bb3c920c180183fa69218
|
4
|
+
data.tar.gz: c26da1c990ff1f6a7115aac7ce35c074cda59db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7230587633c13aeaaf65a48b3420ff895753c9cda4241423c67673f39cbde43440168d7800066ca363cc367f4b285fe28e37c1db813756813b53139eb66e5a75
|
7
|
+
data.tar.gz: 38bca62ee7703a7c9b3b9ecbde53ce5c480acb54bc620dd5f118264c0cb0a70dca1166206fe3762d6d22d3d4bdb94f643390b8d8247b6e131fce4f7580d34997
|
data/.travis.yml
CHANGED
data/lib/rss/0.9.rb
CHANGED
@@ -8,7 +8,7 @@ module RSS
|
|
8
8
|
|
9
9
|
def self.append_features(klass)
|
10
10
|
super
|
11
|
-
|
11
|
+
|
12
12
|
klass.install_must_call_validator('', "")
|
13
13
|
end
|
14
14
|
end
|
@@ -123,7 +123,7 @@ module RSS
|
|
123
123
|
def not_need_to_call_setup_maker_variables
|
124
124
|
%w(image textInput)
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
class SkipDays < Element
|
128
128
|
include RSS09
|
129
129
|
|
@@ -146,11 +146,11 @@ module RSS
|
|
146
146
|
self.content = args[0]
|
147
147
|
end
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
class SkipHours < Element
|
155
155
|
include RSS09
|
156
156
|
|
@@ -174,13 +174,13 @@ module RSS
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
end
|
179
|
-
|
179
|
+
|
180
180
|
class Image < Element
|
181
181
|
|
182
182
|
include RSS09
|
183
|
-
|
183
|
+
|
184
184
|
%w(url title link).each do |name|
|
185
185
|
install_text_element(name, "", nil)
|
186
186
|
end
|
@@ -239,9 +239,9 @@ module RSS
|
|
239
239
|
end
|
240
240
|
end
|
241
241
|
end
|
242
|
-
|
242
|
+
|
243
243
|
class Item < Element
|
244
|
-
|
244
|
+
|
245
245
|
include RSS09
|
246
246
|
|
247
247
|
[
|
@@ -269,7 +269,7 @@ module RSS
|
|
269
269
|
@enclosure.setup_maker(item) if @enclosure
|
270
270
|
@source.setup_maker(item) if @source
|
271
271
|
end
|
272
|
-
|
272
|
+
|
273
273
|
class Source < Element
|
274
274
|
|
275
275
|
include RSS09
|
@@ -279,7 +279,7 @@ module RSS
|
|
279
279
|
].each do |name, uri, required|
|
280
280
|
install_get_attribute(name, uri, required)
|
281
281
|
end
|
282
|
-
|
282
|
+
|
283
283
|
content_setup
|
284
284
|
|
285
285
|
def initialize(*args)
|
@@ -341,7 +341,7 @@ module RSS
|
|
341
341
|
class Category < Element
|
342
342
|
|
343
343
|
include RSS09
|
344
|
-
|
344
|
+
|
345
345
|
[
|
346
346
|
["domain", "", false]
|
347
347
|
].each do |name, uri, required|
|
@@ -369,11 +369,11 @@ module RSS
|
|
369
369
|
category.domain = domain
|
370
370
|
category.content = content
|
371
371
|
end
|
372
|
-
|
372
|
+
|
373
373
|
end
|
374
374
|
|
375
375
|
end
|
376
|
-
|
376
|
+
|
377
377
|
class TextInput < Element
|
378
378
|
|
379
379
|
include RSS09
|
@@ -399,9 +399,9 @@ module RSS
|
|
399
399
|
maker.textinput
|
400
400
|
end
|
401
401
|
end
|
402
|
-
|
402
|
+
|
403
403
|
end
|
404
|
-
|
404
|
+
|
405
405
|
end
|
406
406
|
|
407
407
|
RSS09::ELEMENTS.each do |name|
|
@@ -411,8 +411,8 @@ module RSS
|
|
411
411
|
module ListenerMixin
|
412
412
|
private
|
413
413
|
def initial_start_rss(tag_name, prefix, attrs, ns)
|
414
|
-
check_ns(tag_name, prefix, ns, "")
|
415
|
-
|
414
|
+
check_ns(tag_name, prefix, ns, "", false)
|
415
|
+
|
416
416
|
@rss = Rss.new(attrs['version'], @version, @encoding, @standalone)
|
417
417
|
@rss.do_validate = @do_validate
|
418
418
|
@rss.xml_stylesheets = @xml_stylesheets
|
@@ -422,7 +422,7 @@ module RSS
|
|
422
422
|
end
|
423
423
|
@proc_stack.push(pr)
|
424
424
|
end
|
425
|
-
|
425
|
+
|
426
426
|
end
|
427
427
|
|
428
428
|
end
|
data/lib/rss/1.0.rb
CHANGED
@@ -8,7 +8,7 @@ module RSS
|
|
8
8
|
|
9
9
|
def self.append_features(klass)
|
10
10
|
super
|
11
|
-
|
11
|
+
|
12
12
|
klass.install_must_call_validator('', ::RSS::URI)
|
13
13
|
end
|
14
14
|
|
@@ -64,13 +64,13 @@ module RSS
|
|
64
64
|
URI
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
[
|
69
69
|
["resource", [URI, ""], true]
|
70
70
|
].each do |name, uri, required|
|
71
71
|
install_get_attribute(name, uri, required)
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def initialize(*args)
|
75
75
|
if Utils.element_initialize_arguments?(args)
|
76
76
|
super
|
@@ -98,10 +98,10 @@ module RSS
|
|
98
98
|
end
|
99
99
|
|
100
100
|
@tag_name = 'Seq'
|
101
|
-
|
101
|
+
|
102
102
|
install_have_children_element("li", URI, "*")
|
103
103
|
install_must_call_validator('rdf', ::RSS::RDF::URI)
|
104
|
-
|
104
|
+
|
105
105
|
def initialize(*args)
|
106
106
|
if Utils.element_initialize_arguments?(args)
|
107
107
|
super
|
@@ -114,7 +114,7 @@ module RSS
|
|
114
114
|
def full_name
|
115
115
|
tag_name_with_prefix(PREFIX)
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
def setup_maker(target)
|
119
119
|
lis.each do |li|
|
120
120
|
target << li.resource
|
@@ -135,10 +135,10 @@ module RSS
|
|
135
135
|
end
|
136
136
|
|
137
137
|
@tag_name = 'Bag'
|
138
|
-
|
138
|
+
|
139
139
|
install_have_children_element("li", URI, "*")
|
140
140
|
install_must_call_validator('rdf', URI)
|
141
|
-
|
141
|
+
|
142
142
|
def initialize(*args)
|
143
143
|
if Utils.element_initialize_arguments?(args)
|
144
144
|
super
|
@@ -151,7 +151,7 @@ module RSS
|
|
151
151
|
def full_name
|
152
152
|
tag_name_with_prefix(PREFIX)
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
def setup_maker(target)
|
156
156
|
lis.each do |li|
|
157
157
|
target << li.resource
|
@@ -162,7 +162,7 @@ module RSS
|
|
162
162
|
class Channel < Element
|
163
163
|
|
164
164
|
include RSS10
|
165
|
-
|
165
|
+
|
166
166
|
class << self
|
167
167
|
|
168
168
|
def required_uri
|
@@ -202,17 +202,17 @@ module RSS
|
|
202
202
|
def maker_target(maker)
|
203
203
|
maker.channel
|
204
204
|
end
|
205
|
-
|
205
|
+
|
206
206
|
def setup_maker_attributes(channel)
|
207
207
|
channel.about = about
|
208
208
|
end
|
209
209
|
|
210
210
|
class Image < Element
|
211
|
-
|
211
|
+
|
212
212
|
include RSS10
|
213
213
|
|
214
214
|
class << self
|
215
|
-
|
215
|
+
|
216
216
|
def required_uri
|
217
217
|
::RSS::URI
|
218
218
|
end
|
@@ -225,7 +225,7 @@ module RSS
|
|
225
225
|
install_get_attribute(name, uri, required, nil, nil,
|
226
226
|
"#{PREFIX}:#{name}")
|
227
227
|
end
|
228
|
-
|
228
|
+
|
229
229
|
def initialize(*args)
|
230
230
|
if Utils.element_initialize_arguments?(args)
|
231
231
|
super
|
@@ -237,11 +237,11 @@ module RSS
|
|
237
237
|
end
|
238
238
|
|
239
239
|
class Textinput < Element
|
240
|
-
|
240
|
+
|
241
241
|
include RSS10
|
242
242
|
|
243
243
|
class << self
|
244
|
-
|
244
|
+
|
245
245
|
def required_uri
|
246
246
|
::RSS::URI
|
247
247
|
end
|
@@ -254,7 +254,7 @@ module RSS
|
|
254
254
|
install_get_attribute(name, uri, required, nil, nil,
|
255
255
|
"#{PREFIX}:#{name}")
|
256
256
|
end
|
257
|
-
|
257
|
+
|
258
258
|
def initialize(*args)
|
259
259
|
if Utils.element_initialize_arguments?(args)
|
260
260
|
super
|
@@ -264,7 +264,7 @@ module RSS
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
end
|
267
|
-
|
267
|
+
|
268
268
|
class Items < Element
|
269
269
|
|
270
270
|
include RSS10
|
@@ -272,16 +272,16 @@ module RSS
|
|
272
272
|
Seq = ::RSS::RDF::Seq
|
273
273
|
|
274
274
|
class << self
|
275
|
-
|
275
|
+
|
276
276
|
def required_uri
|
277
277
|
::RSS::URI
|
278
278
|
end
|
279
|
-
|
279
|
+
|
280
280
|
end
|
281
281
|
|
282
282
|
install_have_child_element("Seq", URI, nil)
|
283
283
|
install_must_call_validator('rdf', URI)
|
284
|
-
|
284
|
+
|
285
285
|
def initialize(*args)
|
286
286
|
if Utils.element_initialize_arguments?(args)
|
287
287
|
super
|
@@ -309,7 +309,7 @@ module RSS
|
|
309
309
|
include RSS10
|
310
310
|
|
311
311
|
class << self
|
312
|
-
|
312
|
+
|
313
313
|
def required_uri
|
314
314
|
::RSS::URI
|
315
315
|
end
|
@@ -351,7 +351,7 @@ module RSS
|
|
351
351
|
def required_uri
|
352
352
|
::RSS::URI
|
353
353
|
end
|
354
|
-
|
354
|
+
|
355
355
|
end
|
356
356
|
|
357
357
|
|
@@ -436,7 +436,7 @@ module RSS
|
|
436
436
|
module ListenerMixin
|
437
437
|
private
|
438
438
|
def initial_start_RDF(tag_name, prefix, attrs, ns)
|
439
|
-
check_ns(tag_name, prefix, ns, RDF::URI)
|
439
|
+
check_ns(tag_name, prefix, ns, RDF::URI, false)
|
440
440
|
|
441
441
|
@rss = RDF.new(@version, @encoding, @standalone)
|
442
442
|
@rss.do_validate = @do_validate
|
data/lib/rss/2.0.rb
CHANGED
@@ -29,7 +29,7 @@ module RSS
|
|
29
29
|
Category = Item::Category
|
30
30
|
|
31
31
|
class Item
|
32
|
-
|
32
|
+
|
33
33
|
[
|
34
34
|
["comments", "?"],
|
35
35
|
["author", "?"],
|
@@ -57,9 +57,9 @@ module RSS
|
|
57
57
|
_setup_maker_element(item)
|
58
58
|
@guid.setup_maker(item) if @guid
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
class Guid < Element
|
62
|
-
|
62
|
+
|
63
63
|
include RSS09
|
64
64
|
|
65
65
|
[
|
data/lib/rss/atom.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
|
-
require 'base64'
|
2
1
|
require 'rss/parser'
|
3
2
|
|
4
3
|
module RSS
|
4
|
+
##
|
5
|
+
# Atom is an XML-based document format that is used to describe 'feeds' of related information.
|
6
|
+
# A typical use is in a news feed where the information is periodically updated and which users
|
7
|
+
# can subscribe to. The Atom format is described in http://tools.ietf.org/html/rfc4287
|
8
|
+
#
|
9
|
+
# The Atom module provides support in reading and creating feeds.
|
10
|
+
#
|
11
|
+
# See the RSS module for examples consuming and creating feeds
|
5
12
|
module Atom
|
13
|
+
|
14
|
+
##
|
15
|
+
# The Atom URI W3C Namespace
|
16
|
+
|
6
17
|
URI = "http://www.w3.org/2005/Atom"
|
18
|
+
|
19
|
+
##
|
20
|
+
# The XHTML URI W3C Namespace
|
21
|
+
|
7
22
|
XHTML_URI = "http://www.w3.org/1999/xhtml"
|
8
23
|
|
9
24
|
module CommonModel
|
@@ -75,6 +90,10 @@ module RSS
|
|
75
90
|
end
|
76
91
|
end
|
77
92
|
|
93
|
+
# The TextConstruct module is used to define a Text construct Atom element,
|
94
|
+
# which is used to store small quantities of human-readable text
|
95
|
+
#
|
96
|
+
# The TextConstruct has a type attribute, e.g. text, html, xhtml
|
78
97
|
module TextConstruct
|
79
98
|
def self.append_features(klass)
|
80
99
|
super
|
@@ -101,6 +120,7 @@ module RSS
|
|
101
120
|
end
|
102
121
|
|
103
122
|
attr_writer :xhtml
|
123
|
+
|
104
124
|
def xhtml
|
105
125
|
return @xhtml if @xhtml.nil?
|
106
126
|
if @xhtml.is_a?(XML::Element) and
|
@@ -114,6 +134,7 @@ module RSS
|
|
114
134
|
{"xmlns" => XHTML_URI}, children)
|
115
135
|
end
|
116
136
|
|
137
|
+
# Returns true if type is "xhtml"
|
117
138
|
def have_xml_content?
|
118
139
|
@type == "xhtml"
|
119
140
|
end
|
@@ -141,7 +162,13 @@ module RSS
|
|
141
162
|
end
|
142
163
|
end
|
143
164
|
|
165
|
+
# The PersonConstruct module is used to define a Person Atom element that can be
|
166
|
+
# used to describe a person, corporation, or similar entity
|
167
|
+
#
|
168
|
+
# The PersonConstruct has a Name, Uri, and Email child elements
|
144
169
|
module PersonConstruct
|
170
|
+
|
171
|
+
# Adds attributes for name, uri, and email to the +klass+
|
145
172
|
def self.append_features(klass)
|
146
173
|
super
|
147
174
|
klass.class_eval do
|
@@ -159,22 +186,30 @@ module RSS
|
|
159
186
|
target.__send__("new_#{self.class.name.split(/::/).last.downcase}")
|
160
187
|
end
|
161
188
|
|
189
|
+
# The name of the person or entity
|
162
190
|
class Name < RSS::Element
|
163
191
|
include CommonModel
|
164
192
|
include ContentModel
|
165
193
|
end
|
166
194
|
|
195
|
+
# The URI of the person or entity
|
167
196
|
class Uri < RSS::Element
|
168
197
|
include CommonModel
|
169
198
|
include URIContentModel
|
170
199
|
end
|
171
200
|
|
201
|
+
# The email of the person or entity
|
172
202
|
class Email < RSS::Element
|
173
203
|
include CommonModel
|
174
204
|
include ContentModel
|
175
205
|
end
|
176
206
|
end
|
177
207
|
|
208
|
+
# Element used to describe an Atom date and time in the ISO 8601 format
|
209
|
+
#
|
210
|
+
# Examples:
|
211
|
+
# * 2013-03-04T15:30:02Z
|
212
|
+
# * 2013-03-04T10:30:02-05:00
|
178
213
|
module DateConstruct
|
179
214
|
def self.append_features(klass)
|
180
215
|
super
|
@@ -184,12 +219,17 @@ module RSS
|
|
184
219
|
end
|
185
220
|
end
|
186
221
|
|
222
|
+
# Raises NotAvailableValueError if element content is nil
|
187
223
|
def atom_validate(ignore_unknown_element, tags, uri)
|
188
224
|
raise NotAvailableValueError.new(tag_name, "") if content.nil?
|
189
225
|
end
|
190
226
|
end
|
191
227
|
|
192
228
|
module DuplicateLinkChecker
|
229
|
+
# Checks if there are duplicate links with the same type and hreflang attributes
|
230
|
+
# that have an alternate (or empty) rel attribute
|
231
|
+
#
|
232
|
+
# Raises a TooMuchTagError if there are duplicates found
|
193
233
|
def validate_duplicate_links(links)
|
194
234
|
link_infos = {}
|
195
235
|
links.each do |link|
|
@@ -204,6 +244,9 @@ module RSS
|
|
204
244
|
end
|
205
245
|
end
|
206
246
|
|
247
|
+
# Atom feed element
|
248
|
+
#
|
249
|
+
# A Feed has several metadata attributes in addition to a number of Entry child elements
|
207
250
|
class Feed < RSS::Element
|
208
251
|
include RootElementMixin
|
209
252
|
include CommonModel
|
@@ -231,6 +274,7 @@ module RSS
|
|
231
274
|
tag, URI, occurs, tag, *args)
|
232
275
|
end
|
233
276
|
|
277
|
+
# Creates a new Atom feed
|
234
278
|
def initialize(version=nil, encoding=nil, standalone=nil)
|
235
279
|
super("1.0", version, encoding, standalone)
|
236
280
|
@feed_type = "atom"
|
@@ -239,6 +283,8 @@ module RSS
|
|
239
283
|
|
240
284
|
alias_method :items, :entries
|
241
285
|
|
286
|
+
# Returns true if there are any authors for the feed or any of the Entry
|
287
|
+
# child elements have an author
|
242
288
|
def have_author?
|
243
289
|
authors.any? {|author| !author.to_s.empty?} or
|
244
290
|
entries.any? {|entry| entry.have_author?(false)}
|
@@ -322,16 +368,32 @@ module RSS
|
|
322
368
|
end
|
323
369
|
end
|
324
370
|
|
371
|
+
# Atom Icon element
|
372
|
+
#
|
373
|
+
# Image that provides a visual identification for the Feed. Image should have an aspect
|
374
|
+
# ratio of 1:1
|
325
375
|
class Icon < RSS::Element
|
326
376
|
include CommonModel
|
327
377
|
include URIContentModel
|
328
378
|
end
|
329
379
|
|
380
|
+
# Atom ID element
|
381
|
+
#
|
382
|
+
# Universally Unique Identifier (UUID) for the Feed
|
330
383
|
class Id < RSS::Element
|
331
384
|
include CommonModel
|
332
385
|
include URIContentModel
|
333
386
|
end
|
334
387
|
|
388
|
+
# Defines an Atom Link element
|
389
|
+
#
|
390
|
+
# A Link has the following attributes:
|
391
|
+
# * href
|
392
|
+
# * rel
|
393
|
+
# * type
|
394
|
+
# * hreflang
|
395
|
+
# * title
|
396
|
+
# * length
|
335
397
|
class Link < RSS::Element
|
336
398
|
include CommonModel
|
337
399
|
|
@@ -352,6 +414,10 @@ module RSS
|
|
352
414
|
end
|
353
415
|
end
|
354
416
|
|
417
|
+
# Atom Logo element
|
418
|
+
#
|
419
|
+
# Image that provides a visual identification for the Feed. Image should have an aspect
|
420
|
+
# ratio of 2:1 (horizontal:vertical)
|
355
421
|
class Logo < RSS::Element
|
356
422
|
include CommonModel
|
357
423
|
include URIContentModel
|
@@ -366,26 +432,40 @@ module RSS
|
|
366
432
|
end
|
367
433
|
end
|
368
434
|
|
435
|
+
# Atom Rights element
|
436
|
+
#
|
437
|
+
# TextConstruct that contains copyright information regarding the content in an Entry or Feed
|
369
438
|
class Rights < RSS::Element
|
370
439
|
include CommonModel
|
371
440
|
include TextConstruct
|
372
441
|
end
|
373
442
|
|
443
|
+
# Atom Subtitle element
|
444
|
+
#
|
445
|
+
# TextConstruct that conveys a description or subtitle for a Feed
|
374
446
|
class Subtitle < RSS::Element
|
375
447
|
include CommonModel
|
376
448
|
include TextConstruct
|
377
449
|
end
|
378
450
|
|
451
|
+
# Atom Title element
|
452
|
+
#
|
453
|
+
# TextConstruct that conveys a description or title for a feed or Entry
|
379
454
|
class Title < RSS::Element
|
380
455
|
include CommonModel
|
381
456
|
include TextConstruct
|
382
457
|
end
|
383
458
|
|
459
|
+
# Atom Updated element
|
460
|
+
#
|
461
|
+
# DateConstruct indicating the most recent time when an Entry or Feed was modified
|
462
|
+
# in a way the publisher considers significant
|
384
463
|
class Updated < RSS::Element
|
385
464
|
include CommonModel
|
386
465
|
include DateConstruct
|
387
466
|
end
|
388
467
|
|
468
|
+
# Defines a child Atom Entry element for an Atom Feed
|
389
469
|
class Entry < RSS::Element
|
390
470
|
include CommonModel
|
391
471
|
include DuplicateLinkChecker
|
@@ -409,6 +489,10 @@ module RSS
|
|
409
489
|
tag, URI, occurs, tag, *args)
|
410
490
|
end
|
411
491
|
|
492
|
+
# Returns whether any of the following are true
|
493
|
+
# * There are any authors in the feed
|
494
|
+
# * If the parent element has an author and the +check_parent+ parameter was given.
|
495
|
+
# * There is a source element that has an author
|
412
496
|
def have_author?(check_parent=true)
|
413
497
|
authors.any? {|author| !author.to_s.empty?} or
|
414
498
|
(check_parent and @parent and @parent.have_author?) or
|
@@ -528,7 +612,7 @@ module RSS
|
|
528
612
|
return false unless inline_other?
|
529
613
|
return false if inline_other_xml?
|
530
614
|
|
531
|
-
media_type,
|
615
|
+
media_type, = mime_split
|
532
616
|
return true if "text" == media_type.downcase
|
533
617
|
false
|
534
618
|
end
|
@@ -635,6 +719,8 @@ module RSS
|
|
635
719
|
end
|
636
720
|
end
|
637
721
|
|
722
|
+
# Defines a top-level Atom Entry element
|
723
|
+
#
|
638
724
|
class Entry < RSS::Element
|
639
725
|
include RootElementMixin
|
640
726
|
include CommonModel
|
@@ -659,21 +745,25 @@ module RSS
|
|
659
745
|
tag, URI, occurs, tag, *args)
|
660
746
|
end
|
661
747
|
|
748
|
+
# Creates a new Atom Entry element
|
662
749
|
def initialize(version=nil, encoding=nil, standalone=nil)
|
663
750
|
super("1.0", version, encoding, standalone)
|
664
751
|
@feed_type = "atom"
|
665
752
|
@feed_subtype = "entry"
|
666
753
|
end
|
667
754
|
|
755
|
+
# Returns the Entry in an array
|
668
756
|
def items
|
669
757
|
[self]
|
670
758
|
end
|
671
759
|
|
760
|
+
# sets up the +maker+ for constructing Entry elements
|
672
761
|
def setup_maker(maker)
|
673
762
|
maker = maker.maker if maker.respond_to?("maker")
|
674
763
|
super(maker)
|
675
764
|
end
|
676
765
|
|
766
|
+
# Returns where there are any authors present or there is a source with an author
|
677
767
|
def have_author?
|
678
768
|
authors.any? {|author| !author.to_s.empty?} or
|
679
769
|
(source and source.have_author?)
|
@@ -717,7 +807,7 @@ module RSS
|
|
717
807
|
module ListenerMixin
|
718
808
|
private
|
719
809
|
def initial_start_feed(tag_name, prefix, attrs, ns)
|
720
|
-
check_ns(tag_name, prefix, ns, Atom::URI)
|
810
|
+
check_ns(tag_name, prefix, ns, Atom::URI, false)
|
721
811
|
|
722
812
|
@rss = Atom::Feed.new(@version, @encoding, @standalone)
|
723
813
|
@rss.do_validate = @do_validate
|
@@ -732,7 +822,7 @@ module RSS
|
|
732
822
|
end
|
733
823
|
|
734
824
|
def initial_start_entry(tag_name, prefix, attrs, ns)
|
735
|
-
check_ns(tag_name, prefix, ns, Atom::URI)
|
825
|
+
check_ns(tag_name, prefix, ns, Atom::URI, false)
|
736
826
|
|
737
827
|
@rss = Atom::Entry.new(@version, @encoding, @standalone)
|
738
828
|
@rss.do_validate = @do_validate
|