wikimindcards_directory 0.2.0 → 0.4.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/wikimindcards_directory.rb +420 -222
- data.tar.gz.sig +0 -0
- metadata +75 -15
- 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: 4c73853e1988635ec5bd4d214541e3f32ab3c78cac54a48bbb4c89d306fe5483
|
4
|
+
data.tar.gz: d3421352cf733e13d3608b1d308dc9e3576e967e47fd1f9b1ac9989dc2a255f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c75ba1587542cae52f69342fe70c65e251dbcb9224b978f9d09487cd16dcbe84d0eaef7024ba0a8903dfb11f19d458ca3bcdb09bdafcb64a2979ad217a979dd
|
7
|
+
data.tar.gz: 6caa85c24c17fd462f530234ab94e6c498d34eab46612a7407c5c13742176bc28567b73fba544f4daf029241aa3a604e2021d1c07d4c93afb13b08f387472fd3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -9,328 +9,526 @@ require 'mindwords'
|
|
9
9
|
require 'polyrex-links'
|
10
10
|
require 'jstreebuilder'
|
11
11
|
require 'martile'
|
12
|
+
require 'onedrb'
|
13
|
+
require 'hashcache'
|
14
|
+
require 'dxlite'
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
KVX_XSL =<<EOF
|
19
|
+
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
20
|
+
<xsl:output method="xml" omit-xml-declaration="yes" />
|
21
|
+
|
22
|
+
<xsl:template match='*'>
|
23
|
+
|
24
|
+
<xsl:apply-templates select='summary' />
|
25
|
+
|
26
|
+
<xsl:element name='div'>
|
27
|
+
<!--
|
28
|
+
<xsl:attribute name='created'>
|
29
|
+
<xsl:value-of select='@created'/>
|
30
|
+
</xsl:attribute>
|
31
|
+
<xsl:attribute name='last_modified'>
|
32
|
+
<xsl:value-of select='@last_modified'/>
|
33
|
+
</xsl:attribute>
|
34
|
+
-->
|
35
|
+
<xsl:apply-templates select='body' />
|
36
|
+
|
37
|
+
<a href="editcard?title={summary/title}">edit</a>
|
38
|
+
|
39
|
+
</xsl:element>
|
40
|
+
|
41
|
+
</xsl:template>
|
42
|
+
|
43
|
+
<xsl:template match='summary'>
|
44
|
+
|
45
|
+
<h1>
|
46
|
+
<xsl:value-of select='title' />
|
47
|
+
</h1>
|
48
|
+
|
49
|
+
</xsl:template>
|
50
|
+
|
51
|
+
|
52
|
+
<xsl:template match='body'>
|
53
|
+
|
54
|
+
<ul>
|
55
|
+
|
56
|
+
<li><label>info: </label> <xsl:copy-of select='desc' /></li>
|
57
|
+
<li><label>url: </label> <xsl:value-of select='url' /></li>
|
58
|
+
<xsl:element name='li'>
|
59
|
+
<xsl:attribute name='class'><xsl:value-of select='wiki/@class' /></xsl:attribute>
|
60
|
+
<label>wiki: </label> <xsl:copy-of select='wiki' />
|
61
|
+
</xsl:element>
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
|
65
|
+
</xsl:template>
|
66
|
+
|
67
|
+
</xsl:stylesheet>
|
68
|
+
EOF
|
12
69
|
|
13
70
|
class WikiMindCardsDirectory
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
71
|
+
include RXFReadWriteModule
|
72
|
+
|
73
|
+
class MindWordsX < MindWords
|
74
|
+
include RXFReadWriteModule
|
75
|
+
|
76
|
+
def initialize(dir, s='')
|
77
|
+
|
78
|
+
@dir = dir
|
79
|
+
super(s)
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
def edit()
|
84
|
+
|
85
|
+
%Q(<form action="fileupdate" method="post">
|
86
|
+
<textarea name="treelinks" cols="73" rows="17">#{self.to_s}</textarea>
|
87
|
+
<input type="submit" value="apply"/>
|
88
|
+
</form>
|
89
|
+
)
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
def import(s='')
|
95
|
+
|
96
|
+
super(s)
|
97
|
+
|
98
|
+
FileX.mkdir_p File.join(@dir, 'data')
|
99
|
+
mindwords_file = File.join(@dir, 'data', 'mindwords.txt')
|
100
|
+
self.save mindwords_file
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
class PxLinks < PolyrexLinks
|
107
|
+
include RXFReadWriteModule
|
108
|
+
|
109
|
+
def initialize(dir, raws)
|
110
|
+
|
111
|
+
@dir = dir
|
112
|
+
|
113
|
+
if raws.lines.length > 1 then
|
114
|
+
|
115
|
+
s = if raws.lstrip.lines.first =~ /<\?polyrex/ then
|
116
|
+
raws
|
117
|
+
else
|
118
|
+
"<?polyrex-links?>\n\n" + raws
|
119
|
+
end
|
120
|
+
|
121
|
+
super(s)
|
122
|
+
|
123
|
+
outline_xml = File.join(@dir, 'data', 'outline.xml')
|
124
|
+
save outline_xml
|
125
|
+
|
126
|
+
elsif raws.length > 1
|
127
|
+
|
128
|
+
# it must be a filename
|
129
|
+
|
130
|
+
if FileX.exists? raws then
|
131
|
+
super(raws)
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
def linkedit(rawtitle)
|
139
|
+
|
140
|
+
r = find_by_link_title rawtitle
|
141
|
+
return 'title not found' unless r
|
142
|
+
|
143
|
+
"<form action='updatelink' type='post'>
|
144
|
+
<input type='hidden' name='title' value='#{r.title}'/>
|
145
|
+
<input type='input' name='url' value='#{r.url}'/>
|
146
|
+
<input type='submit' value='apply'/>
|
147
|
+
</form>
|
148
|
+
"
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
def linkupdate(rawtitle, rawurl)
|
153
|
+
|
154
|
+
r = find_by_link_title rawtitle
|
155
|
+
return unless r
|
156
|
+
|
157
|
+
r.url = rawurl
|
158
|
+
|
159
|
+
outline_xml = File.join(@dir, 'data', 'outline.xml')
|
160
|
+
save outline_xml
|
161
|
+
|
162
|
+
# ... also save it to the associated card (kvx document).
|
163
|
+
|
164
|
+
title = rawtitle.downcase.gsub(/ +/,'-')
|
165
|
+
file = title + '.txt'
|
166
|
+
filepath = File.join(@dir, file)
|
167
|
+
|
168
|
+
kvx = Kvx.new filepath
|
169
|
+
kvx.url = rawurl
|
170
|
+
kvx.save filepath
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
def indexview(base_url='')
|
175
|
+
|
176
|
+
a = index()
|
177
|
+
|
178
|
+
raw_links = a.map do |title, rawurl, path|
|
179
|
+
|
180
|
+
anchortag = if rawurl.empty? then
|
181
|
+
"<a href='%seditcard?title=%s' style='color: red'>%s</a>" % [base_url, title, title]
|
182
|
+
else
|
183
|
+
"<a href='%sviewcard?title=%s'>%s</a>" % [base_url, title, title]
|
184
|
+
end
|
185
|
+
[title, anchortag]
|
186
|
+
|
36
187
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
188
|
+
|
189
|
+
links = raw_links.to_h
|
190
|
+
|
191
|
+
a2 = a.map do |title, rawurl, rawpath|
|
192
|
+
|
193
|
+
path = rawpath[0..-2].reverse.map {|x| links[x]}.join('/')
|
194
|
+
"<tr><td>%s</td><td>%s</td></tr>" % [links[title], path]
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
"<table>#{a2.join("\n")}</table>"
|
199
|
+
end
|
200
|
+
|
201
|
+
def outlinefile_edit()
|
202
|
+
|
203
|
+
%Q(<form action="fileupdate" method="post">
|
204
|
+
<textarea name="treelinks" cols="73" rows="17">#{self.to_s}</textarea>
|
205
|
+
<input type="submit" value="apply"/>
|
206
|
+
</form>
|
207
|
+
)
|
208
|
+
|
40
209
|
end
|
41
|
-
|
210
|
+
|
211
|
+
def tree_edit()
|
212
|
+
|
213
|
+
links = PxLinks.new(@dir, self.to_s)
|
214
|
+
base_url = 'linkedit?title='
|
215
|
+
links.each_recursive { |x| x.url = base_url + x.title }
|
216
|
+
jtb = JsTreeBuilder.new({src: links, type: :plain, debug: false})
|
217
|
+
|
218
|
+
style = "
|
219
|
+
<style>
|
220
|
+
.newspaper1 {
|
221
|
+
columns: 100px 3;
|
222
|
+
}
|
223
|
+
ul {list-style-type: none; background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 1.3em}
|
224
|
+
ul li {background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 0.3em}
|
225
|
+
</style>
|
226
|
+
"
|
227
|
+
html = "<div class='newspaper1'>#{jtb.to_html}</div>"
|
228
|
+
style + "\n" + html
|
229
|
+
end
|
230
|
+
|
231
|
+
def treeview()
|
232
|
+
|
233
|
+
jtb = JsTreeBuilder.new({src: self, type: :plain, debug: false})
|
234
|
+
jtb.links {|x| x.attributes[:target] = 'icontent'}
|
235
|
+
html = "<div class='newspaper2'>#{jtb.to_html}</div>"
|
236
|
+
|
237
|
+
style = "
|
238
|
+
<style>
|
239
|
+
.newspaper1 {
|
240
|
+
columns: 100px 3;
|
241
|
+
}
|
242
|
+
ul {list-style-type: none; background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 1.3em}
|
243
|
+
ul li {background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 0.3em}
|
244
|
+
</style>
|
245
|
+
"
|
246
|
+
|
247
|
+
style + "\n" + html
|
248
|
+
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
class Card
|
42
253
|
end
|
43
|
-
|
254
|
+
|
255
|
+
# the directory being read should be the root directory of the
|
256
|
+
# project data store
|
257
|
+
#
|
258
|
+
def initialize(dir: '.', dxpath: nil, debug: false)
|
259
|
+
|
260
|
+
@dir = dir
|
261
|
+
@dxpath = dxpath
|
262
|
+
@debug = debug
|
263
|
+
|
264
|
+
# attempt to read the mindwords and outline (polyrex-links) files
|
265
|
+
#
|
266
|
+
read()
|
267
|
+
|
268
|
+
end
|
269
|
+
|
44
270
|
def edit(type=:mindwords, title=nil)
|
45
|
-
|
271
|
+
|
46
272
|
case type
|
47
273
|
when :link
|
48
|
-
linkedit(title)
|
274
|
+
@pl.linkedit(title)
|
49
275
|
when :mindwords
|
50
|
-
|
51
|
-
when :outline
|
52
|
-
outlinefile_edit()
|
53
|
-
when :tree
|
54
|
-
tree_edit()
|
276
|
+
@mw.edit()
|
277
|
+
when :outline
|
278
|
+
@pl.outlinefile_edit()
|
279
|
+
when :tree
|
280
|
+
@pl.tree_edit()
|
55
281
|
when :card
|
56
282
|
cardedit(title)
|
57
283
|
end
|
58
|
-
|
284
|
+
|
59
285
|
end
|
60
286
|
|
61
287
|
def import_mindwords(s)
|
62
|
-
|
63
|
-
@mw =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
s2 = "<?polyrex-links?>\n\n" + @mw.to_outline
|
68
|
-
outline_txt = File.join(@dir, 'outline.txt')
|
69
|
-
|
70
|
-
@pl = PolyrexLinks.new(s2)
|
71
|
-
@pl.save outline_txt
|
72
|
-
|
73
|
-
|
288
|
+
|
289
|
+
@mw = MindWordsX.new(@dir, s)
|
290
|
+
@pl = PxLinks.new(@dir, @mw.to_outline)
|
291
|
+
|
74
292
|
end
|
75
|
-
|
293
|
+
|
294
|
+
def read(path='')
|
295
|
+
|
296
|
+
data_dir = File.join(@dir, *path.split('/'), 'data')
|
297
|
+
|
298
|
+
# open the file if it exists
|
299
|
+
mindwords_file = File.join(data_dir, 'mindwords.txt')
|
300
|
+
|
301
|
+
if FileX.exists? mindwords_file then
|
302
|
+
|
303
|
+
@mw = MindWordsX.new(@dir, mindwords_file)
|
304
|
+
|
305
|
+
# create the activeoutline document if it doesn't already exist
|
306
|
+
outline_txt = File.join(data_dir, 'outline.txt')
|
307
|
+
@outline_xml = File.join(data_dir, 'outline.xml')
|
308
|
+
|
309
|
+
if not FileX.exists? outline_txt then
|
310
|
+
|
311
|
+
s = "<?polyrex-links?>\n\n" + @mw.to_outline
|
312
|
+
FileX.write outline_txt, s
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
@pl = PxLinks.new(@dir, outline_txt)
|
317
|
+
|
318
|
+
end
|
319
|
+
|
320
|
+
self
|
321
|
+
|
322
|
+
end
|
323
|
+
|
76
324
|
def update(type, title=nil, s)
|
77
|
-
|
325
|
+
|
78
326
|
case type
|
79
327
|
when :mindwords
|
80
|
-
mindwords_update(s)
|
328
|
+
mindwords_update(s)
|
81
329
|
when :link
|
82
|
-
linkupdate(title, s)
|
330
|
+
@pl.linkupdate(title, s)
|
83
331
|
when :card
|
84
332
|
cardupdate(title, s)
|
85
333
|
when :outline
|
86
|
-
|
334
|
+
@pl = PxLinks.new @dir, s
|
87
335
|
end
|
88
|
-
|
336
|
+
|
89
337
|
end
|
90
338
|
|
91
339
|
# options: :mindwords, :tree, :link, :card
|
92
|
-
#
|
93
|
-
def view(type=:mindwords, title
|
94
|
-
|
340
|
+
#
|
341
|
+
def view(type=:mindwords, title: nil, base_url: '')
|
342
|
+
|
343
|
+
puts 'inside view' if @debug
|
95
344
|
case type
|
96
345
|
when :mindwords
|
97
346
|
@mw.to_s
|
98
347
|
when :mindwords_tree
|
99
348
|
@mw.to_outline
|
100
|
-
when :tree
|
101
|
-
treeview()
|
349
|
+
when :tree
|
350
|
+
@pl.treeview()
|
102
351
|
when :index
|
103
|
-
indexview()
|
352
|
+
@pl.indexview(base_url)
|
104
353
|
when :card
|
105
354
|
cardview(title)
|
106
355
|
end
|
107
|
-
|
356
|
+
|
108
357
|
end
|
109
|
-
|
358
|
+
|
110
359
|
private
|
111
|
-
|
360
|
+
|
112
361
|
def cardedit(rawtitle)
|
113
|
-
|
362
|
+
|
114
363
|
title = rawtitle.downcase.gsub(/ +/,'-')
|
115
364
|
|
116
365
|
file = title + '.txt'
|
117
366
|
filepath = File.join(@dir, file)
|
118
|
-
|
119
|
-
kvx = if
|
367
|
+
|
368
|
+
kvx = if FileX.exists? filepath then
|
120
369
|
Kvx.new(filepath)
|
121
370
|
else
|
122
|
-
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: ''}}, \
|
371
|
+
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: '',wiki: rawtitle.capitalize}}, \
|
123
372
|
debug: false)
|
124
373
|
end
|
125
|
-
|
374
|
+
|
126
375
|
%Q(<form action="cardupdate" method="post">
|
127
376
|
<input type='hidden' name='title' value="#{rawtitle}"/>
|
128
377
|
<textarea name="kvxtext" cols="73" rows="17">#{kvx.to_s}</textarea>
|
129
378
|
<input type="submit" value="apply"/>
|
130
379
|
</form>
|
131
380
|
)
|
132
|
-
end
|
133
|
-
|
134
|
-
def cardupdate(rawtitle, rawkvxtext)
|
135
|
-
|
381
|
+
end
|
382
|
+
|
383
|
+
def cardupdate(rawtitle, rawkvxtext, url_base: '')
|
384
|
+
|
136
385
|
title = rawtitle.downcase.gsub(/ +/,'-')
|
137
386
|
kvx = Kvx.new rawkvxtext.gsub(/\r/,'')
|
138
387
|
|
139
388
|
file = title + '.txt'
|
140
389
|
filepath = File.join(@dir, file)
|
141
|
-
|
390
|
+
|
142
391
|
kvx.save filepath
|
143
|
-
|
392
|
+
|
144
393
|
found = @pl.find_all_by_link_title rawtitle
|
145
|
-
|
394
|
+
|
146
395
|
found.each do |link|
|
147
|
-
|
396
|
+
|
148
397
|
url = if kvx.body[:url].length > 1 then
|
149
398
|
kvx.body[:url]
|
150
|
-
else
|
151
|
-
'
|
399
|
+
# else
|
400
|
+
# url_base + 'viewcard?title=' + rawtitle
|
152
401
|
end
|
153
|
-
|
402
|
+
|
154
403
|
link.url = url
|
155
|
-
|
404
|
+
|
156
405
|
end
|
157
|
-
|
406
|
+
|
158
407
|
@pl.save @outline_xml
|
159
408
|
|
160
409
|
end
|
161
|
-
|
410
|
+
|
162
411
|
def cardview(rawtitle)
|
163
|
-
|
412
|
+
|
164
413
|
puts 'rawtitle: ' + rawtitle.inspect if @debug
|
165
|
-
|
166
|
-
|
167
|
-
file =
|
414
|
+
filetitle = rawtitle.downcase.gsub(/ +/,'-')
|
415
|
+
|
416
|
+
file = filetitle + '.txt'
|
168
417
|
filepath = File.join(@dir, file)
|
169
418
|
puts 'filepath: ' + filepath.inspect if @debug
|
170
|
-
|
171
|
-
kvx = if
|
419
|
+
|
420
|
+
kvx = if FileX.exists? filepath then
|
172
421
|
Kvx.new(filepath)
|
173
422
|
else
|
174
|
-
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: ''}}, \
|
423
|
+
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: '', wiki: rawtitle.capitalize}}, \
|
175
424
|
debug: false)
|
176
425
|
end
|
177
|
-
|
426
|
+
|
178
427
|
puts 'kvx: ' + kvx.inspect if @debug
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
.to_html).to_html
|
428
|
+
|
429
|
+
md = if kvx.body[:md].is_a? Hash then
|
430
|
+
kvx.body[:md][:description].to_s
|
183
431
|
else
|
184
|
-
|
432
|
+
kvx.body[:md].to_s
|
185
433
|
end
|
186
|
-
|
187
|
-
%Q(<h1></h1>
|
188
|
-
<ul>
|
189
|
-
<li><label>info:</label> #{ html }</li>
|
190
|
-
<li><label>url:</label> <a href="#{kvx.url}">#{kvx.url}</a></li>
|
191
|
-
</ul>
|
192
|
-
<a href="editcard?title=#{rawtitle}">edit</a>
|
193
|
-
)
|
194
|
-
end
|
195
|
-
|
196
|
-
def linkedit(rawtitle)
|
197
|
-
|
198
|
-
r = @pl.find_by_link_title rawtitle
|
199
|
-
|
200
|
-
"<form action='updatelink' type='psot'>
|
201
|
-
<input type='hidden' name='title' value='#{r.title}'/>
|
202
|
-
<input type='input' name='url' value='#{r.url}'/>
|
203
|
-
<input type='submit' value='apply'/>
|
204
|
-
</form>
|
205
|
-
"
|
206
|
-
|
207
|
-
end
|
208
|
-
|
209
|
-
def linkupdate(rawtitle, rawurl)
|
210
|
-
|
211
|
-
r = @pl.find_by_link_title rawtitle
|
212
|
-
return unless r
|
213
|
-
|
214
|
-
r.url = rawurl
|
215
|
-
|
216
|
-
@outline_xml = File.join(@dir, 'outline.xml') unless @outline_xml
|
217
|
-
@pl.save @outline_xml
|
218
434
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
435
|
+
puts 'after md: ' + md.inspect if @debug
|
436
|
+
|
437
|
+
html = Kramdown::Document.new(Martile.new(md).to_html).to_html
|
438
|
+
|
439
|
+
# This is the path to the mymedia-wiki directory ->
|
440
|
+
dx = DxLite.new @dxpath, debug: false
|
441
|
+
|
442
|
+
title = rawtitle[/^#{rawtitle}(?= +#)/i]
|
443
|
+
|
444
|
+
record = dx.all.find do |post|
|
445
|
+
post.title =~ /^#{rawtitle}(?= +#)/i
|
446
|
+
end
|
447
|
+
|
448
|
+
doc = kvx.to_doc
|
449
|
+
|
450
|
+
e = doc.root.element('body/wiki')
|
451
|
+
|
452
|
+
if e then
|
453
|
+
|
454
|
+
link = Rexle::Element.new('a').add_text(e.text)
|
455
|
+
|
456
|
+
if record then
|
457
|
+
link.attributes[:href] = '/do/wiki/view?file=' + File.basename(record.url)
|
229
458
|
else
|
230
|
-
|
459
|
+
tags = @mw.hashtags(e.text)
|
460
|
+
|
461
|
+
href = '/do/wiki/create?title=' + URI::Parser.new.escape(e.text)
|
462
|
+
href += '&amp;tags=' + e.text.to_s.split(/ +/).join(' ') + ' ' + tags.join(' ') if tags
|
463
|
+
|
464
|
+
link.attributes[:href] = href
|
465
|
+
e.attributes[:class] = 'newpage'
|
231
466
|
end
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
links = raw_links.to_h
|
237
|
-
|
238
|
-
a2 = a.map do |title, rawurl, rawpath|
|
239
|
-
|
240
|
-
path = rawpath[0..-2].reverse.map {|x| links[x]}.join('/')
|
241
|
-
"<tr><td>%s</td><td>%s</td></tr>" % [links[title], path]
|
242
|
-
|
467
|
+
|
468
|
+
e.text = ''
|
469
|
+
e.add link
|
243
470
|
end
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
471
|
+
|
472
|
+
|
473
|
+
doc.root.element('body').add Rexle.new('<desc>' + html + '</desc>')
|
474
|
+
|
475
|
+
nokodoc = Nokogiri::XML(doc.xml)
|
476
|
+
#xslt = Nokogiri::XSLT(File.read(File.join(@dir, 'kvx.xsl')))
|
477
|
+
xslt = Nokogiri::XSLT(KVX_XSL)
|
478
|
+
style = '<style>li.newpage a {color: #e33;}</style>'
|
479
|
+
card = xslt.apply_to(nokodoc).to_s
|
480
|
+
style + "\n\n" + card
|
481
|
+
|
256
482
|
end
|
257
|
-
|
483
|
+
|
258
484
|
def mindwords_update(s)
|
259
|
-
|
260
|
-
@mw =
|
261
|
-
|
485
|
+
|
486
|
+
@mw = MindWordsX.new(@dir, s)
|
487
|
+
|
262
488
|
pl = @pl.migrate @mw.to_outline
|
263
|
-
pl.save @outline_xml
|
489
|
+
pl.save @outline_xml
|
264
490
|
@pl = pl
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
def outlinefile_edit()
|
269
|
-
|
270
|
-
%Q(<form action="fileupdate" method="post">
|
271
|
-
<textarea name="treelinks" cols="73" rows="17">#{@pl.to_s}</textarea>
|
272
|
-
<input type="submit" value="apply"/>
|
273
|
-
</form>
|
274
|
-
)
|
275
|
-
|
276
|
-
end
|
277
|
-
|
278
|
-
def outlinefile_update(s)
|
279
|
-
|
280
|
-
@pl = PolyrexLinks.new
|
281
|
-
@pl.import s
|
282
|
-
|
283
|
-
end
|
284
|
-
|
285
|
-
def tree_edit()
|
286
|
-
|
287
|
-
base_url = 'linkedit?title='
|
288
|
-
@pl.each_recursive { |x| x.url = base_url + x.title }
|
289
|
-
jtb = JsTreeBuilder.new({src: @pl, type: :plain, debug: true})
|
290
|
-
|
291
|
-
style = "
|
292
|
-
<style>
|
293
|
-
.newspaper1 {
|
294
|
-
columns: 100px 3;
|
295
|
-
}
|
296
|
-
ul {list-style-type: none; background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 1.3em}
|
297
|
-
ul li {background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 0.3em}
|
298
|
-
</style>
|
299
|
-
"
|
300
|
-
html = "<div class='newspaper1'>#{jtb.to_html}</div>"
|
301
|
-
style + "\n" + html
|
491
|
+
|
302
492
|
end
|
303
|
-
|
304
|
-
def treeview()
|
305
493
|
|
306
494
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
.
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
</style>
|
318
|
-
"
|
495
|
+
end
|
496
|
+
|
497
|
+
|
498
|
+
class MultiWmcd
|
499
|
+
|
500
|
+
def initialize(dir: '.', dxpath: nil)
|
501
|
+
|
502
|
+
@dir, @dxpath = dir, dxpath
|
503
|
+
@hc = HashCache.new
|
504
|
+
cache_read()
|
319
505
|
|
320
|
-
style + "\n" + html
|
321
|
-
|
322
506
|
end
|
323
|
-
|
324
|
-
end
|
325
507
|
|
508
|
+
def read(path='')
|
509
|
+
cache_read(path)
|
510
|
+
end
|
511
|
+
|
512
|
+
private
|
513
|
+
|
514
|
+
def cache_read(path='')
|
515
|
+
|
516
|
+
@hc.read(path) do
|
517
|
+
wmcd = WikiMindCardsDirectory.new(dir: @dir, dxpath: @dxpath)
|
518
|
+
wmcd.read(path)
|
519
|
+
end
|
520
|
+
|
521
|
+
end
|
522
|
+
|
523
|
+
end
|
326
524
|
|
327
525
|
module Wmcd
|
328
526
|
|
329
527
|
class Server < OneDrb::Server
|
330
528
|
|
331
|
-
def initialize(host: '127.0.0.1', port: '21200', dir: '.')
|
529
|
+
def initialize(host: '127.0.0.1', port: '21200', dir: '.', dxpath: nil)
|
332
530
|
|
333
|
-
super(host: host, port: port, obj:
|
531
|
+
super(host: host, port: port, obj: MultiWmcd.new(dir: dir, dxpath: dxpath))
|
334
532
|
|
335
533
|
end
|
336
534
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikimindcards_directory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
Upf2OcIVt4H+NwuNavOk/frMZYypxNmaFbyXiFNTnoW9vZYwljDOSYEexFbnPRLU
|
36
36
|
JTIQxz9x1yw+KeIiq001B1ON
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: martile
|
@@ -43,60 +43,120 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.5'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.5.0
|
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.5'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
59
|
+
version: 1.5.0
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: mindwords
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
66
|
+
version: '0.8'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.8.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.8'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
79
|
+
version: 0.8.0
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: polyrex-links
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: '0.
|
86
|
+
version: '0.5'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.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: '0.
|
96
|
+
version: '0.5'
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.5.0
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: onedrb
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0.1'
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.1.0
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.1'
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 0.1.0
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
name: hashcache
|
122
|
+
requirement: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0.2'
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 0.2.10
|
130
|
+
type: :runtime
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0.2'
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.2.10
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: dxlite
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.6'
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.6.0
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0.6'
|
97
157
|
- - ">="
|
98
158
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.
|
159
|
+
version: 0.6.0
|
100
160
|
description:
|
101
161
|
email: digital.robertson@gmail.com
|
102
162
|
executables: []
|
@@ -123,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
183
|
- !ruby/object:Gem::Version
|
124
184
|
version: '0'
|
125
185
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.2.22
|
127
187
|
signing_key:
|
128
188
|
specification_version: 4
|
129
189
|
summary: An experimental MindWords driven wiki editor which uses “cards”.
|
metadata.gz.sig
CHANGED
Binary file
|