wiki_md 0.4.2 → 0.5.0
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/wiki_md.rb +61 -22
- data.tar.gz.sig +0 -0
- metadata +6 -6
- 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: 23d30c7bf1b6a100c37547aa1c5ff9e65b8c15cfb764672ed234d02193c63cf2
|
4
|
+
data.tar.gz: aaa03a60bb5698f4973a1bc5482c05e351d23890e6a77c44569250e48ea49dd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad6a1590ee1f11d6572aadcfc6e3125b98a0fee494ccf89dbdb38e162a70ea5a3ba7d9425ce0106e7e8979d26b2407c2a8bb338f8606701fbd34f6d2bedf3917
|
7
|
+
data.tar.gz: d955659c15fa48942c4c0cc5bffff1a4b9e1925957dc1f95ff1839ae6ef0ed20cde55f707b748cc4551463f63c2cbf32c8e8c60e579039304d42935cd270b306
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wiki_md.rb
CHANGED
@@ -21,16 +21,38 @@ class WikiMd
|
|
21
21
|
if wiki then
|
22
22
|
|
23
23
|
s, type = RXFHelper.read(wiki, auto: false)
|
24
|
-
@filename = wiki if type == :file or type == :dfs
|
25
|
-
puts ('s: ' + s.inspect).debug if @debug
|
26
|
-
@dxsx = DxSectionX.new s, debug: debug, autosave: true
|
27
24
|
|
28
|
-
|
25
|
+
if debug then
|
26
|
+
puts [
|
27
|
+
's: ' + s.inspect,
|
28
|
+
'type: ' + type.inspect,
|
29
|
+
's.lines.length: ' + s.lines.length.inspect]\
|
30
|
+
.join("\n").debug
|
31
|
+
puts ('file exists? ' + FileX.exists?(File.dirname(s)).inspect).debug
|
29
32
|
|
30
|
-
|
33
|
+
end
|
31
34
|
|
32
|
-
|
33
|
-
|
35
|
+
if type == :unknown and s.lines.length == 1 and
|
36
|
+
FileX.exists?(File.dirname(s)) then
|
37
|
+
puts 'before new_md()'.debug if debug
|
38
|
+
new_md()
|
39
|
+
@filename = wiki
|
40
|
+
|
41
|
+
elsif type == :file or type == :dfs
|
42
|
+
|
43
|
+
@filename = wiki
|
44
|
+
|
45
|
+
puts ('s: ' + s.inspect).debug if @debug
|
46
|
+
@dxsx = DxSectionX.new s, debug: debug, autosave: true
|
47
|
+
|
48
|
+
@filepath = File.dirname @filename
|
49
|
+
|
50
|
+
indexfile = File.join(@filepath, 'index.xml')
|
51
|
+
|
52
|
+
# check for the index.xml file
|
53
|
+
@dx = load_index(indexfile)
|
54
|
+
|
55
|
+
end
|
34
56
|
|
35
57
|
else
|
36
58
|
|
@@ -63,23 +85,37 @@ class WikiMd
|
|
63
85
|
|
64
86
|
@dxsx.create(x: s2)
|
65
87
|
|
66
|
-
|
88
|
+
record = {title: title + ' #' + tagline.lstrip.split.join(' #'),
|
67
89
|
url: [@base_url, File.basename(@filename)[/.*(?=\.\w+)/],
|
68
|
-
URI.escape(title)].join('/')
|
90
|
+
URI.escape(title)].join('/')}
|
91
|
+
|
92
|
+
@dx.create record
|
69
93
|
FileX.write @filename, @dxsx.to_s if @filename
|
70
|
-
@dxtags.
|
94
|
+
@dxtags.add record
|
71
95
|
|
72
96
|
end
|
73
97
|
|
74
98
|
alias add_section create_section
|
75
99
|
|
76
100
|
def delete_section(q)
|
101
|
+
|
102
|
+
regex = q.is_a?(String) ? /#{q}/i : q
|
103
|
+
r = @dxsx.dx.all.find {|section| section.x.lines.first =~ regex }
|
77
104
|
|
78
|
-
|
105
|
+
return unless r
|
79
106
|
|
80
|
-
|
107
|
+
r.delete
|
108
|
+
|
109
|
+
rx = @dx.all.find {|x| x.title =~ regex}
|
110
|
+
|
111
|
+
return unless rx
|
112
|
+
|
113
|
+
title = rx.title
|
114
|
+
rx.delete
|
115
|
+
@dxtags.delete title
|
116
|
+
puts ('deleted title: ' + title.inspect).debug if @debug
|
81
117
|
|
82
|
-
|
118
|
+
:section_deleted
|
83
119
|
|
84
120
|
end
|
85
121
|
|
@@ -87,8 +123,7 @@ class WikiMd
|
|
87
123
|
|
88
124
|
puts ('WikiMd::find q: ' + q.inspect).debug if @debug
|
89
125
|
return @dxsx.dx.find q if q =~ /^\d+$/
|
90
|
-
|
91
|
-
r = @dxsx.dx.all.find {|section| section.x.lines.first =~ regex }
|
126
|
+
|
92
127
|
puts (' r: ' + r.inspect).debug if @debug
|
93
128
|
return unless r
|
94
129
|
|
@@ -107,6 +142,8 @@ class WikiMd
|
|
107
142
|
|
108
143
|
def new_md(x=nil, title: 'MyWiki')
|
109
144
|
|
145
|
+
puts 'inside new_md'.debug if @debug
|
146
|
+
|
110
147
|
s = nil
|
111
148
|
s, _ = RXFHelper.read(x) if x
|
112
149
|
|
@@ -251,10 +288,11 @@ EOF
|
|
251
288
|
|
252
289
|
if title != @active_heading or tagline2 != tagline1 then
|
253
290
|
|
254
|
-
|
291
|
+
record = {title: @active_heading + ' #' + tagline1.split.join(' #'),
|
255
292
|
url: [@base_url, File.basename(@filename)[/.*(?=\.\w+)/],
|
256
|
-
URI.escape(title)].join('/')
|
257
|
-
|
293
|
+
URI.escape(title)].join('/')}
|
294
|
+
rx.update record
|
295
|
+
@dxtags.add record
|
258
296
|
|
259
297
|
end
|
260
298
|
|
@@ -270,11 +308,12 @@ EOF
|
|
270
308
|
a.length > 1 ? a.map(&:capitalize).join : a.first
|
271
309
|
end
|
272
310
|
|
273
|
-
|
311
|
+
record = {title: @active_heading + ' #' + newtagline,
|
274
312
|
url: [@base_url, File.basename(@filename)[/.*(?=\.\w+)/],
|
275
|
-
URI.escape(@active_heading)].join('/')
|
276
|
-
@
|
277
|
-
|
313
|
+
URI.escape(@active_heading)].join('/')}
|
314
|
+
@dx.create record
|
315
|
+
@dxtags.add record
|
316
|
+
|
278
317
|
end
|
279
318
|
|
280
319
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiki_md
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
nEQURKgvgTAqVg9tuqcjEE861mSCPc+12rmUHVBZDxMDQF6CQbnOxrYRIS+7fnia
|
36
36
|
kikBQtN17cUMyGOrZTVRhVGR
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-11-
|
38
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dxsectionx
|
@@ -63,20 +63,20 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
66
|
+
version: '0.4'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.4.0
|
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: '0.
|
76
|
+
version: '0.4'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
79
|
+
version: 0.4.0
|
80
80
|
description:
|
81
81
|
email: james@jamesrobertson.eu
|
82
82
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|