mindwords 0.1.2 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 979c08954b01240d160226705d4d6fd2735bda65542d137766f8448154168d96
4
- data.tar.gz: 38b5068bc8094f08b9225ab5b370274ef80abad45b5acbd1c73ac0dac774b605
3
+ metadata.gz: 444a04256394031a941df39803aa0026c9c8e4de2ab9fe4796b363b2ba4c5fe8
4
+ data.tar.gz: 69a11f118b88b738bf489cb5530f359ccb1715ea8c025af7e2a7fec2cc4910a2
5
5
  SHA512:
6
- metadata.gz: 53bec0cce041880c0daa73fab6a82afa58902f48eabcfef80e7f43d150bd45fb6cae895945f50b90b24532f2acdc6be3962775295ed8446d34b27550ce25f5c5
7
- data.tar.gz: 1c92d7835762bf2b9f2e25fd7d52dc8d159963ad7a950cf3c6f6eb45fc426ba5cde51fa54950335503efe1cf094855b59c2cc0917412b1f176a8951d2cad5feb
6
+ metadata.gz: f3fc50a6df2a8c9912a4177174db97e3d36e21c2d5d3ab1389165adb93f9254cfac557953c6229b1de35ff61847463b2bd24539c8e72a0dcd85af02cfaca2e10
7
+ data.tar.gz: 692a05e1afd552b7e7efc8dd8ef03926d073d16dfaae6f20bcc190dfa1ca931070d78c6d5b1a134648d196edbac16fcac0206f17f554279bd320a9349dbe992e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- @xml = doc.root.xml pretty: true
72
- @outline = treeize doc.root
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
- MindWords.new(a2.join)
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.1.2
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-10 00:00:00.000000000 Z
38
+ date: 2021-01-18 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
- name: rexle
41
+ name: line-tree
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.5'
46
+ version: '0.9'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.5.9
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: '1.5'
56
+ version: '0.9'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.5.9
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
- rubygems_version: 3.0.3
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