mymedia-blogbase 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mymedia-blogbase.rb +3 -78
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e037f0e0904b26890b58f6c4d0a27d75ca2bba
|
4
|
+
data.tar.gz: 30629bbb3b99e801e907e983001e560747be0fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6beea24e358ad076f455a4449c000ed131ce8e6c5f0ed63d87a8b8f2ebecff2b8ece55e90c8b0a3ae42cb1555e4591798aa7c15c66a7b15f2577d6b34b71af5
|
7
|
+
data.tar.gz: a486266cd830d9383ea07ec417a421383a7604ed0f935bcaa3e3b3d56b1feedcd4ec372207fafaa3c2829e30ae9d4c2d0de92e3c2c1afbe99f1ae0c7c569b87a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-blogbase.rb
CHANGED
@@ -47,8 +47,6 @@ class MyMediaBlogBase < MyMedia::Base
|
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
50
|
protected
|
53
51
|
|
54
52
|
def html(raw_buffer, filename)
|
@@ -118,83 +116,9 @@ class MyMediaBlogBase < MyMedia::Base
|
|
118
116
|
end
|
119
117
|
|
120
118
|
return doc
|
121
|
-
end
|
122
|
-
|
123
|
-
def xml(raw_buffer, filename, original_file)
|
124
|
-
|
125
|
-
begin
|
126
|
-
|
127
|
-
buffer = Martile.new(raw_buffer).to_html
|
128
|
-
|
129
|
-
lines = buffer.strip.lines.to_a
|
130
|
-
raw_title = lines.shift.chomp
|
131
|
-
raw_tags = lines.pop[/[^>]+$/].split
|
132
|
-
|
133
|
-
s = lines.join.gsub(/(?:^\[|\s\[)[^\]]+\]\((https?:\/\/[^\s]+)/) do |x|
|
134
|
-
|
135
|
-
next x if x[/#{@domain}/]
|
136
|
-
s2 = x[/https?:\/\/([^\/]+)/,1].split(/\./)
|
137
|
-
r = s2.length >= 3 ? s2[1..-1] : s2
|
138
|
-
"%s [%s]" % [x, r.join('.')]
|
139
|
-
end
|
140
|
-
|
141
|
-
html = RDiscount.new(s).to_html
|
142
|
-
doc = Rexle.new("<body>%s</body>" % html)
|
143
|
-
|
144
|
-
doc.root.xpath('//a').each do |x|
|
145
|
-
|
146
|
-
next unless x.attributes[:href].empty?
|
147
|
-
|
148
|
-
new_link = x.text.gsub(/\s/,'_')
|
149
|
-
|
150
|
-
x.attributes[:href] = "#{@dynamic_website}/do/#{@public_type}/new/" + new_link
|
151
|
-
x.attributes[:class] = 'new'
|
152
|
-
x.attributes[:title] = x.text + ' (page does not exist)'
|
153
|
-
end
|
154
|
-
|
155
|
-
body = doc.root.children.join
|
156
|
-
|
157
|
-
|
158
|
-
xml = RexleBuilder.new
|
159
|
-
|
160
|
-
a = xml.page do
|
161
|
-
xml.summary do
|
162
|
-
xml.title raw_title
|
163
|
-
xml.tags { raw_tags.each {|tag| xml.tag tag }}
|
164
|
-
xml.source_url filename
|
165
|
-
xml.source_file File.basename(filename)
|
166
|
-
xml.original_file original_file
|
167
|
-
xml.published Time.now.strftime("%d-%m-%Y %H:%M")
|
168
|
-
end
|
169
|
-
|
170
|
-
xml.body body
|
171
|
-
end
|
172
|
-
|
173
|
-
rescue
|
174
|
-
@logger.debug "mymedia-blogbase.rb: html: " + ($!).to_s
|
175
|
-
end
|
176
|
-
|
177
|
-
return Rexle.new(a)
|
178
|
-
end
|
179
|
-
|
180
|
-
|
181
|
-
def microblog_title2(doc)
|
182
|
-
|
183
|
-
summary = doc.root.element('summary')
|
184
|
-
title = summary.text('title')
|
185
|
-
tags = summary.xpath('tags/tag/text()').map{|x| '#' + x}.join ' '
|
186
|
-
|
187
|
-
url = "%s/%s/yy/mm/dd/hhmmhrs.html" % [@website, @media_type]
|
188
|
-
full_title = (url + title + ' ' + tags)
|
189
|
-
|
190
|
-
if full_title.length > 140 then
|
191
|
-
extra = full_title.length - 140
|
192
|
-
title = title[0..-(extra)] + ' ...'
|
193
|
-
end
|
194
|
-
|
195
|
-
title + ' ' + tags
|
196
|
-
|
197
119
|
end
|
120
|
+
|
121
|
+
|
198
122
|
|
199
123
|
def microblog_title(doc)
|
200
124
|
|
@@ -214,6 +138,7 @@ class MyMediaBlogBase < MyMedia::Base
|
|
214
138
|
end
|
215
139
|
|
216
140
|
private
|
141
|
+
|
217
142
|
|
218
143
|
def add_css_js(xml)
|
219
144
|
# overridden in the RSF file
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymedia-blogbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
W6oyq4p6WDOpJ2y9HFHWdg8TmF1bZj7k6y+5Tx6uce9VL6Jj3b8fa1YfHrqAU/4Z
|
32
32
|
ZwDOWqyDyRdF8g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-10-
|
34
|
+
date: 2014-10-12 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
metadata.gz.sig
CHANGED
Binary file
|