liveblog-plugin-dxtags 0.2.3 → 0.2.5
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/liveblog-plugin-dxtags.rb +27 -12
- 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: 2f7ec79e52d9b5e0a946fd2dfcb007334ae35274
|
|
4
|
+
data.tar.gz: 4ce45910ea036f1a9d30e2770b098d1951f70980
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d91335f6a04bcb80acec9b1333815ae65adecbb55d734d1261fdc7af16c1a626ada0782e617db06f5707c35acc2b9c6911bb68a904789981ca5bb17255760ac8
|
|
7
|
+
data.tar.gz: 29424081c3db12176f85cb9ff587f0a7aaae9eecb9f450f3a91e40d3bda12c10942aab87a579b613e82b70fd93ad1ab919d26bafe7843e51d69135c8fc917b60
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
|
@@ -9,28 +9,32 @@ require 'dynarex-tags'
|
|
|
9
9
|
class LiveBlogPluginDxTags
|
|
10
10
|
|
|
11
11
|
def initialize(settings: {}, variables: {})
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
@tag_xsltpath = settings[:tag_xslt_path]
|
|
13
14
|
@parent_filepath = variables[:filepath]
|
|
14
15
|
@todays_filepath = variables[:todays_filepath]
|
|
16
|
+
@urlbase = variables[:urlbase]
|
|
15
17
|
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def on_new_day(filepath, urlpath)
|
|
19
21
|
|
|
20
|
-
DynarexTags.new(@parent_filepath
|
|
22
|
+
dxt = DynarexTags.new(@parent_filepath, tagfile_xslt: @tag_xsltpath)
|
|
23
|
+
|
|
24
|
+
dxt.generate(filepath) do |section|
|
|
21
25
|
|
|
22
26
|
title = section.x.lines.first
|
|
23
27
|
|
|
24
28
|
title.scan(/\B#(\w+)(?=\s|$)/).map do |x|
|
|
25
29
|
|
|
26
30
|
hashtag = x.first
|
|
27
|
-
[hashtag, title.sub(/#\s+/,''), urlpath + '#' + hashtag]
|
|
31
|
+
[hashtag, title.sub(/#\s+/,''), @urlbase + urlpath + '#' + hashtag]
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
return unless @todays_filepath
|
|
33
|
-
|
|
37
|
+
|
|
34
38
|
px = Polyrex.new 'tags/tag[label]/entry[title, url]'
|
|
35
39
|
px.save File.join(@todays_filepath, 'tags-seealso.xml')
|
|
36
40
|
|
|
@@ -42,15 +46,26 @@ class LiveBlogPluginDxTags
|
|
|
42
46
|
|
|
43
47
|
filepath = File.join(@parent_filepath, 'tags', hashtag + '.xml')
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
if File.exists? filepath then
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
dx = Dynarex.new filepath
|
|
52
|
+
recs = dx.to_h
|
|
53
|
+
|
|
54
|
+
pxfilepath = File.join(@todays_filepath, 'tags-seealso.xml')
|
|
55
|
+
px = Polyrex.new pxfilepath
|
|
56
|
+
px.create.tag( label: hashtag) {|create| recs.each {|h| create.entry h} }
|
|
57
|
+
px.save options: {pretty: true}
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
else
|
|
60
|
+
|
|
61
|
+
# add a Dynarex file in the tags directory
|
|
62
|
+
dx = Dynarex.new 'items/item(title,url)'
|
|
63
|
+
dx.xslt = @tags_xsltpath if @tags_xsltpath
|
|
64
|
+
|
|
65
|
+
url = File.join(@urlbase, @todays_filepath)
|
|
66
|
+
dx.create title: raw_entry.sub(/#\s+/,''), url: url
|
|
67
|
+
dx.save filepath
|
|
68
|
+
end
|
|
54
69
|
|
|
55
70
|
end
|
|
56
71
|
|
|
@@ -94,4 +109,4 @@ class LiveBlogPluginDxTags
|
|
|
94
109
|
end
|
|
95
110
|
|
|
96
111
|
|
|
97
|
-
end
|
|
112
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: liveblog-plugin-dxtags
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
N4FNEHt4LyjhMIkH/Dpq5NOxOazGcql9I6CwBisvXhE0cyht9YSUjRO1uDvv6B/g
|
|
32
32
|
c4UKnHyLClIcQQ==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2015-10-
|
|
34
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: dynarex-tags
|
metadata.gz.sig
CHANGED
|
Binary file
|