mindwords 0.5.7 → 0.6.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 +52 -7
- metadata +4 -4
- 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: aa290828ca8b921917460e6f8958c8b21d461c269a060e63c6079f57090d7d3e
|
4
|
+
data.tar.gz: e719d8986ece5f93bc994682a02b8f9826f1b5554349b40402d2a699920ba40b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 407b282223460ffb5585e15c5acaa1b377cefb17350b7626680cafd6d4f742a2ab1a0b19223385f74ca332f2830f5cc618e22fff93d6a704a0a3921b18dfb65c
|
7
|
+
data.tar.gz: 1f4c83f14c4e5c2ad51925445edb600a9e60a14482f7b4e057703b8ea980d8e631d5c901ebe49b034db3ce73e7ce0515ef936214e18ba138a93b0aee472f1b93
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mindwords.rb
CHANGED
@@ -29,8 +29,30 @@ class MindWords
|
|
29
29
|
s, type = RXFHelper.read raws
|
30
30
|
|
31
31
|
@filepath = raws if type == :file or type == :dfs
|
32
|
-
|
33
|
-
|
32
|
+
lines = s.strip.gsub(/^\n/,'').lines
|
33
|
+
lines.shift if lines.first =~ /<\?mindwords\?>/
|
34
|
+
|
35
|
+
@lines = lines.inject([]) do |r,line|
|
36
|
+
|
37
|
+
# the following does 2 things:
|
38
|
+
# 1. splits words separated by a bar (|) onto their own line
|
39
|
+
# 2. prefixes a word with an underscore if the word is the
|
40
|
+
# same as the hashtag. That way it's not removed by the
|
41
|
+
# redundancy checker
|
42
|
+
|
43
|
+
raw_words, raw_hashtags = line.split(/(?= #)/,2)
|
44
|
+
words = raw_words.split(/ *\| */)
|
45
|
+
hashtags = raw_hashtags.scan(/(?<=#)\w+/)
|
46
|
+
|
47
|
+
words.each do |word|
|
48
|
+
|
49
|
+
linex = (word + ' ' + raw_hashtags)
|
50
|
+
r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
|
51
|
+
: linex)
|
52
|
+
end
|
53
|
+
|
54
|
+
r
|
55
|
+
end
|
34
56
|
|
35
57
|
end
|
36
58
|
|
@@ -41,6 +63,10 @@ class MindWords
|
|
41
63
|
def breadcrumb()
|
42
64
|
@parent.attributes[:breadcrumb].split(/ +\/ +/) if @parent
|
43
65
|
end
|
66
|
+
|
67
|
+
def headings()
|
68
|
+
breadcrumb[0..-2]
|
69
|
+
end
|
44
70
|
|
45
71
|
|
46
72
|
def element(id)
|
@@ -99,7 +125,7 @@ class MindWords
|
|
99
125
|
|
100
126
|
end
|
101
127
|
|
102
|
-
def search(keyword)
|
128
|
+
def search(keyword, succinct: true)
|
103
129
|
|
104
130
|
a = @lines.grep(/#{keyword}/i).map do |line|
|
105
131
|
|
@@ -120,7 +146,7 @@ class MindWords
|
|
120
146
|
puts 'a2: ' + a2.inspect if @debug
|
121
147
|
e = element(keyword.downcase.gsub(/ +/,'-'))
|
122
148
|
|
123
|
-
return
|
149
|
+
return MindWords.new(a2.uniq.join, debug: @debug) if e.nil?
|
124
150
|
|
125
151
|
# find and add any linkage support lines
|
126
152
|
#
|
@@ -141,8 +167,11 @@ class MindWords
|
|
141
167
|
puts 'a2: ' + a2.inspect if @debug
|
142
168
|
a2.concat a3
|
143
169
|
|
144
|
-
|
145
|
-
|
170
|
+
if succinct then
|
171
|
+
MindWords.new(a2.uniq.join, parent: e, debug: @debug)
|
172
|
+
else
|
173
|
+
MindWords.new(a2.uniq.join, debug: @debug)
|
174
|
+
end
|
146
175
|
|
147
176
|
end
|
148
177
|
|
@@ -310,6 +339,22 @@ class MindWords
|
|
310
339
|
doc.root
|
311
340
|
end
|
312
341
|
|
342
|
+
# the following removes any undescore prefix from words which were the
|
343
|
+
# same as the hashtag
|
344
|
+
|
345
|
+
node.root.each_recursive do |e|
|
346
|
+
|
347
|
+
next unless e
|
348
|
+
puts 'e: ' + e.inspect if @debug
|
349
|
+
|
350
|
+
e.attributes[:id] = e.attributes[:id].sub(/^_/,'') if e.attributes[:id]
|
351
|
+
e.attributes[:title] = e.attributes[:title].sub(/^_/,'') if e.attributes[:title]
|
352
|
+
e.value = e.value.sub(/^_/,'')
|
353
|
+
|
354
|
+
end
|
355
|
+
|
356
|
+
# ----
|
357
|
+
|
313
358
|
@outline = treeize node
|
314
359
|
|
315
360
|
node.root.each_recursive do |e|
|
@@ -372,7 +417,7 @@ class MindWords
|
|
372
417
|
|
373
418
|
duplicates.each do |path|
|
374
419
|
|
375
|
-
puts '
|
420
|
+
puts 'pathx: ' + path.inspect if @debug
|
376
421
|
e = doc.element(path)
|
377
422
|
e.delete if e
|
378
423
|
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
aWH7D2AmhOpqNwWnPHzWR/yzpigAVTrvpHfRxZleQj6Z/090nIH2KR0RdioMmPFq
|
36
36
|
3+574KQzs/gR9Y5a+iMcvHRN
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-04-
|
38
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '0.9'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.9.
|
49
|
+
version: 0.9.2
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0.9'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.9.
|
59
|
+
version: 0.9.2
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rxfhelper
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|