liveblog-plugin-dxtags 0.1.0 → 0.2.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/liveblog-plugin-dxtags.rb +65 -1
- data.tar.gz.sig +0 -0
- metadata +23 -3
- 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: 10ab650d860311f56fe865d5430da84fb1bab11b
|
4
|
+
data.tar.gz: 0bd3fa207c167598847cec64f62b2217471bd2c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f781e9c7bbd373faeaa4f0de2981e0f71790ec5caed5663da7d54f8ef6ec28c87cfbd1701723c715be32ef4c5eb6d707fab6742070b184d6333f1896170586d5
|
7
|
+
data.tar.gz: 4875707baf95bb8f143b3a05a665b301bd9d4f7acda6dc99e166a9624418d65ae0283179720f9c7ca25c33cd42937d1734cf08ba2046b0d9980678fe306438d9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# file: liveblog-plugin-dxtags.rb
|
4
4
|
|
5
|
+
require 'polyrex'
|
5
6
|
require 'dynarex-tags'
|
6
7
|
|
7
8
|
|
@@ -10,6 +11,7 @@ class LiveBlogPluginDxTags
|
|
10
11
|
def initialize(settings: {}, variables: {})
|
11
12
|
|
12
13
|
@parent_filepath = variables[:filepath]
|
14
|
+
@todays_filepath = variables[:todays_filepath]
|
13
15
|
|
14
16
|
end
|
15
17
|
|
@@ -22,11 +24,73 @@ class LiveBlogPluginDxTags
|
|
22
24
|
title.scan(/\B#(\w+)(?=\s|$)/).map do |x|
|
23
25
|
|
24
26
|
hashtag = x.first
|
25
|
-
[hashtag, title, urlpath + '#' + hashtag]
|
27
|
+
[hashtag, title.sub(/#\s+/,''), urlpath + '#' + hashtag]
|
26
28
|
end
|
27
29
|
|
28
30
|
end
|
29
31
|
|
32
|
+
return unless @todays_filepath
|
33
|
+
|
34
|
+
px = Polyrex.new 'tags/tag[label]/entry[title, url]'
|
35
|
+
px.save File.join(@todays_filepath, 'tags-seealso.xml')
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_new_section(raw_entry, hashtag)
|
40
|
+
|
41
|
+
# check the dxtags file for any matching hashtags
|
42
|
+
|
43
|
+
filepath = File.join(@parent_filepath, 'tags', hashtag + '.xml')
|
44
|
+
|
45
|
+
return unless File.exists? filepath
|
46
|
+
|
47
|
+
dx = Dynarex.new filepath
|
48
|
+
recs = dx.to_h
|
49
|
+
|
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 pxfilepath, pretty: true
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def on_doc_update(doc)
|
58
|
+
|
59
|
+
pxfilepath = File.join(@todays_filepath, 'tags-seealso.xml')
|
60
|
+
px = Polyrex.new pxfilepath
|
61
|
+
|
62
|
+
doc.root.xpath('records/section').each do |node|
|
63
|
+
|
64
|
+
r = px.find_by_tag_label node.attributes[:id]
|
65
|
+
|
66
|
+
if r then
|
67
|
+
|
68
|
+
xml = RexleBuilder.new
|
69
|
+
a = xml.aside do
|
70
|
+
|
71
|
+
xml.div do
|
72
|
+
|
73
|
+
xml.h1 'see also'
|
74
|
+
|
75
|
+
xml.ul do
|
76
|
+
|
77
|
+
r.records.each do |record|
|
78
|
+
|
79
|
+
xml.li do
|
80
|
+
xml.a({href: record.url}, record.title)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end # /ul
|
85
|
+
end # /div
|
86
|
+
end # /aside
|
87
|
+
|
88
|
+
node.add_element Rexle.new(a).root
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
30
94
|
end
|
31
95
|
|
32
96
|
|
data.tar.gz.sig
CHANGED
Binary file
|
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.1
|
4
|
+
version: 0.2.1
|
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-
|
34
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex-tags
|
@@ -53,6 +53,26 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.2.3
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: polyrex
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.0.6
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.0'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.6
|
56
76
|
description:
|
57
77
|
email: james@r0bertson.co.uk
|
58
78
|
executables: []
|
@@ -80,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
100
|
version: '0'
|
81
101
|
requirements: []
|
82
102
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.4.
|
103
|
+
rubygems_version: 2.4.8
|
84
104
|
signing_key:
|
85
105
|
specification_version: 4
|
86
106
|
summary: A LiveBlog plugin which creates or updates the hashtags lookup files from
|
metadata.gz.sig
CHANGED
Binary file
|