liveblog 1.2.12 → 1.2.13
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.tar.gz.sig +0 -0
- data/lib/liveblog.rb +39 -33
- metadata +17 -17
- 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: a4c9a249c3de12156df464813319e5a4ec93c24f
|
4
|
+
data.tar.gz: 874aa1432af8c1ecccf7dbb9a7b2e7392d9a8cf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98dec21b66cb1312741e9162e688b41b0cda3f7724e6f0f66ada2af76e82ab500fb7fa4942390da5c42953be983b6bf3fa75318b94e91692dbd6130ccf15b5bb
|
7
|
+
data.tar.gz: d89ddb9b7d61a00e4b0c6e83914d7042410ba0580453cc2b7c041167e53d69bb8718515597f7be402652399a281084a9f34a88b87af75092f4e7980d330942c0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/liveblog.rb
CHANGED
@@ -8,16 +8,20 @@ require 'dxsectionx'
|
|
8
8
|
require 'simple-config'
|
9
9
|
require 'rexle-diff'
|
10
10
|
|
11
|
+
|
11
12
|
class LiveBlog
|
12
13
|
|
13
14
|
|
14
|
-
|
15
15
|
# the config can either be a hash, a config filepath, or nil
|
16
16
|
#
|
17
|
-
def initialize(x=nil, config: nil, date: Date.today, plugins: {})
|
17
|
+
def initialize(x=nil, config: nil, date: Date.today, plugins: {}, logpath: '')
|
18
18
|
|
19
|
-
@
|
20
|
-
|
19
|
+
@log = nil
|
20
|
+
|
21
|
+
if logpath.length > 0
|
22
|
+
@log = Logger.new logpath, 'daily'
|
23
|
+
@log.debug 'inside initialize'
|
24
|
+
end
|
21
25
|
|
22
26
|
config = if x or config then
|
23
27
|
|
@@ -37,10 +41,10 @@ class LiveBlog
|
|
37
41
|
|
38
42
|
@dir, @urlbase, @edit_url, @css_url, @xsl_path, @xsl_today_path, \
|
39
43
|
@xsl_url, @bannertext, @title, @rss_title, @rss_lang, \
|
40
|
-
@hyperlink_today, plugins = \
|
44
|
+
@hyperlink_today, plugins, @photo_upload_url = \
|
41
45
|
(%i(dir urlbase edit_url css_url xsl_path xsl_today_path xsl_url) \
|
42
46
|
+ %i( bannertext title rss_title rss_lang hyperlink_today ) \
|
43
|
-
+ %i(plugins)).map{|x| h[x]}
|
47
|
+
+ %i(plugins photo_upload_url)).map{|x| h[x]}
|
44
48
|
|
45
49
|
@title ||= 'LiveBlog'
|
46
50
|
@rss_lang ||= 'en-gb'
|
@@ -171,17 +175,17 @@ class LiveBlog
|
|
171
175
|
end
|
172
176
|
|
173
177
|
end
|
174
|
-
@
|
178
|
+
@log.debug 'inside new_day' if @log
|
175
179
|
|
176
180
|
'new_day() successful'
|
177
181
|
end
|
178
182
|
|
179
183
|
def new_file(x=nil)
|
180
184
|
|
181
|
-
@
|
185
|
+
@log.debug 'inside new_file' if @log
|
182
186
|
s = nil
|
183
187
|
s, _ = RXFHelper.read(x) if x
|
184
|
-
@
|
188
|
+
@log.debug 's: ' + s.inspect if @log
|
185
189
|
s ||= <<EOF
|
186
190
|
<?dynarex schema="sections[title]/section(x)"?>
|
187
191
|
title: #{@title} #{ordinalize(@d.day) + @d.strftime(" %B %Y")}
|
@@ -210,7 +214,7 @@ EOF
|
|
210
214
|
s.gsub!(/(?:^|\s)!tc\z/, "*completed #{time(t)}*")
|
211
215
|
s.gsub!(/(?:^|\s)!t\s/, '\1' + time(t))
|
212
216
|
|
213
|
-
@
|
217
|
+
@log.debug 'before mkdir_p: ' + path().inspect if @log
|
214
218
|
FileUtils.mkdir_p File.join(@dir, path())
|
215
219
|
|
216
220
|
@dx = Dynarex.new
|
@@ -225,7 +229,7 @@ EOF
|
|
225
229
|
end
|
226
230
|
|
227
231
|
@dx.instance_variable_set :@dirty_flag, true
|
228
|
-
@
|
232
|
+
@log.debug 'about to save new_file' if @log
|
229
233
|
|
230
234
|
save()
|
231
235
|
|
@@ -253,7 +257,24 @@ EOF
|
|
253
257
|
FileUtils.cp File.join(@dir, path(),'raw_formatted.xml'), \
|
254
258
|
File.join(@dir, path(),'raw_formatted.xml.bak')
|
255
259
|
'save() successful'
|
256
|
-
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def tags()
|
263
|
+
|
264
|
+
file = @dir + Date.today.to_time.strftime("%Y/%b/%-d/formatted2.xml").downcase
|
265
|
+
|
266
|
+
if File.exists? file then
|
267
|
+
|
268
|
+
Rexle.new(File.read file).root
|
269
|
+
.xpath('summary/tags/tag/text()').map{|x| x.to_s}
|
270
|
+
|
271
|
+
else
|
272
|
+
|
273
|
+
[]
|
274
|
+
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
257
278
|
|
258
279
|
def update(val)
|
259
280
|
self.method(val[/^<\?dynarex/] ? :import : :update_entry).call val
|
@@ -290,29 +311,12 @@ EOF
|
|
290
311
|
|
291
312
|
def valid_entry?(entry)
|
292
313
|
|
293
|
-
return false unless entry =~ /#\w+/
|
294
|
-
|
295
|
-
def hashtag_exists?(tag)
|
296
|
-
|
297
|
-
file = @dir + Date.today.to_time.strftime("%Y/%b/%-d/formatted2.xml").downcase
|
298
|
-
|
299
|
-
if File.exists? file then
|
300
|
-
|
301
|
-
doc = Rexle.new(File.read file)
|
302
|
-
tags = doc.root.xpath('summary/tags/tag/text()')
|
303
|
-
return true if tags.include? tag
|
304
|
-
end
|
305
|
-
|
306
|
-
return false
|
307
|
-
end
|
308
|
-
|
309
|
-
tag = entry[/#(\w+)$/,1]
|
314
|
+
return false unless entry =~ /#\w+/
|
310
315
|
|
311
|
-
|
316
|
+
tag = entry[/#(\w+)$/,1]
|
317
|
+
entry.lstrip[/^#\s+/] or (tag and tags().include?(tag)) ? true : false
|
312
318
|
|
313
319
|
end
|
314
|
-
|
315
|
-
|
316
320
|
|
317
321
|
|
318
322
|
private
|
@@ -391,6 +395,7 @@ EOF
|
|
391
395
|
dir: dir,
|
392
396
|
urlbase: 'http://www.yourwebsitehere.org/liveblog/',
|
393
397
|
edit_url: 'http://www.yourwebsitehere.org/do/liveblog/edit',
|
398
|
+
photo_upload_url: 'http://www.yourwebsitehere.org/do/liveblog/upload',
|
394
399
|
css_url: '/liveblog/liveblog.css',
|
395
400
|
xsl_path: File.join(dir, 'liveblog.xsl'),
|
396
401
|
xsl_today_path: File.join(dir, 'liveblog_today.xsl'),
|
@@ -443,6 +448,7 @@ EOF
|
|
443
448
|
summary.element('recordx_type').delete
|
444
449
|
|
445
450
|
add summary, 'edit_url', "%s/%s" % [@edit_url, urlpath()]
|
451
|
+
add summary, 'photo_upload_url', "%s/%s" % [@photo_upload_url, urlpath()]
|
446
452
|
add summary, 'date', @d.strftime("%d-%b-%Y").upcase
|
447
453
|
add summary, 'day', @d.strftime("%A")
|
448
454
|
add summary, 'date_uri', urlpath()
|
@@ -663,4 +669,4 @@ EOF
|
|
663
669
|
nil
|
664
670
|
end
|
665
671
|
end
|
666
|
-
end
|
672
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liveblog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDcwMzE1NTM1NloXDTE4MDcwMzE1NTM1Nl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29
|
+
WK2ysnPfqv8wmsrR4X4m8+tbh3juG4o2eA0yh+yl55NfTzrR3J6U8/U1+lIxFEmE
|
30
|
+
YXQ1k8NebmLSYx1N4j5nRfl2Cu0NsejQBeCgSkq2EpbhTW4O45b+JVxp48t6QK+N
|
31
|
+
Pa3Oua4kplXh4chiXeKSmDf1kgQML6il1F/Lc7p0dgRDB7gHh+cqR/GSt6/44MoB
|
32
|
+
/PQO/0DfLVBu1A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-07-03 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dxsectionx
|
metadata.gz.sig
CHANGED
Binary file
|