mindwords 0.8.0 → 0.8.1

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: 1f5bf74dd560883c0f522b3bf9eb94ba34e1655360347bb25871762e4c592cc1
4
- data.tar.gz: 8da5c28a10e9086c72f82eb7615af347da8ec80432249f4716f866c6450b8baf
3
+ metadata.gz: b7201b9f1950ecacaf5bac313bf8dd0c7485efe308829fa8bc73d5fa442cca5e
4
+ data.tar.gz: e61b0229f2c75c11c71f68ba6c0139bd6f5ed8110a78c66da5d66aa6144e84c3
5
5
  SHA512:
6
- metadata.gz: 361eee1873d6b3aa00ccfc415485c86723e28f398b19824d2e9f7b42322304579a9d672db7e4f13b5caa6711fee38028c4a0e361bdddf27451417a77a5476d64
7
- data.tar.gz: 1eb29c350266e6122059017955e2ae615fb8368aec887df5fc6a6ac18aed7d8a3fbfe1ea0cdc6e6fe2050a55d0b7b9cd753e1280d2b101a0a765d9d6d29603fa
6
+ metadata.gz: 5db0ccb709a730e47bdf753aa82956cce15d662f6fa35a8921b6580ecf2624b64b1187b4ce5eaaf5cb63e1e3b437a114097ed85b6945e8a8877451a5706ac4e0
7
+ data.tar.gz: 64826bf627e098697d504116ea6cadd7b93daee1314ebb98506af685d4b600e6e5b990200d8c380ee49d9b1b59b44565aec6feba631b310dcee0db1afec11824
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mindwords.rb CHANGED
@@ -78,10 +78,54 @@ class MindWords
78
78
  s, type = RXFReader.read raws
79
79
 
80
80
  @filepath = raws if type == :file or type == :dfs
81
- lines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
82
- lines.shift if lines.first =~ /<\?mindwords\?>/
81
+ rawlines = (s.strip.gsub(/(^\n|\r)/,'') + "\n").lines.uniq
82
+ rawlines.shift if rawlines.first =~ /<\?mindwords\?>/
83
83
 
84
- @lines = lines.inject([]) do |r,line|
84
+ # remove mindwords lines which don't have a hashtag
85
+ lines = rawlines.reject do |line|
86
+
87
+ found = line[/^\w+[^#]+$/]
88
+
89
+ if found then
90
+ puts ('no hashtag found on this line -> ' + line).warn
91
+ end
92
+
93
+ found
94
+
95
+ end
96
+
97
+ #--- handle indented text, indicated there are *groups* of words
98
+
99
+ s2 = lines.join.gsub(/\n\s*$/,'')
100
+ puts s2 if @debug
101
+ a = s2.strip.split(/(?=^\w+)/)
102
+ a2 = a.inject([]) do |r,x|
103
+
104
+ if x =~ /\n\s+/ then
105
+
106
+ a4 = x.lines[1..-1].map do |line|
107
+
108
+ puts 'x.lines[0]: ' + x.lines[0].inspect if @debug
109
+ hashtag = if x.lines[0][/ /] then
110
+ x.lines[0].gsub(/\b\w/) {|x| x.upcase}.gsub(/ /,'')
111
+ else
112
+ x.lines[0]
113
+ end
114
+
115
+ "%s #%s" % [line.strip, hashtag]
116
+ end
117
+
118
+ r.concat a4
119
+
120
+ else
121
+ r << x
122
+ end
123
+
124
+ end
125
+
126
+ #-- end of indented text handler
127
+
128
+ @lines = a2.inject([]) do |r,line|
85
129
 
86
130
  # the following does 2 things:
87
131
  # 1. splits words separated by a bar (|) onto their own line
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  eUqhPOSrxIRLebVebvo/SHN6+ed3Q1tXowsbLGCT9QwqbaZ5MZ7zks92mIWeJvsA
36
36
  JdpabIXfcOANNKd0ha4NO+Yu
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-16 00:00:00.000000000 Z
38
+ date: 2022-04-08 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: polyrex
metadata.gz.sig CHANGED
Binary file