wikisys 0.3.0 → 0.3.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/wikisys.rb +57 -6
- metadata +2 -2
- 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: e012e479a9c126dbdb7077f87aede11c5393c1ee777f345941ac44388f8ee0db
|
4
|
+
data.tar.gz: d8784d168321d261aed29fc2e0f48d534f39945fcd2b9b9b97a974c49d091db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ead29b9039b19e62300e33941021265837f8ddcc1be96da4050a9f32991f7826727b4ee5e60b1361faa0cc537f004d4fc193d06cea8d1fd911b413dec6d6627
|
7
|
+
data.tar.gz: 3ce9e75cee22a1e6d2e8023a7fb2e694f7d27f65c176cd95d9591bdd625baf5b735c15e5967d1b68992f4f183252f331df81efbbecc07396e8b1eda34b5cc022
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/wikisys.rb
CHANGED
@@ -10,6 +10,7 @@ require 'martile'
|
|
10
10
|
module Wikisys
|
11
11
|
|
12
12
|
class Wiki
|
13
|
+
using ColouredText
|
13
14
|
|
14
15
|
attr_accessor :title, :content, :tags
|
15
16
|
attr_reader :to_xml
|
@@ -19,6 +20,8 @@ module Wikisys
|
|
19
20
|
@filepath = filepath
|
20
21
|
@page = ''
|
21
22
|
@debug = debug
|
23
|
+
|
24
|
+
@hc = HashCache.new(size:30)
|
22
25
|
|
23
26
|
@entries = if entries.is_a? DxLite then
|
24
27
|
|
@@ -36,6 +39,18 @@ module Wikisys
|
|
36
39
|
|
37
40
|
end
|
38
41
|
|
42
|
+
def create_breadcrumb(filepath, links)
|
43
|
+
|
44
|
+
doc = Rexle.new(read_file(filepath))
|
45
|
+
heading = doc.root.element('heading')
|
46
|
+
|
47
|
+
menu = Rexle.new(HtmlCom::Menu.new(:breadcrumb, links).to_html)
|
48
|
+
|
49
|
+
heading.insert_before menu.root
|
50
|
+
write_file filepath, doc.root.xml
|
51
|
+
|
52
|
+
end
|
53
|
+
|
39
54
|
|
40
55
|
def page(title)
|
41
56
|
|
@@ -93,6 +108,10 @@ module Wikisys
|
|
93
108
|
|
94
109
|
end
|
95
110
|
|
111
|
+
def read_file(file='index.html')
|
112
|
+
@hc.read(file) { File.read(file) }
|
113
|
+
end
|
114
|
+
|
96
115
|
private
|
97
116
|
|
98
117
|
def read_md(filename)
|
@@ -100,7 +119,7 @@ module Wikisys
|
|
100
119
|
filepath = File.join(@filepath, 'md', filename)
|
101
120
|
return unless File.exists? filepath
|
102
121
|
|
103
|
-
s =
|
122
|
+
s = read_file(filepath).strip
|
104
123
|
|
105
124
|
# read the title
|
106
125
|
title = s.lines.first.chomp.sub(/^# +/,'')
|
@@ -118,8 +137,7 @@ module Wikisys
|
|
118
137
|
|
119
138
|
end
|
120
139
|
|
121
|
-
end
|
122
|
-
|
140
|
+
end
|
123
141
|
|
124
142
|
def build_xml(title, content, tags)
|
125
143
|
|
@@ -172,12 +190,20 @@ module Wikisys
|
|
172
190
|
def write_xml(title, content)
|
173
191
|
|
174
192
|
filepath = File.join(File.absolute_path(@filepath), 'xml',
|
175
|
-
title.gsub(/ +/,'_') + '.xml')
|
193
|
+
title.downcase.gsub(/ +/,'_') + '.xml')
|
176
194
|
FileUtils.mkdir_p File.dirname(filepath)
|
177
|
-
File.write filepath, content
|
195
|
+
#File.write filepath, content
|
196
|
+
write_file filepath, content
|
178
197
|
|
179
198
|
end
|
180
199
|
|
200
|
+
def write_file(filepath, content)
|
201
|
+
|
202
|
+
puts 'writing file: ' + filepath.inspect if @debug
|
203
|
+
File.write filepath, content
|
204
|
+
@hc.write(filepath) { content }
|
205
|
+
end
|
206
|
+
|
181
207
|
def make_page(title, raw_tags=title.downcase.gsub(/['\.\(\)]/,''))
|
182
208
|
|
183
209
|
tags = raw_tags.split.join(' ')
|
@@ -269,9 +295,29 @@ module Wikisys
|
|
269
295
|
update_mw(pg.title, pg.tags)
|
270
296
|
|
271
297
|
end
|
298
|
+
|
299
|
+
@mw.save if @mw.lines.any?
|
300
|
+
outline_filepath = File.join(@filepath, 'myoutline.txt')
|
301
|
+
|
302
|
+
File.write outline_filepath, @mw.to_outline
|
303
|
+
|
304
|
+
(h[:new] + h[:modified]).each do |filename|
|
305
|
+
|
306
|
+
filepath = File.join(@filepath, 'xml',filename.sub(/\.md$/,'.xml'))
|
307
|
+
s = pg.read_file filepath
|
308
|
+
title = Rexle.new(s).root.text('heading')
|
309
|
+
puts 'about to search title: ' + title.inspect if @debug
|
310
|
+
found = @mw.search(title)
|
311
|
+
|
312
|
+
next unless found
|
313
|
+
|
314
|
+
links = found.breadcrumb.map {|x| [x, x.downcase.gsub(/ +/,'-') + '.html']}
|
315
|
+
pg.create_breadcrumb(filepath, links)
|
316
|
+
|
317
|
+
end
|
272
318
|
|
273
319
|
@entries.save
|
274
|
-
|
320
|
+
|
275
321
|
|
276
322
|
end # /scan_md_files
|
277
323
|
|
@@ -324,5 +370,10 @@ module Wikisys
|
|
324
370
|
end
|
325
371
|
|
326
372
|
end
|
373
|
+
|
374
|
+
def view_file(file='index.html')
|
375
|
+
@hc.read(file) { File.read(file) }
|
376
|
+
end
|
377
|
+
|
327
378
|
end
|
328
379
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikisys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
O3SRDzvvWXrwDFGyRDmGqdEw51FKHPw/6pk4ci0QPIvQEgOyPKfdSesPWmNmtxpf
|
36
36
|
KX/89ohIpftt89vtcCI21R5u
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-01-
|
38
|
+
date: 2021-01-30 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dir-to-xml
|
metadata.gz.sig
CHANGED
Binary file
|