md_edit 0.2.4 → 0.2.5
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/md_edit.rb +10 -6
- metadata +2 -2
- 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: b45b0027d22fba03dc6ebcb44af13f825393cb2a
|
4
|
+
data.tar.gz: 2084acfa0dac9d73741b60c9515ed399a10aab0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 408dc27176617edc2b59cb8e8668aa9d9e97a8b99a5776da18cd353026642663effae63122056ea6416f781666136dfd1805d9285c15a35867b25bbf00cfdbc1
|
7
|
+
data.tar.gz: 8b07998a428345ac47f650495e0c32b90dbd1dc7879ecaccc097b895c3fb185fa465780bc9766622446470a4437e039e5dfe5672567147eee00e11fb677390e6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/md_edit.rb
CHANGED
@@ -37,15 +37,15 @@ class MdEdit
|
|
37
37
|
|
38
38
|
def create(s)
|
39
39
|
|
40
|
-
@s
|
41
|
-
.sub(/(?!=^\n)$/,"\n\n")
|
40
|
+
@s = @s.rstrip + "\n\n" + s.sub(/^(?=\w)/,'## ').sub(/#+ [a-z]/)\
|
41
|
+
{|x| x.upcase}.sub(/(?!=^\n)$/,"\n\n")
|
42
42
|
load_sections(@s)
|
43
43
|
save()
|
44
44
|
|
45
45
|
:created
|
46
46
|
end
|
47
47
|
|
48
|
-
# specify a
|
48
|
+
# specify a heading to delete a section
|
49
49
|
#
|
50
50
|
def delete(s)
|
51
51
|
|
@@ -111,14 +111,18 @@ class MdEdit
|
|
111
111
|
|
112
112
|
results = []
|
113
113
|
|
114
|
-
r = @headingslookup.q s
|
114
|
+
r = @headingslookup.q s
|
115
|
+
puts 'query() r: ' + r.inspect if @debug
|
115
116
|
|
116
117
|
if r and r.any? then
|
117
118
|
|
118
119
|
results = if full_trail then
|
119
120
|
r
|
120
121
|
else
|
121
|
-
r.map
|
122
|
+
r.map do |x|
|
123
|
+
headings = x.split(' > ')
|
124
|
+
headings.length > 1 ? headings[1..-1].join(' > ') : headings[0]
|
125
|
+
end.reject(&:empty?)
|
122
126
|
end
|
123
127
|
|
124
128
|
end
|
@@ -281,7 +285,7 @@ class MdEdit
|
|
281
285
|
h = @sections.keys.inject({}) do |r,x|
|
282
286
|
r.merge(x.sub(/^#+ +/,'').downcase => 5 - x.count('#'))
|
283
287
|
end
|
284
|
-
|
288
|
+
puts 'h: ' + h.inspect if @debug
|
285
289
|
@headingslookup = PhraseLookup.new h
|
286
290
|
@h = h.to_a.map {|k,v| [k.split(' > ').last, v]}.to_h
|
287
291
|
@s = s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md_edit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
R5r1JjTBaaHOaqI14bIkwUSY5q1cO4Wl7HWly80kX2AD8o/tPHvyF9Tx3pBvaboU
|
32
32
|
etnSPHbQwmBvFQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2018-01-14 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: line-tree
|
metadata.gz.sig
CHANGED
Binary file
|