Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/rss
File: 1.0.rb
# frozen_string_literal: false
[0] Fix | Delete
require_relative "parser"
[1] Fix | Delete
[2] Fix | Delete
module RSS
[3] Fix | Delete
[4] Fix | Delete
##
[5] Fix | Delete
# = RSS 1.0 support
[6] Fix | Delete
#
[7] Fix | Delete
# RSS has three different versions. This module contains support for version
[8] Fix | Delete
# 1.0[http://web.resource.org/rss/1.0/]
[9] Fix | Delete
#
[10] Fix | Delete
# == Producing RSS 1.0
[11] Fix | Delete
#
[12] Fix | Delete
# Producing our own RSS feeds is easy as well. Let's make a very basic feed:
[13] Fix | Delete
#
[14] Fix | Delete
# require "rss"
[15] Fix | Delete
#
[16] Fix | Delete
# rss = RSS::Maker.make("1.0") do |maker|
[17] Fix | Delete
# maker.channel.language = "en"
[18] Fix | Delete
# maker.channel.author = "matz"
[19] Fix | Delete
# maker.channel.about = "About my feed."
[20] Fix | Delete
# maker.channel.updated = Time.now.to_s
[21] Fix | Delete
# maker.channel.link = "http://www.ruby-lang.org/en/feeds/news.rss"
[22] Fix | Delete
# maker.channel.title = "Example Feed"
[23] Fix | Delete
# maker.channel.description = "A longer description of my feed."
[24] Fix | Delete
# maker.items.new_item do |item|
[25] Fix | Delete
# item.link = "http://www.ruby-lang.org/en/news/2010/12/25/ruby-1-9-2-p136-is-released/"
[26] Fix | Delete
# item.title = "Ruby 1.9.2-p136 is released"
[27] Fix | Delete
# item.updated = Time.now.to_s
[28] Fix | Delete
# end
[29] Fix | Delete
# end
[30] Fix | Delete
#
[31] Fix | Delete
# puts rss
[32] Fix | Delete
#
[33] Fix | Delete
# As you can see, this is a very Builder-like DSL. This code will spit out an
[34] Fix | Delete
# RSS 1.0 feed with one item. If we needed a second item, we'd make another
[35] Fix | Delete
# block with maker.items.new_item and build a second one.
[36] Fix | Delete
module RSS10
[37] Fix | Delete
NSPOOL = {}
[38] Fix | Delete
ELEMENTS = []
[39] Fix | Delete
[40] Fix | Delete
def self.append_features(klass)
[41] Fix | Delete
super
[42] Fix | Delete
[43] Fix | Delete
klass.install_must_call_validator('', ::RSS::URI)
[44] Fix | Delete
end
[45] Fix | Delete
[46] Fix | Delete
end
[47] Fix | Delete
[48] Fix | Delete
class RDF < Element
[49] Fix | Delete
[50] Fix | Delete
include RSS10
[51] Fix | Delete
include RootElementMixin
[52] Fix | Delete
[53] Fix | Delete
class << self
[54] Fix | Delete
[55] Fix | Delete
def required_uri
[56] Fix | Delete
URI
[57] Fix | Delete
end
[58] Fix | Delete
[59] Fix | Delete
end
[60] Fix | Delete
[61] Fix | Delete
@tag_name = 'RDF'
[62] Fix | Delete
[63] Fix | Delete
PREFIX = 'rdf'
[64] Fix | Delete
URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
[65] Fix | Delete
[66] Fix | Delete
install_ns('', ::RSS::URI)
[67] Fix | Delete
install_ns(PREFIX, URI)
[68] Fix | Delete
[69] Fix | Delete
[
[70] Fix | Delete
["channel", nil],
[71] Fix | Delete
["image", "?"],
[72] Fix | Delete
["item", "+", :children],
[73] Fix | Delete
["textinput", "?"],
[74] Fix | Delete
].each do |tag, occurs, type|
[75] Fix | Delete
type ||= :child
[76] Fix | Delete
__send__("install_have_#{type}_element", tag, ::RSS::URI, occurs)
[77] Fix | Delete
end
[78] Fix | Delete
[79] Fix | Delete
alias_method(:rss_version, :feed_version)
[80] Fix | Delete
def initialize(version=nil, encoding=nil, standalone=nil)
[81] Fix | Delete
super('1.0', version, encoding, standalone)
[82] Fix | Delete
@feed_type = "rss"
[83] Fix | Delete
end
[84] Fix | Delete
[85] Fix | Delete
def full_name
[86] Fix | Delete
tag_name_with_prefix(PREFIX)
[87] Fix | Delete
end
[88] Fix | Delete
[89] Fix | Delete
class Li < Element
[90] Fix | Delete
[91] Fix | Delete
include RSS10
[92] Fix | Delete
[93] Fix | Delete
class << self
[94] Fix | Delete
def required_uri
[95] Fix | Delete
URI
[96] Fix | Delete
end
[97] Fix | Delete
end
[98] Fix | Delete
[99] Fix | Delete
[
[100] Fix | Delete
["resource", [URI, ""], true]
[101] Fix | Delete
].each do |name, uri, required|
[102] Fix | Delete
install_get_attribute(name, uri, required)
[103] Fix | Delete
end
[104] Fix | Delete
[105] Fix | Delete
def initialize(*args)
[106] Fix | Delete
if Utils.element_initialize_arguments?(args)
[107] Fix | Delete
super
[108] Fix | Delete
else
[109] Fix | Delete
super()
[110] Fix | Delete
self.resource = args[0]
[111] Fix | Delete
end
[112] Fix | Delete
end
[113] Fix | Delete
[114] Fix | Delete
def full_name
[115] Fix | Delete
tag_name_with_prefix(PREFIX)
[116] Fix | Delete
end
[117] Fix | Delete
end
[118] Fix | Delete
[119] Fix | Delete
class Seq < Element
[120] Fix | Delete
[121] Fix | Delete
include RSS10
[122] Fix | Delete
[123] Fix | Delete
Li = ::RSS::RDF::Li
[124] Fix | Delete
[125] Fix | Delete
class << self
[126] Fix | Delete
def required_uri
[127] Fix | Delete
URI
[128] Fix | Delete
end
[129] Fix | Delete
end
[130] Fix | Delete
[131] Fix | Delete
@tag_name = 'Seq'
[132] Fix | Delete
[133] Fix | Delete
install_have_children_element("li", URI, "*")
[134] Fix | Delete
install_must_call_validator('rdf', ::RSS::RDF::URI)
[135] Fix | Delete
[136] Fix | Delete
def initialize(*args)
[137] Fix | Delete
if Utils.element_initialize_arguments?(args)
[138] Fix | Delete
super
[139] Fix | Delete
else
[140] Fix | Delete
super()
[141] Fix | Delete
@li = args[0] if args[0]
[142] Fix | Delete
end
[143] Fix | Delete
end
[144] Fix | Delete
[145] Fix | Delete
def full_name
[146] Fix | Delete
tag_name_with_prefix(PREFIX)
[147] Fix | Delete
end
[148] Fix | Delete
[149] Fix | Delete
def setup_maker(target)
[150] Fix | Delete
lis.each do |li|
[151] Fix | Delete
target << li.resource
[152] Fix | Delete
end
[153] Fix | Delete
end
[154] Fix | Delete
end
[155] Fix | Delete
[156] Fix | Delete
class Bag < Element
[157] Fix | Delete
[158] Fix | Delete
include RSS10
[159] Fix | Delete
[160] Fix | Delete
Li = ::RSS::RDF::Li
[161] Fix | Delete
[162] Fix | Delete
class << self
[163] Fix | Delete
def required_uri
[164] Fix | Delete
URI
[165] Fix | Delete
end
[166] Fix | Delete
end
[167] Fix | Delete
[168] Fix | Delete
@tag_name = 'Bag'
[169] Fix | Delete
[170] Fix | Delete
install_have_children_element("li", URI, "*")
[171] Fix | Delete
install_must_call_validator('rdf', URI)
[172] Fix | Delete
[173] Fix | Delete
def initialize(*args)
[174] Fix | Delete
if Utils.element_initialize_arguments?(args)
[175] Fix | Delete
super
[176] Fix | Delete
else
[177] Fix | Delete
super()
[178] Fix | Delete
@li = args[0] if args[0]
[179] Fix | Delete
end
[180] Fix | Delete
end
[181] Fix | Delete
[182] Fix | Delete
def full_name
[183] Fix | Delete
tag_name_with_prefix(PREFIX)
[184] Fix | Delete
end
[185] Fix | Delete
[186] Fix | Delete
def setup_maker(target)
[187] Fix | Delete
lis.each do |li|
[188] Fix | Delete
target << li.resource
[189] Fix | Delete
end
[190] Fix | Delete
end
[191] Fix | Delete
end
[192] Fix | Delete
[193] Fix | Delete
class Channel < Element
[194] Fix | Delete
[195] Fix | Delete
include RSS10
[196] Fix | Delete
[197] Fix | Delete
class << self
[198] Fix | Delete
[199] Fix | Delete
def required_uri
[200] Fix | Delete
::RSS::URI
[201] Fix | Delete
end
[202] Fix | Delete
[203] Fix | Delete
end
[204] Fix | Delete
[205] Fix | Delete
[
[206] Fix | Delete
["about", URI, true]
[207] Fix | Delete
].each do |name, uri, required|
[208] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[209] Fix | Delete
"#{PREFIX}:#{name}")
[210] Fix | Delete
end
[211] Fix | Delete
[212] Fix | Delete
[
[213] Fix | Delete
['title', nil, :text],
[214] Fix | Delete
['link', nil, :text],
[215] Fix | Delete
['description', nil, :text],
[216] Fix | Delete
['image', '?', :have_child],
[217] Fix | Delete
['items', nil, :have_child],
[218] Fix | Delete
['textinput', '?', :have_child],
[219] Fix | Delete
].each do |tag, occurs, type|
[220] Fix | Delete
__send__("install_#{type}_element", tag, ::RSS::URI, occurs)
[221] Fix | Delete
end
[222] Fix | Delete
[223] Fix | Delete
def initialize(*args)
[224] Fix | Delete
if Utils.element_initialize_arguments?(args)
[225] Fix | Delete
super
[226] Fix | Delete
else
[227] Fix | Delete
super()
[228] Fix | Delete
self.about = args[0]
[229] Fix | Delete
end
[230] Fix | Delete
end
[231] Fix | Delete
[232] Fix | Delete
private
[233] Fix | Delete
def maker_target(maker)
[234] Fix | Delete
maker.channel
[235] Fix | Delete
end
[236] Fix | Delete
[237] Fix | Delete
def setup_maker_attributes(channel)
[238] Fix | Delete
channel.about = about
[239] Fix | Delete
end
[240] Fix | Delete
[241] Fix | Delete
class Image < Element
[242] Fix | Delete
[243] Fix | Delete
include RSS10
[244] Fix | Delete
[245] Fix | Delete
class << self
[246] Fix | Delete
[247] Fix | Delete
def required_uri
[248] Fix | Delete
::RSS::URI
[249] Fix | Delete
end
[250] Fix | Delete
[251] Fix | Delete
end
[252] Fix | Delete
[253] Fix | Delete
[
[254] Fix | Delete
["resource", URI, true]
[255] Fix | Delete
].each do |name, uri, required|
[256] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[257] Fix | Delete
"#{PREFIX}:#{name}")
[258] Fix | Delete
end
[259] Fix | Delete
[260] Fix | Delete
def initialize(*args)
[261] Fix | Delete
if Utils.element_initialize_arguments?(args)
[262] Fix | Delete
super
[263] Fix | Delete
else
[264] Fix | Delete
super()
[265] Fix | Delete
self.resource = args[0]
[266] Fix | Delete
end
[267] Fix | Delete
end
[268] Fix | Delete
end
[269] Fix | Delete
[270] Fix | Delete
class Textinput < Element
[271] Fix | Delete
[272] Fix | Delete
include RSS10
[273] Fix | Delete
[274] Fix | Delete
class << self
[275] Fix | Delete
[276] Fix | Delete
def required_uri
[277] Fix | Delete
::RSS::URI
[278] Fix | Delete
end
[279] Fix | Delete
[280] Fix | Delete
end
[281] Fix | Delete
[282] Fix | Delete
[
[283] Fix | Delete
["resource", URI, true]
[284] Fix | Delete
].each do |name, uri, required|
[285] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[286] Fix | Delete
"#{PREFIX}:#{name}")
[287] Fix | Delete
end
[288] Fix | Delete
[289] Fix | Delete
def initialize(*args)
[290] Fix | Delete
if Utils.element_initialize_arguments?(args)
[291] Fix | Delete
super
[292] Fix | Delete
else
[293] Fix | Delete
super()
[294] Fix | Delete
self.resource = args[0]
[295] Fix | Delete
end
[296] Fix | Delete
end
[297] Fix | Delete
end
[298] Fix | Delete
[299] Fix | Delete
class Items < Element
[300] Fix | Delete
[301] Fix | Delete
include RSS10
[302] Fix | Delete
[303] Fix | Delete
Seq = ::RSS::RDF::Seq
[304] Fix | Delete
[305] Fix | Delete
class << self
[306] Fix | Delete
[307] Fix | Delete
def required_uri
[308] Fix | Delete
::RSS::URI
[309] Fix | Delete
end
[310] Fix | Delete
[311] Fix | Delete
end
[312] Fix | Delete
[313] Fix | Delete
install_have_child_element("Seq", URI, nil)
[314] Fix | Delete
install_must_call_validator('rdf', URI)
[315] Fix | Delete
[316] Fix | Delete
def initialize(*args)
[317] Fix | Delete
if Utils.element_initialize_arguments?(args)
[318] Fix | Delete
super
[319] Fix | Delete
else
[320] Fix | Delete
super()
[321] Fix | Delete
self.Seq = args[0]
[322] Fix | Delete
end
[323] Fix | Delete
self.Seq ||= Seq.new
[324] Fix | Delete
end
[325] Fix | Delete
[326] Fix | Delete
def resources
[327] Fix | Delete
if @Seq
[328] Fix | Delete
@Seq.lis.collect do |li|
[329] Fix | Delete
li.resource
[330] Fix | Delete
end
[331] Fix | Delete
else
[332] Fix | Delete
[]
[333] Fix | Delete
end
[334] Fix | Delete
end
[335] Fix | Delete
end
[336] Fix | Delete
end
[337] Fix | Delete
[338] Fix | Delete
class Image < Element
[339] Fix | Delete
[340] Fix | Delete
include RSS10
[341] Fix | Delete
[342] Fix | Delete
class << self
[343] Fix | Delete
[344] Fix | Delete
def required_uri
[345] Fix | Delete
::RSS::URI
[346] Fix | Delete
end
[347] Fix | Delete
[348] Fix | Delete
end
[349] Fix | Delete
[350] Fix | Delete
[
[351] Fix | Delete
["about", URI, true]
[352] Fix | Delete
].each do |name, uri, required|
[353] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[354] Fix | Delete
"#{PREFIX}:#{name}")
[355] Fix | Delete
end
[356] Fix | Delete
[357] Fix | Delete
%w(title url link).each do |name|
[358] Fix | Delete
install_text_element(name, ::RSS::URI, nil)
[359] Fix | Delete
end
[360] Fix | Delete
[361] Fix | Delete
def initialize(*args)
[362] Fix | Delete
if Utils.element_initialize_arguments?(args)
[363] Fix | Delete
super
[364] Fix | Delete
else
[365] Fix | Delete
super()
[366] Fix | Delete
self.about = args[0]
[367] Fix | Delete
end
[368] Fix | Delete
end
[369] Fix | Delete
[370] Fix | Delete
private
[371] Fix | Delete
def maker_target(maker)
[372] Fix | Delete
maker.image
[373] Fix | Delete
end
[374] Fix | Delete
end
[375] Fix | Delete
[376] Fix | Delete
class Item < Element
[377] Fix | Delete
[378] Fix | Delete
include RSS10
[379] Fix | Delete
[380] Fix | Delete
class << self
[381] Fix | Delete
[382] Fix | Delete
def required_uri
[383] Fix | Delete
::RSS::URI
[384] Fix | Delete
end
[385] Fix | Delete
[386] Fix | Delete
end
[387] Fix | Delete
[388] Fix | Delete
[389] Fix | Delete
[
[390] Fix | Delete
["about", URI, true]
[391] Fix | Delete
].each do |name, uri, required|
[392] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[393] Fix | Delete
"#{PREFIX}:#{name}")
[394] Fix | Delete
end
[395] Fix | Delete
[396] Fix | Delete
[
[397] Fix | Delete
["title", nil],
[398] Fix | Delete
["link", nil],
[399] Fix | Delete
["description", "?"],
[400] Fix | Delete
].each do |tag, occurs|
[401] Fix | Delete
install_text_element(tag, ::RSS::URI, occurs)
[402] Fix | Delete
end
[403] Fix | Delete
[404] Fix | Delete
def initialize(*args)
[405] Fix | Delete
if Utils.element_initialize_arguments?(args)
[406] Fix | Delete
super
[407] Fix | Delete
else
[408] Fix | Delete
super()
[409] Fix | Delete
self.about = args[0]
[410] Fix | Delete
end
[411] Fix | Delete
end
[412] Fix | Delete
[413] Fix | Delete
private
[414] Fix | Delete
def maker_target(items)
[415] Fix | Delete
if items.respond_to?("items")
[416] Fix | Delete
# For backward compatibility
[417] Fix | Delete
items = items.items
[418] Fix | Delete
end
[419] Fix | Delete
items.new_item
[420] Fix | Delete
end
[421] Fix | Delete
end
[422] Fix | Delete
[423] Fix | Delete
class Textinput < Element
[424] Fix | Delete
[425] Fix | Delete
include RSS10
[426] Fix | Delete
[427] Fix | Delete
class << self
[428] Fix | Delete
[429] Fix | Delete
def required_uri
[430] Fix | Delete
::RSS::URI
[431] Fix | Delete
end
[432] Fix | Delete
[433] Fix | Delete
end
[434] Fix | Delete
[435] Fix | Delete
[
[436] Fix | Delete
["about", URI, true]
[437] Fix | Delete
].each do |name, uri, required|
[438] Fix | Delete
install_get_attribute(name, uri, required, nil, nil,
[439] Fix | Delete
"#{PREFIX}:#{name}")
[440] Fix | Delete
end
[441] Fix | Delete
[442] Fix | Delete
%w(title description name link).each do |name|
[443] Fix | Delete
install_text_element(name, ::RSS::URI, nil)
[444] Fix | Delete
end
[445] Fix | Delete
[446] Fix | Delete
def initialize(*args)
[447] Fix | Delete
if Utils.element_initialize_arguments?(args)
[448] Fix | Delete
super
[449] Fix | Delete
else
[450] Fix | Delete
super()
[451] Fix | Delete
self.about = args[0]
[452] Fix | Delete
end
[453] Fix | Delete
end
[454] Fix | Delete
[455] Fix | Delete
private
[456] Fix | Delete
def maker_target(maker)
[457] Fix | Delete
maker.textinput
[458] Fix | Delete
end
[459] Fix | Delete
end
[460] Fix | Delete
[461] Fix | Delete
end
[462] Fix | Delete
[463] Fix | Delete
RSS10::ELEMENTS.each do |name|
[464] Fix | Delete
BaseListener.install_get_text_element(URI, name, name)
[465] Fix | Delete
end
[466] Fix | Delete
[467] Fix | Delete
module ListenerMixin
[468] Fix | Delete
private
[469] Fix | Delete
def initial_start_RDF(tag_name, prefix, attrs, ns)
[470] Fix | Delete
check_ns(tag_name, prefix, ns, RDF::URI, false)
[471] Fix | Delete
[472] Fix | Delete
@rss = RDF.new(@version, @encoding, @standalone)
[473] Fix | Delete
@rss.do_validate = @do_validate
[474] Fix | Delete
@rss.xml_stylesheets = @xml_stylesheets
[475] Fix | Delete
@last_element = @rss
[476] Fix | Delete
pr = Proc.new do |text, tags|
[477] Fix | Delete
@rss.validate_for_stream(tags, @ignore_unknown_element) if @do_validate
[478] Fix | Delete
end
[479] Fix | Delete
@proc_stack.push(pr)
[480] Fix | Delete
end
[481] Fix | Delete
end
[482] Fix | Delete
[483] Fix | Delete
end
[484] Fix | Delete
[485] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function