mindwords 0.6.5 → 0.7.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/lib/mindwords.rb +78 -30
- data.tar.gz.sig +0 -0
- metadata +30 -31
- 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: 0d7be53f70e76eda32325d70cce4e3eb690799b1403440eaff8329929dc4082c
|
4
|
+
data.tar.gz: fa87c01d3bff8ff57506fbb0eb801ff7d881dc2aff607fbc0142e457e658b005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f01791819abc0b4a78b2573c2513b5dc929142a318bf30d0f3c052ea1b654e03d0462c3fddae891be170d23b03d5fa4512dedd5c85b678ac633481d3bdecd798
|
7
|
+
data.tar.gz: b99eec4aa8a9a47c3e73b690727cbcc7bf16a1c0f43699fb399f309c8a752d94c7eb5128c5df998679ea0fdc1eeca14d005954e5476a75e74b0d59ef8ac1181f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mindwords.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# file: mindwords.rb
|
4
4
|
|
5
5
|
require 'rexle'
|
6
|
-
require '
|
6
|
+
require 'rxfreadwrite'
|
7
7
|
require 'line-tree'
|
8
8
|
|
9
9
|
module HashCopy
|
@@ -19,40 +19,16 @@ end
|
|
19
19
|
class MindWords
|
20
20
|
using ColouredText
|
21
21
|
using HashCopy
|
22
|
+
include RXFReadWriteModule
|
22
23
|
|
24
|
+
attr_reader :words_missing
|
23
25
|
attr_accessor :lines, :filepath
|
24
26
|
|
25
27
|
def initialize(raws='', parent: nil, debug: false)
|
26
28
|
|
27
29
|
@parent, @debug = parent, debug
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
@filepath = raws if type == :file or type == :dfs
|
32
|
-
lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
|
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
|
31
|
+
import(raws) if raws.length > 1
|
56
32
|
|
57
33
|
end
|
58
34
|
|
@@ -90,11 +66,42 @@ class MindWords
|
|
90
66
|
found = search(title)
|
91
67
|
found.hashtags() if found
|
92
68
|
else
|
93
|
-
@parent.attributes[:hashtags].split if @parent
|
69
|
+
@parent.attributes[:hashtags].split if @parent and @parent.attributes[:hashtags]
|
94
70
|
end
|
95
71
|
|
96
72
|
end
|
97
73
|
|
74
|
+
def import(raws)
|
75
|
+
|
76
|
+
s, type = RXFHelper.read raws
|
77
|
+
|
78
|
+
@filepath = raws if type == :file or type == :dfs
|
79
|
+
lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
|
80
|
+
lines.shift if lines.first =~ /<\?mindwords\?>/
|
81
|
+
|
82
|
+
@lines = lines.inject([]) do |r,line|
|
83
|
+
|
84
|
+
# the following does 2 things:
|
85
|
+
# 1. splits words separated by a bar (|) onto their own line
|
86
|
+
# 2. prefixes a word with an underscore if the word is the
|
87
|
+
# same as the hashtag. That way it's not removed by the
|
88
|
+
# redundancy checker
|
89
|
+
|
90
|
+
raw_words, raw_hashtags = line.split(/(?= #)/,2)
|
91
|
+
words = raw_words.split(/ *\| */)
|
92
|
+
hashtags = raw_hashtags.scan(/(?<=#)\w+/)
|
93
|
+
|
94
|
+
words.each do |word|
|
95
|
+
|
96
|
+
linex = (word + raw_hashtags)
|
97
|
+
r << (hashtags.include?(word) ? linex.sub!(/\b#{word}\b/, '_\0') \
|
98
|
+
: linex)
|
99
|
+
end
|
100
|
+
|
101
|
+
r
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
98
105
|
# helpful when searching for a word itself using autosuggest
|
99
106
|
#
|
100
107
|
def lookup(s)
|
@@ -119,7 +126,7 @@ class MindWords
|
|
119
126
|
|
120
127
|
puts 'before save' if @debug
|
121
128
|
|
122
|
-
|
129
|
+
FileX.write file, to_s()
|
123
130
|
|
124
131
|
end
|
125
132
|
|
@@ -339,6 +346,7 @@ class MindWords
|
|
339
346
|
|
340
347
|
a = rexlize(h)
|
341
348
|
doc = Rexle.new(['root', {}, '', *a])
|
349
|
+
puts 'doc.xml: ' + doc.xml(pretty: true) if @debug
|
342
350
|
|
343
351
|
# apply node nesting
|
344
352
|
|
@@ -355,6 +363,7 @@ class MindWords
|
|
355
363
|
|
356
364
|
end
|
357
365
|
|
366
|
+
puts 'after nesting; doc.xml: ' + doc.xml(pretty: true) if @debug
|
358
367
|
|
359
368
|
# remove duplicates which appear in the same branch above the nested node
|
360
369
|
rm_duplicates(doc)
|
@@ -402,6 +411,45 @@ class MindWords
|
|
402
411
|
|
403
412
|
@outline = treeize node
|
404
413
|
|
414
|
+
# ----
|
415
|
+
|
416
|
+
# It's common for words to be missing from the outline, either because
|
417
|
+
# they have erroneously been flagged as redundant or lack specific hashtag
|
418
|
+
# context. Below, we attempt to identify the missing words with a
|
419
|
+
# suggestion on how to fix it.
|
420
|
+
|
421
|
+
words = @outline.lines.map(&:strip)
|
422
|
+
orig_words = to_s().lines.map {|x| x[/^[^#]+(?= #)/]}.compact
|
423
|
+
@words_missing = orig_words - words
|
424
|
+
|
425
|
+
if @words_missing.any? then
|
426
|
+
|
427
|
+
tags = []
|
428
|
+
@words_missing.inject(tags) do |r,word|
|
429
|
+
|
430
|
+
found = to_s().lines.grep(/#{word}/)
|
431
|
+
|
432
|
+
if found then
|
433
|
+
r << found.first.scan(/#\w+/).map {|x| x[1..-1]}
|
434
|
+
else
|
435
|
+
r
|
436
|
+
end
|
437
|
+
|
438
|
+
end
|
439
|
+
|
440
|
+
add_sugg = tags.uniq.map do |atag|
|
441
|
+
("%s #%s" % [atag[0], atag[1]]).bg_black
|
442
|
+
end
|
443
|
+
|
444
|
+
puts ('@words_missing: ' + @words_missing.join(', ') ).warn
|
445
|
+
puts "suggestion: try adding the following:".info
|
446
|
+
puts add_sugg.join("\n")
|
447
|
+
puts
|
448
|
+
|
449
|
+
end
|
450
|
+
|
451
|
+
# ----
|
452
|
+
|
405
453
|
node.root.each_recursive do |e|
|
406
454
|
|
407
455
|
e.attributes[:id] = e.attributes[:title].downcase.gsub(/ +/,'-')
|
data.tar.gz.sig
CHANGED
Binary file
|
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.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2J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|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAR1wfQlkrJf5zvVkq5Cl2fcXYKRnhk8N9lxUZPA2Z
|
29
|
+
nXfHed/9gdLpGLQHV91Q0W2taDFDnOpRj3e2dZxdihrJ4qJJ55w9cUgGcpqTjmgE
|
30
|
+
p/5Pxgy25wdHte0URJvy4fnIB0NjVe+pTLENGLhk9O+ktKxfI5b+3ImOHLirfsiM
|
31
|
+
Nt1J9bxPr++9WzOnvOBNpt+dSZE42/mEAoVHCLGp06XSCuj3TRE93TetO5K8Rqrz
|
32
|
+
Gr2rktYjmK75ckHc2Owb7k5q4MhENXDF0w+boTHKwhZ3YZ23ORWBAAe6EWZ5CJif
|
33
|
+
ACsKYTamTZJ1XtnSuwfZJ66HujeZDeDeU4Jn0IWl0Ocpuf5cGdgZdQ/jlA02M4Ev
|
34
|
+
1IAsJkbXAdPHh9mLKUSeH2E1qJ8tg7MFVdBZMkvG4PNXXEk5fzijsrxrXbpY4IgW
|
35
|
+
eUqhPOSrxIRLebVebvo/SHN6+ed3Q1tXowsbLGCT9QwqbaZ5MZ7zks92mIWeJvsA
|
36
|
+
JdpabIXfcOANNKd0ha4NO+Yu
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-03-15 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
@@ -58,25 +58,25 @@ dependencies:
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 0.9.3
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: rxfreadwrite
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '0.2'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 0.2.5
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '0.2'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
79
|
+
version: 0.2.5
|
80
80
|
description:
|
81
81
|
email: digital.robertson@gmail.com
|
82
82
|
executables: []
|
@@ -103,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.7.10
|
106
|
+
rubygems_version: 3.2.22
|
108
107
|
signing_key:
|
109
108
|
specification_version: 4
|
110
109
|
summary: Helps get what's in your mind into a structure using words and hashtags.
|
metadata.gz.sig
CHANGED
Binary file
|