mindwords 0.1.2 → 0.2.0
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/mindwords.rb +22 -5
- metadata +9 -8
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444a04256394031a941df39803aa0026c9c8e4de2ab9fe4796b363b2ba4c5fe8
|
4
|
+
data.tar.gz: 69a11f118b88b738bf489cb5530f359ccb1715ea8c025af7e2a7fec2cc4910a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3fc50a6df2a8c9912a4177174db97e3d36e21c2d5d3ab1389165adb93f9254cfac557953c6229b1de35ff61847463b2bd24539c8e72a0dcd85af02cfaca2e10
|
7
|
+
data.tar.gz: 692a05e1afd552b7e7efc8dd8ef03926d073d16dfaae6f20bcc190dfa1ca931070d78c6d5b1a134648d196edbac16fcac0206f17f554279bd320a9349dbe992e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mindwords.rb
CHANGED
@@ -3,11 +3,12 @@
|
|
3
3
|
# file: mindwords.rb
|
4
4
|
|
5
5
|
require 'rexle'
|
6
|
+
require 'line-tree'
|
6
7
|
|
7
8
|
class MindWords
|
8
9
|
using ColouredText
|
9
10
|
|
10
|
-
def initialize(s, debug: false)
|
11
|
+
def initialize(s, parent: nil, debug: false)
|
11
12
|
|
12
13
|
@debug = debug
|
13
14
|
@a = s.strip.lines
|
@@ -17,7 +18,7 @@ class MindWords
|
|
17
18
|
word = line.split(/ (?=#)/,2)
|
18
19
|
|
19
20
|
end
|
20
|
-
|
21
|
+
|
21
22
|
h = {}
|
22
23
|
|
23
24
|
lines.each do |x|
|
@@ -68,8 +69,15 @@ class MindWords
|
|
68
69
|
redundants.compact.each {|x| doc.element(x).delete }
|
69
70
|
rm_duplicates(doc)
|
70
71
|
|
71
|
-
|
72
|
-
|
72
|
+
node = if parent then
|
73
|
+
found = doc.root.element('//' + parent)
|
74
|
+
found ? found : doc.root
|
75
|
+
else
|
76
|
+
doc.root
|
77
|
+
end
|
78
|
+
|
79
|
+
@xml = node.xml pretty: true
|
80
|
+
@outline = treeize node
|
73
81
|
|
74
82
|
end
|
75
83
|
|
@@ -77,6 +85,8 @@ class MindWords
|
|
77
85
|
|
78
86
|
a = @a.grep(/#{keyword}/i).map do |line|
|
79
87
|
|
88
|
+
puts 'line: ' + line.inspect if @debug
|
89
|
+
|
80
90
|
words = line.split
|
81
91
|
r = words.grep /#{keyword}/i
|
82
92
|
i = words.index r[0]
|
@@ -89,7 +99,8 @@ class MindWords
|
|
89
99
|
#return a[0][0] if a.length < 2
|
90
100
|
|
91
101
|
a2 = a.sort_by(&:last).map(&:first)
|
92
|
-
|
102
|
+
puts 'a2: ' + a2.inspect if @debug
|
103
|
+
MindWords.new(a2.join, parent: keyword, debug: @debug)
|
93
104
|
|
94
105
|
end
|
95
106
|
|
@@ -150,6 +161,10 @@ class MindWords
|
|
150
161
|
end.join("\n")
|
151
162
|
end
|
152
163
|
|
164
|
+
def to_words()
|
165
|
+
to_outline.lines.map {|x| x[/\w[\w ]+/] }
|
166
|
+
end
|
167
|
+
|
153
168
|
def to_xml()
|
154
169
|
@xml
|
155
170
|
end
|
@@ -192,6 +207,7 @@ class MindWords
|
|
192
207
|
duplicates.each do |path, oldpath|
|
193
208
|
e = doc.element(path);
|
194
209
|
e2 = doc.element(oldpath);
|
210
|
+
next unless e2
|
195
211
|
e2.parent.add e
|
196
212
|
e2.delete
|
197
213
|
end
|
@@ -235,3 +251,4 @@ class MindWords
|
|
235
251
|
end
|
236
252
|
|
237
253
|
end
|
254
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mindwords
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,28 +35,28 @@ cert_chain:
|
|
35
35
|
aWH7D2AmhOpqNwWnPHzWR/yzpigAVTrvpHfRxZleQj6Z/090nIH2KR0RdioMmPFq
|
36
36
|
3+574KQzs/gR9Y5a+iMcvHRN
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-01-
|
38
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: line-tree
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '0.9'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 0.9.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '0.9'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 0.9.1
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
@@ -83,7 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.7.10
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: Helps get what's in your mind into a structure using words and hashtags.
|
metadata.gz.sig
CHANGED
Binary file
|