wikisys 0.4.4 → 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/wikisys.rb +288 -185
- data.tar.gz.sig +0 -0
- metadata +34 -35
- 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: f85de4628d4264c982a5e1274a431dcc4d83141f02fc00a16a2beae66fb75135
|
4
|
+
data.tar.gz: e0716628f734f05b4ff9cb345399b43f8c04d71120e3a0ed779d737b9fc1fd4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6413d79961cd120efdda28ba31d7646cd7604232f7258a063edc7bf624e1c4ea6ad20fa41a91165b241c9bdd1e440e4d2b36b386cc1e95b9e7977cfe260194de
|
7
|
+
data.tar.gz: 86c00d890331085832453527e6ffe3d6a4d4a53633cce73990ff368dc411b4483e508e1ac3f6c0c3cb3ac92b699826e1a4502d38d2042bea7c6208710247e9c3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wikisys.rb
CHANGED
@@ -7,6 +7,8 @@ require 'dir-to-xml'
|
|
7
7
|
require 'mindwords'
|
8
8
|
require 'martile'
|
9
9
|
require 'hashcache'
|
10
|
+
require 'rxfreadwrite'
|
11
|
+
|
10
12
|
|
11
13
|
module FileFetch
|
12
14
|
|
@@ -42,11 +44,12 @@ end
|
|
42
44
|
|
43
45
|
module Wikisys
|
44
46
|
|
45
|
-
class Wiki
|
47
|
+
class Wiki
|
48
|
+
include RXFReadWrite
|
46
49
|
include FileFetch
|
47
50
|
using ColouredText
|
48
51
|
using StringCase
|
49
|
-
|
52
|
+
|
50
53
|
attr_accessor :title, :content, :tags
|
51
54
|
attr_reader :to_xml
|
52
55
|
|
@@ -55,15 +58,15 @@ module Wikisys
|
|
55
58
|
@filepath = filepath
|
56
59
|
@page = ''
|
57
60
|
@debug = debug
|
58
|
-
|
61
|
+
|
59
62
|
@hc = HashCache.new(size:30)
|
60
63
|
|
61
64
|
@entries = if entries.is_a? DxLite then
|
62
|
-
|
65
|
+
|
63
66
|
entries
|
64
|
-
|
67
|
+
|
65
68
|
elsif File.exists?(entries) then
|
66
|
-
|
69
|
+
|
67
70
|
DxLite.new(entries)
|
68
71
|
|
69
72
|
else
|
@@ -71,256 +74,277 @@ module Wikisys
|
|
71
74
|
DxLite.new('entries/entry(title, tags)')
|
72
75
|
|
73
76
|
end
|
74
|
-
|
77
|
+
|
75
78
|
end
|
76
|
-
|
79
|
+
|
77
80
|
def create_breadcrumb(filepath, links)
|
78
|
-
|
81
|
+
|
79
82
|
doc = Rexle.new(read_file(filepath))
|
80
83
|
heading = doc.root.element('heading')
|
81
|
-
|
84
|
+
|
82
85
|
menu = Rexle.new(HtmlCom::Menu.new(:breadcrumb, links).to_html)
|
83
|
-
|
86
|
+
|
84
87
|
heading.insert_before menu.root
|
85
88
|
write_file filepath, doc.root.xml
|
86
|
-
|
87
|
-
end
|
89
|
+
|
90
|
+
end
|
88
91
|
|
89
92
|
def page(title)
|
90
93
|
|
91
|
-
r = @entries.find_by_title title
|
94
|
+
r = @entries.find_by_title title
|
92
95
|
@page = r ? read_md(title) : make_page(title)
|
93
96
|
@to_xml = build_xml @page
|
94
97
|
@entries.save
|
95
|
-
|
98
|
+
|
96
99
|
return @page
|
97
100
|
|
98
101
|
end
|
99
|
-
|
102
|
+
|
100
103
|
def page=(raw_content)
|
101
|
-
|
104
|
+
|
102
105
|
title = raw_content.lines.first.chomp
|
103
|
-
|
106
|
+
|
104
107
|
r = @entries.find_by_title title
|
105
108
|
make_page(title, raw_content.lines.last.chomp[/(?<=\+ )/]) unless r
|
106
|
-
|
109
|
+
|
107
110
|
write_md title, raw_content
|
108
111
|
title, content, tags = read_md()
|
109
112
|
@to_xml = build_xml title, content, tags
|
110
113
|
write_xml title, @to_xml
|
111
114
|
|
112
|
-
|
115
|
+
|
113
116
|
@entries.save
|
114
117
|
@page = raw_content
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
|
119
|
-
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
def build_xml(filename)
|
123
|
+
|
120
124
|
puts 'inside modify_buld' if @debug
|
121
|
-
|
125
|
+
|
122
126
|
@title, @content, @tags = read_md(filename)
|
123
|
-
|
127
|
+
|
124
128
|
# find the entry
|
125
129
|
# modify the tags if necessary
|
126
130
|
puts '@title: ' + @title.inspect if @debug
|
127
131
|
puts '_ @content: ' + @content.inspect if @debug
|
128
|
-
|
132
|
+
|
129
133
|
r = @entries.find_by_title @title
|
130
134
|
puts 'r: ' + r.inspect if @debug
|
131
|
-
|
135
|
+
|
132
136
|
if r.nil? then
|
133
137
|
r = @entries.create title: @title, tags: @tags.join(' ')
|
134
138
|
end
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
+
|
140
|
+
|
141
|
+
filename = File.basename(filepath.sub(/\.md$/,'.xml'))
|
142
|
+
xmlfile = File.join(@filepath, 'xml', filename)
|
143
|
+
|
144
|
+
write_xml(xmlfile, make_xml(@title, @content, @tags))
|
145
|
+
|
139
146
|
r.tags = @tags.join(' ') if r.tags != @tags
|
140
|
-
|
141
|
-
end
|
142
|
-
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
alias modify_build build_xml
|
151
|
+
|
143
152
|
def new_build(filename)
|
144
|
-
|
145
|
-
@title, @content, @tags = read_md(filename)
|
153
|
+
|
154
|
+
@title, @content, @tags = read_md(filename)
|
146
155
|
@entries.create title: @title, tags: @tags.join(' ')
|
147
156
|
|
148
157
|
puts 'md contents: ' + [@title, @content, @tags].inspect if @debug
|
149
|
-
write_xml(@title, build_xml(@title, @content, @tags))
|
150
|
-
|
158
|
+
write_xml(@title, build_xml(@title, @content, @tags))
|
159
|
+
|
151
160
|
end
|
152
|
-
|
161
|
+
|
162
|
+
# used by wikisys::controler#import_mw
|
163
|
+
#
|
164
|
+
def new_md(filepath, s)
|
165
|
+
|
166
|
+
write_file(filepath, md)
|
167
|
+
#build_xml(filepath)
|
168
|
+
|
169
|
+
#filename = File.basename(filepath.sub(/\.md$/,'.html'))
|
170
|
+
#html_file = File.join(@filepath, 'html', filename)
|
171
|
+
#write_html(html_file)
|
172
|
+
|
173
|
+
end
|
174
|
+
|
153
175
|
def read_file(file='index.html')
|
154
|
-
@hc.read(file) {
|
176
|
+
@hc.read(file) { FileX.read(file) }
|
155
177
|
end
|
156
|
-
|
178
|
+
|
157
179
|
def to_css()
|
158
180
|
fetch_file 'pg.css'
|
159
181
|
end
|
160
|
-
|
182
|
+
|
161
183
|
def write_html(filename)
|
162
184
|
|
163
|
-
|
164
|
-
|
185
|
+
FileX.mkdir_p File.join(@filepath, 'html')
|
186
|
+
|
165
187
|
xml = read_file File.join(@filepath, 'xml', filename)
|
166
188
|
puts 'about to fetch_file' if @debug
|
167
189
|
xsl = fetch_file 'pg.xsl'
|
168
190
|
puts 'xsl: ' + xsl.inspect if @debug
|
169
|
-
|
191
|
+
|
170
192
|
html_file = File.join(@filepath, 'html', filename.sub(/\.xml$/,'.html'))
|
171
193
|
write_file(html_file, transform(xsl, xml))
|
172
194
|
|
173
195
|
end
|
174
|
-
|
196
|
+
|
175
197
|
private
|
176
|
-
|
177
|
-
def read_md(
|
178
|
-
|
179
|
-
filepath = File.join(@filepath, 'md', filename)
|
180
|
-
puts 'filepath : ' + filepath.inspect if @debug
|
198
|
+
|
199
|
+
def read_md(filepath)
|
200
|
+
|
201
|
+
#filepath = File.join(@filepath, 'md', filename)
|
202
|
+
#puts 'filepath : ' + filepath.inspect if @debug
|
181
203
|
return unless File.exists? filepath
|
182
|
-
|
204
|
+
|
183
205
|
s = read_file(filepath).strip.gsub(/\r/,'')
|
184
206
|
puts 's: ' + s.inspect if @debug
|
185
|
-
|
207
|
+
|
186
208
|
# read the title
|
187
209
|
title = s.lines.first.chomp.sub(/^# +/,'')
|
188
|
-
|
210
|
+
|
189
211
|
# read the hashtags if there is any
|
190
212
|
tagsline = s.lines.last[/^ *\+ +(.*)/,1]
|
191
213
|
puts 'tagsline: ' + tagsline.inspect if @debug
|
192
|
-
|
214
|
+
|
193
215
|
if tagsline then
|
194
|
-
|
216
|
+
|
195
217
|
[title, s.lines[1..-2].join, tagsline.split]
|
196
|
-
|
218
|
+
|
197
219
|
else
|
198
|
-
|
220
|
+
|
199
221
|
[title, s.lines[1..-1].join, []]
|
200
|
-
|
222
|
+
|
201
223
|
end
|
202
|
-
|
203
|
-
end
|
204
|
-
|
205
|
-
def
|
206
|
-
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
def make_xml(title, content, rawtags)
|
228
|
+
|
207
229
|
puts 'content: ' + content.inspect if @debug
|
208
230
|
s = content.gsub(/\[\[[^\]]+\]\]/) do |raw_link|
|
209
|
-
|
210
|
-
r = @entries.find_by_title title
|
211
|
-
|
231
|
+
|
232
|
+
r = @entries.find_by_title title
|
233
|
+
|
212
234
|
e = Rexle::Element.new('a').add_text title
|
213
235
|
e.attributes[:href] = title.gsub(/ +/, '_')
|
214
|
-
|
236
|
+
|
215
237
|
if r then
|
216
|
-
|
238
|
+
|
217
239
|
e.attributes[:title] = title.capitalize2
|
218
|
-
|
240
|
+
|
219
241
|
else
|
220
|
-
|
242
|
+
|
221
243
|
make_page(title.capitalize2)
|
222
244
|
e.attributes[:class] = 'new'
|
223
245
|
e.attributes[:title] = title.capitalize2 + ' (page does not exist)'
|
224
|
-
|
246
|
+
|
225
247
|
end
|
226
|
-
|
248
|
+
|
227
249
|
e.xml
|
228
250
|
|
229
|
-
end
|
230
|
-
|
231
|
-
|
251
|
+
end
|
252
|
+
|
253
|
+
|
232
254
|
heading = "<heading>%s</heading>" % title
|
233
|
-
|
255
|
+
|
234
256
|
if rawtags.any? then
|
235
|
-
|
257
|
+
|
236
258
|
list = tags.map {|tag| " <tag>%s</tag>" % tag}
|
237
259
|
tags = "<tags>\n%s\n </tags>" % list.join("\n")
|
238
|
-
|
260
|
+
|
239
261
|
body = "<body>\n %s </body>" % \
|
240
262
|
Martile.new(s.lines[1..-2].join.strip).to_html
|
241
|
-
|
263
|
+
|
242
264
|
else
|
243
|
-
|
265
|
+
|
244
266
|
body = "<body>%s</body>" % Martile.new(s.lines[1..-1].join.strip).to_html
|
245
267
|
tags = ''
|
246
268
|
|
247
269
|
end
|
248
|
-
|
270
|
+
|
249
271
|
"<article id='%s'>\n %s\n %s\n %s\n</article>" % \
|
250
272
|
[title.gsub(/ +/,'-'), heading, body, tags]
|
251
|
-
|
252
|
-
|
273
|
+
|
274
|
+
|
253
275
|
end
|
254
|
-
|
255
|
-
|
276
|
+
|
277
|
+
|
256
278
|
def transform(xsl, xml)
|
257
279
|
|
258
280
|
doc = Nokogiri::XML(xml)
|
259
281
|
xslt = Nokogiri::XSLT(xsl)
|
260
282
|
|
261
|
-
xslt.transform(doc)
|
262
|
-
|
263
|
-
end
|
264
|
-
|
283
|
+
xslt.transform(doc)
|
284
|
+
|
285
|
+
end
|
286
|
+
|
265
287
|
def write_xml(s, content)
|
266
|
-
|
288
|
+
|
267
289
|
filename = s =~ /\.xml$/ ? s : s.gsub(/ +/,'_') + '.xml'
|
268
290
|
filepath = File.join(File.absolute_path(@filepath), 'xml', filename)
|
269
|
-
|
270
|
-
#
|
291
|
+
FileX.mkdir_p File.dirname(filepath)
|
292
|
+
#FileX.write filepath, content
|
271
293
|
write_file filepath, content
|
272
|
-
|
273
|
-
end
|
274
|
-
|
294
|
+
|
295
|
+
end
|
296
|
+
|
275
297
|
def write_file(filepath, content)
|
276
|
-
|
298
|
+
|
277
299
|
puts 'writing file: ' + filepath.inspect if @debug
|
278
|
-
|
279
|
-
@hc.write(filepath) { content }
|
300
|
+
FileX.write filepath, content
|
301
|
+
@hc.write(filepath) { content }
|
280
302
|
end
|
281
|
-
|
303
|
+
|
282
304
|
def make_page(title, raw_tags=title.downcase.gsub(/['\.\(\)]/,''))
|
283
|
-
|
305
|
+
|
284
306
|
tags = raw_tags.split.join(' ')
|
285
307
|
s = "#{title}\n\n\n+ " + tags
|
286
308
|
write_md title, s
|
287
309
|
write_xml title, build_xml(s)
|
288
|
-
|
289
|
-
@entries.create title: title, tags: tags
|
290
|
-
|
310
|
+
|
311
|
+
@entries.create title: title, tags: tags
|
312
|
+
@title, @content, @tags = title, '', tags
|
313
|
+
|
291
314
|
return s
|
292
|
-
|
293
|
-
end
|
294
|
-
|
315
|
+
|
316
|
+
end
|
317
|
+
|
295
318
|
def read_md_file(filename)
|
296
|
-
|
319
|
+
|
297
320
|
filepath = File.join(@filepath, 'md', filename)
|
298
|
-
|
299
|
-
|
321
|
+
FileX.read(filepath)
|
322
|
+
|
300
323
|
end
|
301
|
-
|
302
|
-
def
|
303
|
-
|
324
|
+
|
325
|
+
def write_md_to_be_deleted(title, content)
|
326
|
+
|
304
327
|
puts 'inside write_md' if @debug
|
305
328
|
filename = s =~ /\.md$/ ? s : s.gsub(/ +/,'_') + '.md'
|
306
329
|
filepath = File.join(File.absolute_path(@filepath), 'md', filename)
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
end
|
311
|
-
|
330
|
+
FileX.mkdir_p File.dirname(filepath)
|
331
|
+
FileX.write filepath, content
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
|
312
336
|
end
|
313
|
-
|
337
|
+
|
314
338
|
class Pages
|
315
|
-
|
339
|
+
|
316
340
|
attr_accessor :mw, :entries
|
317
341
|
|
318
342
|
def initialize(filepath='.', debug: false)
|
319
|
-
|
343
|
+
|
320
344
|
@filepath, @debug = filepath, debug
|
321
|
-
|
322
|
-
entries_file = File.join(@filepath, 'entries.
|
323
|
-
|
345
|
+
|
346
|
+
entries_file = File.join(@filepath, 'entries.xml')
|
347
|
+
|
324
348
|
if File.exists?(entries_file) then
|
325
349
|
@entries = DxLite.new(entries_file)
|
326
350
|
else
|
@@ -330,48 +354,84 @@ module Wikisys
|
|
330
354
|
|
331
355
|
# check for the mindwords raw document file
|
332
356
|
mindwords_file = File.join(@filepath, 'mindwords.txt')
|
333
|
-
|
334
|
-
if File.exists?(mindwords_file) then
|
357
|
+
|
358
|
+
if File.exists?(mindwords_file) then
|
335
359
|
@mw = MindWords.new(mindwords_file)
|
336
360
|
else
|
337
361
|
@mw = MindWords.new
|
338
362
|
@mw.filepath = mindwords_file
|
339
363
|
end
|
340
|
-
|
364
|
+
|
341
365
|
@pg = Wiki.new @filepath, entries: @entries, debug: @debug
|
342
|
-
|
366
|
+
|
343
367
|
#scan_md_files()
|
344
|
-
|
368
|
+
|
345
369
|
end
|
346
|
-
|
370
|
+
|
371
|
+
def import_mw(obj=File.join(@filepath, 'mindwords.txt'))
|
372
|
+
|
373
|
+
s, _ = RXFReader.read(obj)
|
374
|
+
|
375
|
+
@mw = MindWords.new(s)
|
376
|
+
FileX.write 'outline.txt', @mw.to_outline
|
377
|
+
|
378
|
+
FileX.mkdir_p 'md'
|
379
|
+
FileX.mkdir_p 'html'
|
380
|
+
|
381
|
+
@mw.to_words.each do |title, attributes|
|
382
|
+
|
383
|
+
breadcrumb, hashtags = attributes.values
|
384
|
+
|
385
|
+
s = "# %s\n\n\n" % title.capitalize2
|
386
|
+
s += '+ ' + hashtags if hashtags.strip.length > 0
|
387
|
+
|
388
|
+
file = File.join(@filepath, 'md', title.capitalize2.gsub(/ +/,'-') \
|
389
|
+
+ '.md')
|
390
|
+
|
391
|
+
if not File.exists?(file) then
|
392
|
+
|
393
|
+
@pg.new_md(file, s)
|
394
|
+
|
395
|
+
end
|
396
|
+
|
397
|
+
end
|
398
|
+
|
399
|
+
#gen_html_files()
|
400
|
+
gen_sidenav()
|
401
|
+
end
|
402
|
+
|
403
|
+
# creates a new page from an existing Markdown file
|
404
|
+
#
|
347
405
|
def new_pg(filename)
|
348
|
-
|
406
|
+
|
349
407
|
@pg.new_build(filename)
|
350
408
|
@entries.save
|
351
|
-
|
409
|
+
|
352
410
|
update_mw(@pg.title, @pg.tags)
|
353
|
-
@mw.save if @mw.lines.any?
|
354
|
-
|
411
|
+
@mw.save if @mw.lines.any?
|
412
|
+
|
355
413
|
build_html(filename)
|
356
|
-
|
414
|
+
|
357
415
|
end
|
358
|
-
|
416
|
+
|
417
|
+
# refreshes an existing page from an existing Markdown file
|
418
|
+
#
|
359
419
|
def update_pg(filename)
|
360
|
-
|
420
|
+
|
361
421
|
@pg.modify_build(filename)
|
362
422
|
@entries.save
|
363
|
-
|
423
|
+
|
364
424
|
update_mw(@pg.title, @pg.tags)
|
365
|
-
@mw.save if @mw.lines.any?
|
366
|
-
|
425
|
+
@mw.save if @mw.lines.any?
|
426
|
+
|
367
427
|
build_html(filename)
|
368
|
-
|
369
|
-
end
|
370
|
-
|
371
|
-
private
|
428
|
+
|
429
|
+
end
|
430
|
+
|
431
|
+
private
|
372
432
|
|
373
433
|
def build_html(filename)
|
374
|
-
|
434
|
+
|
375
435
|
xml_file = filename.sub(/\.md$/,'.xml')
|
376
436
|
filepath = File.join(@filepath, 'xml', xml_file)
|
377
437
|
s = @pg.read_file filepath
|
@@ -388,96 +448,139 @@ module Wikisys
|
|
388
448
|
@pg.create_breadcrumb(filepath, links)
|
389
449
|
|
390
450
|
end
|
391
|
-
|
451
|
+
|
392
452
|
@pg.write_html xml_file
|
393
|
-
|
453
|
+
|
394
454
|
end
|
395
|
-
|
455
|
+
|
396
456
|
# Check if any of the md files have been modified or newly created
|
397
457
|
#
|
398
458
|
def scan_md_files()
|
399
|
-
|
459
|
+
|
400
460
|
filepath = File.join(@filepath, 'md')
|
401
461
|
puts 'about to scan ' + filepath.inspect if @debug
|
402
462
|
dir = DirToXML.new(filepath, index: 'dir.json', debug: @debug)
|
403
463
|
h = dir.activity
|
404
464
|
puts 'h: ' + h.inspect if @debug
|
405
|
-
|
465
|
+
|
406
466
|
return if (h[:new] + h[:modified]).empty?
|
407
|
-
|
467
|
+
|
408
468
|
h[:new].each {|filename| new_pg(filename) }
|
409
469
|
h[:modified].each {|filename| update_pg(filename) }
|
410
470
|
|
411
|
-
@mw.save if @mw.lines.any?
|
471
|
+
@mw.save if @mw.lines.any?
|
412
472
|
outline_filepath = File.join(@filepath, 'myoutline.txt')
|
413
|
-
|
414
|
-
|
415
|
-
|
473
|
+
|
474
|
+
FileX.write outline_filepath, @mw.to_outline
|
475
|
+
|
416
476
|
(h[:new] + h[:modified]).each do |filename|
|
417
|
-
|
477
|
+
|
418
478
|
build_html filename
|
419
|
-
|
479
|
+
|
420
480
|
end
|
421
|
-
|
481
|
+
|
422
482
|
@entries.save
|
423
483
|
|
424
|
-
|
425
|
-
end # /scan_md_files
|
426
|
-
|
484
|
+
|
485
|
+
end # /scan_md_files
|
486
|
+
|
427
487
|
def update_mw(title, line_tags)
|
428
|
-
|
488
|
+
|
429
489
|
# read the file
|
430
490
|
|
431
491
|
tags = line_tags.reject {|x| x =~ /#{title.strip}/i}
|
432
492
|
puts 'tags: ' + tags.inspect if @debug
|
433
493
|
puts 'title: ' + title.inspect if @debug
|
434
|
-
|
494
|
+
|
435
495
|
return if tags.empty?
|
436
|
-
|
496
|
+
|
437
497
|
line = title + ' ' + tags.map {|x| "#" + x }.join(' ') + "\n"
|
438
498
|
puts 'line: ' + line.inspect if @debug
|
439
|
-
|
499
|
+
|
440
500
|
# does the tagsline contain the topic hashtag?
|
441
|
-
|
501
|
+
|
442
502
|
#if tagsline =~ /#/ # not yet implemented
|
443
|
-
|
444
503
|
|
445
|
-
|
504
|
+
|
505
|
+
|
446
506
|
# check if the title already exists
|
447
507
|
found = @mw.lines.grep(/^#{title} +(?=#)/i)
|
448
|
-
|
508
|
+
|
449
509
|
if found.any? then
|
450
|
-
|
510
|
+
|
451
511
|
found_tags = found.first.scan(/(?<=#)\w+/)
|
452
|
-
|
512
|
+
|
453
513
|
if @debug then
|
454
|
-
|
514
|
+
|
455
515
|
puts 'tags: ' + tags.inspect
|
456
516
|
puts 'found_tags: ' + found_tags.inspect
|
457
|
-
|
517
|
+
|
458
518
|
end
|
459
519
|
|
460
|
-
new_tags = tags - found_tags
|
461
|
-
|
520
|
+
new_tags = tags - found_tags
|
521
|
+
|
462
522
|
# add the new tags to the mindwords line
|
463
|
-
|
523
|
+
|
464
524
|
hashtags = (found_tags + new_tags).map {|x| '#' + x }.join(' ')
|
465
525
|
|
466
526
|
i = @mw.lines.index(found.first)
|
467
527
|
@mw.lines[i] = line
|
468
|
-
|
528
|
+
|
469
529
|
else
|
470
|
-
|
530
|
+
|
471
531
|
@mw.lines << line
|
472
|
-
|
473
|
-
end
|
474
|
-
|
532
|
+
|
533
|
+
end
|
534
|
+
|
475
535
|
end
|
476
536
|
|
477
|
-
|
537
|
+
|
478
538
|
def view_file(file='index.html')
|
479
|
-
@hc.read(file) {
|
539
|
+
@hc.read(file) { FileX.read(file) }
|
480
540
|
end
|
481
541
|
|
482
542
|
end
|
543
|
+
|
544
|
+
class Controller
|
545
|
+
using StringCase
|
546
|
+
|
547
|
+
def initialize(filepath: '.')
|
548
|
+
@filepath = filepath
|
549
|
+
|
550
|
+
@pages = Pages.new filepath
|
551
|
+
|
552
|
+
end
|
553
|
+
|
554
|
+
def import_mw(obj)
|
555
|
+
|
556
|
+
s, _ = RXFReader.read(obj)
|
557
|
+
|
558
|
+
@mw = MindWords.new(s)
|
559
|
+
FileX.write 'outline.txt', @mw.to_outline
|
560
|
+
|
561
|
+
FileX.mkdir_p 'md'
|
562
|
+
FileX.mkdir_p 'html'
|
563
|
+
|
564
|
+
@mw.to_words.each do |title, attributes|
|
565
|
+
|
566
|
+
breadcrumb, hashtags = attributes.values
|
567
|
+
|
568
|
+
s = "# %s\n\n\n" % title.capitalize2
|
569
|
+
s += '+ ' + hashtags if hashtags.strip.length > 0
|
570
|
+
|
571
|
+
file = File.join(@filepath, 'md', title.capitalize2.gsub(/ +/,'-') \
|
572
|
+
+ '.md')
|
573
|
+
|
574
|
+
if not File.exists?(file) then
|
575
|
+
|
576
|
+
pg.new_md(file, s)
|
577
|
+
|
578
|
+
end
|
579
|
+
|
580
|
+
end
|
581
|
+
|
582
|
+
#gen_html_files()
|
583
|
+
gen_sidenav()
|
584
|
+
end
|
585
|
+
end
|
483
586
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIyMjEzMzQxWhcN
|
15
|
+
MjMwMjIyMjEzMzQxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDRiQLq
|
17
|
+
puh4qyyeKj1si9k9FvQtqHvLBOQv4a6fpgXS3nP4UX+kRLzVo3A97Dn5gVT9N5IN
|
18
|
+
1GJsd3KbKmg40OadufO2S5dorxi8y0dgoQSDTSteuSBhL5k8//xkVNJORF2eS76l
|
19
|
+
JeygpkzyME3K0pyJyLr7DPYyn+L/DA53O7E7fOj41SyxsIcV2STdGgAhq2QWGCsG
|
20
|
+
AUXG/E1V+x0LcDHHsJN+pJar1P8wmPGfkO1+8TsiuM/bqdb+lfQYW6ZCap5gGD5G
|
21
|
+
ghbBkiT5fQTZhSQouMMX7aGBVLS4AH4WEuqNDlhn6KVrTzzav6sPWNJlcB6kVoGK
|
22
|
+
f/pxjrouI2aTEvq2FHHkxzPnExJcI9nwHSrwSnyV1EkE4+AzhXyebWFFEbS8aUTq
|
23
|
+
2eOvd+SXLVW0KHG7e+usEUKmh0bo7VuCswyYpK3cJyOjqL9f45PoA7uB3u1MLCFM
|
24
|
+
uJk+/tlv1B+JlwiD2onaYQ0vgdk/ASbly/uwVOqwSE+jUoN/tnVFbvKh/R8CAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUJOXLMzXq
|
26
|
+
isNrleM8MNYcSpSSpI4wJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
27
|
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAUScfjIQE/XDR375JHpT7UkOwScGbHaur2yiiPUNp
|
29
|
+
/JGz17UZsvjDh0mzKXMrMFzMbc1UxH/fa7bftxdz4iuGgyPc5XYlhVQoDlxAtUH+
|
30
|
+
1lq8REPE8ZFYWrk+isfZ1l9wVqZbySdJRFpksZpCzUubWMN2L3ofqRPS2de56N/o
|
31
|
+
XDptO95tt4d3Wtx1PIK+t79oMyDukDjYDsADsqrga2ImELpWTBkOImDIphN4Rp0k
|
32
|
+
lDL/fySls4YVl/kl5lIA2zxp/hoOx5FP43b6aw/680YratTYNkDj8c6zXbpGDWLS
|
33
|
+
ibey6S+qwMAEDVNrfqNYWdYBUFMWKEmUKEWMecBL2+tFyaUku4e3kh4zccZfDfTc
|
34
|
+
fE/2EbG6iF6ibG9d5x7+I1gZ+L/3pbXp0vZ/mTKAZ72lB9PgbF1YsJX7Zi7fgJBr
|
35
|
+
tlrSOGB1I3nWz/uvurJuTFG0W9bre5ZoWbnTuk1D1hNCzr3H5M+rB1bKG+kmeFJi
|
36
|
+
hVN4NL4V8O7Nw12AplEAzA+r
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dir-to-xml
|
@@ -43,20 +43,20 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.2'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.2.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '1.
|
56
|
+
version: '1.2'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
59
|
+
version: 1.2.1
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: mindwords
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,20 +83,20 @@ dependencies:
|
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: '1.
|
86
|
+
version: '1.5'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.5.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.5'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.
|
99
|
+
version: 1.5.0
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: hashcache
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 0.2.10
|
120
120
|
description:
|
121
|
-
email:
|
121
|
+
email: digital.robertson@gmail.com
|
122
122
|
executables: []
|
123
123
|
extensions: []
|
124
124
|
extra_rdoc_files: []
|
@@ -145,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.7.10
|
148
|
+
rubygems_version: 3.2.22
|
150
149
|
signing_key:
|
151
150
|
specification_version: 4
|
152
151
|
summary: A poor man's wiki.
|
metadata.gz.sig
CHANGED
Binary file
|