liveblog-plugin-dxtags 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efb162c7c7ff4b6affb49f66fe19b630a641819c
4
- data.tar.gz: 17f3722ede9d0a30160b9346b35e3a034dff91ab
3
+ metadata.gz: 2f7ec79e52d9b5e0a946fd2dfcb007334ae35274
4
+ data.tar.gz: 4ce45910ea036f1a9d30e2770b098d1951f70980
5
5
  SHA512:
6
- metadata.gz: 92e45d0bfbcf69244bdee19dd002a6bbdc6debfdbf2ed1bd33f8ef4dcf611acb2448bd07327a138fa8d541a40bee546696d8de3c99766422cc07a1b3c902c43f
7
- data.tar.gz: f55d61b2034179c210832d4fa146c6696584f2a1106ff52c56a1e720e0c05b6e5f45f207874c15084308d28c0ba5dd84f8fa83316d9d821f8783580c4a33b937
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).generate(filepath) do |section|
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
- return unless File.exists? filepath
49
+ if File.exists? filepath then
46
50
 
47
- dx = Dynarex.new filepath
48
- recs = dx.to_h
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
- pxfilepath = File.join(@todays_filepath, 'tags-seealso.xml')
51
- px = Polyrex.new pxfilepath
52
- px.create.tag( label: hashtag) {|create| recs.each {|h| create.entry h} }
53
- px.save options: {pretty: true}
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.3
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-14 00:00:00.000000000 Z
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