md_edit 0.2.2 → 0.2.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/md_edit.rb +26 -8
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b16174851175e57f2cad74f86b616f1d9e24b9fd
|
4
|
+
data.tar.gz: 72a5ede7446a92694b3dce34f451c49e0a22a5c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda881164fa4a421bb7dce5c545d1d8e6b4e7de60f14461dcf21c3612946d82c0f2ca96e0f4b8fadee35bbc122802a821e630ce21a8ca8259e337b1dfe4a43ce
|
7
|
+
data.tar.gz: 273f5d1d93cf1fad2d1ad4bc663691f4dcb1d335f087d767a1fd804075ae66ed884aa668c88cc87f11202b66c7eab3ab47fbf690d7f8e65ccebbb00172ca67f3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/md_edit.rb
CHANGED
@@ -160,20 +160,38 @@ class MdEdit
|
|
160
160
|
end
|
161
161
|
|
162
162
|
if a2 then
|
163
|
+
|
164
|
+
h = a2.values.flatten(1).group_by {|x| x[/\[[^\]]+\]/]}
|
165
|
+
|
163
166
|
|
164
|
-
phrases_found =
|
165
|
-
|
166
|
-
|
167
|
+
phrases_found = h.to_a.flat_map do |raw_heading,v|
|
168
|
+
|
169
|
+
|
170
|
+
# get rid of results which are almost duplicate (contain a
|
171
|
+
# subset of text from the 1st result)
|
172
|
+
|
173
|
+
phrases = v.map {|x| x[/\] +(.*)/,1]}
|
174
|
+
filtered_phrases = phrases[1..-1].reject {|x| phrases[0].include? x }
|
175
|
+
|
176
|
+
filtered_phrases.unshift(phrases[0])
|
177
|
+
|
178
|
+
# get rid of the top level heading from the heading trailing
|
167
179
|
|
168
|
-
if raw_heading =~ / > / then
|
169
|
-
|
170
|
-
|
180
|
+
heading = if raw_heading =~ / > / then
|
181
|
+
|
182
|
+
raw_heading[1..-2].split(' > ')[1..-1]\
|
183
|
+
.join(' > ')
|
171
184
|
else
|
172
|
-
|
173
|
-
end
|
185
|
+
raw_heading[1..-2]
|
186
|
+
end
|
174
187
|
|
188
|
+
filtered_phrases.map {|phrase| "[%s] %s" % [heading, phrase] }
|
189
|
+
|
175
190
|
end
|
191
|
+
|
192
|
+
|
176
193
|
results.concat phrases_found if phrases_found
|
194
|
+
|
177
195
|
end
|
178
196
|
|
179
197
|
results.take limit
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|