wikimindcards_directory 0.2.1 → 0.3.0
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/lib/wikimindcards_directory.rb +419 -222
- data.tar.gz.sig +0 -0
- metadata +48 -7
- 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: f240190d279673c4ef684b7e903eba49f4a0c5c11749aef6226f7c8346d07377
|
4
|
+
data.tar.gz: c5052fc27516117b3001c2cae2644375d940dbb1343580372cdaa29596a8f0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e4d6a5381c70538be399441bf8b8c3ddf9a0cf303b6c3a5662ee0eef926e78ae76b6113612e35e4cf2bf4b90bd8c47ef488904c322dc8cbccf1c04f2447067
|
7
|
+
data.tar.gz: 760c130f5e3c460c72c4bfc501b23c44aef741cc1ab8442b947c13ebb744e2ce9cde09d10c1b6d651ae3478f24b9a8432d863192591a7cab3ca6467ce4831134
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -10,328 +10,525 @@ require 'polyrex-links'
|
|
10
10
|
require 'jstreebuilder'
|
11
11
|
require 'martile'
|
12
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
|
13
69
|
|
14
70
|
class WikiMindCardsDirectory
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
71
|
+
include RXFHelperModule
|
72
|
+
|
73
|
+
class MindWordsX < MindWords
|
74
|
+
include RXFHelperModule
|
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 RXFHelperModule
|
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
|
+
|
37
134
|
end
|
38
|
-
|
39
|
-
@pl = PolyrexLinks.new(outline_txt)
|
40
|
-
|
135
|
+
|
41
136
|
end
|
42
|
-
|
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
|
+
|
187
|
+
end
|
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
|
+
|
209
|
+
end
|
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
|
253
|
+
end
|
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 = File.expand_path(dir)
|
261
|
+
@dxpath = dxpath
|
262
|
+
@debug = debug
|
263
|
+
|
264
|
+
# attempt to read the mindwords and outline (polyrex-links) files
|
265
|
+
#
|
266
|
+
read()
|
267
|
+
|
43
268
|
end
|
44
|
-
|
269
|
+
|
45
270
|
def edit(type=:mindwords, title=nil)
|
46
|
-
|
271
|
+
|
47
272
|
case type
|
48
273
|
when :link
|
49
|
-
linkedit(title)
|
274
|
+
@pl.linkedit(title)
|
50
275
|
when :mindwords
|
51
|
-
|
52
|
-
when :outline
|
53
|
-
outlinefile_edit()
|
54
|
-
when :tree
|
55
|
-
tree_edit()
|
276
|
+
@mw.edit()
|
277
|
+
when :outline
|
278
|
+
@pl.outlinefile_edit()
|
279
|
+
when :tree
|
280
|
+
@pl.tree_edit()
|
56
281
|
when :card
|
57
282
|
cardedit(title)
|
58
283
|
end
|
59
|
-
|
284
|
+
|
60
285
|
end
|
61
286
|
|
62
287
|
def import_mindwords(s)
|
63
|
-
|
64
|
-
@mw =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
s2 = "<?polyrex-links?>\n\n" + @mw.to_outline
|
69
|
-
outline_txt = File.join(@dir, 'outline.txt')
|
70
|
-
|
71
|
-
@pl = PolyrexLinks.new(s2)
|
72
|
-
@pl.save outline_txt
|
73
|
-
|
74
|
-
|
288
|
+
|
289
|
+
@mw = MindWordsX.new(@dir, s)
|
290
|
+
@pl = PxLinks.new(@dir, @mw.to_outline)
|
291
|
+
|
75
292
|
end
|
76
|
-
|
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
|
+
|
77
324
|
def update(type, title=nil, s)
|
78
|
-
|
325
|
+
|
79
326
|
case type
|
80
327
|
when :mindwords
|
81
|
-
mindwords_update(s)
|
328
|
+
mindwords_update(s)
|
82
329
|
when :link
|
83
|
-
linkupdate(title, s)
|
330
|
+
@pl.linkupdate(title, s)
|
84
331
|
when :card
|
85
332
|
cardupdate(title, s)
|
86
333
|
when :outline
|
87
|
-
|
334
|
+
@pl = PxLinks.new @dir, s
|
88
335
|
end
|
89
|
-
|
336
|
+
|
90
337
|
end
|
91
338
|
|
92
339
|
# options: :mindwords, :tree, :link, :card
|
93
|
-
#
|
94
|
-
def view(type=:mindwords, title
|
95
|
-
|
340
|
+
#
|
341
|
+
def view(type=:mindwords, title: nil, base_url: '')
|
342
|
+
|
343
|
+
puts 'inside view' if @debug
|
96
344
|
case type
|
97
345
|
when :mindwords
|
98
346
|
@mw.to_s
|
99
347
|
when :mindwords_tree
|
100
348
|
@mw.to_outline
|
101
|
-
when :tree
|
102
|
-
treeview()
|
349
|
+
when :tree
|
350
|
+
@pl.treeview()
|
103
351
|
when :index
|
104
|
-
indexview()
|
352
|
+
@pl.indexview(base_url)
|
105
353
|
when :card
|
106
354
|
cardview(title)
|
107
355
|
end
|
108
|
-
|
356
|
+
|
109
357
|
end
|
110
|
-
|
358
|
+
|
111
359
|
private
|
112
|
-
|
360
|
+
|
113
361
|
def cardedit(rawtitle)
|
114
|
-
|
362
|
+
|
115
363
|
title = rawtitle.downcase.gsub(/ +/,'-')
|
116
364
|
|
117
365
|
file = title + '.txt'
|
118
366
|
filepath = File.join(@dir, file)
|
119
|
-
|
120
|
-
kvx = if
|
367
|
+
|
368
|
+
kvx = if FileX.exists? filepath then
|
121
369
|
Kvx.new(filepath)
|
122
370
|
else
|
123
|
-
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: ''}}, \
|
371
|
+
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: '',wiki: rawtitle.capitalize}}, \
|
124
372
|
debug: false)
|
125
373
|
end
|
126
|
-
|
374
|
+
|
127
375
|
%Q(<form action="cardupdate" method="post">
|
128
376
|
<input type='hidden' name='title' value="#{rawtitle}"/>
|
129
377
|
<textarea name="kvxtext" cols="73" rows="17">#{kvx.to_s}</textarea>
|
130
378
|
<input type="submit" value="apply"/>
|
131
379
|
</form>
|
132
380
|
)
|
133
|
-
end
|
134
|
-
|
135
|
-
def cardupdate(rawtitle, rawkvxtext)
|
136
|
-
|
381
|
+
end
|
382
|
+
|
383
|
+
def cardupdate(rawtitle, rawkvxtext, url_base: '')
|
384
|
+
|
137
385
|
title = rawtitle.downcase.gsub(/ +/,'-')
|
138
386
|
kvx = Kvx.new rawkvxtext.gsub(/\r/,'')
|
139
387
|
|
140
388
|
file = title + '.txt'
|
141
389
|
filepath = File.join(@dir, file)
|
142
|
-
|
390
|
+
|
143
391
|
kvx.save filepath
|
144
|
-
|
392
|
+
|
145
393
|
found = @pl.find_all_by_link_title rawtitle
|
146
|
-
|
394
|
+
|
147
395
|
found.each do |link|
|
148
|
-
|
396
|
+
|
149
397
|
url = if kvx.body[:url].length > 1 then
|
150
398
|
kvx.body[:url]
|
151
|
-
else
|
152
|
-
'
|
399
|
+
# else
|
400
|
+
# url_base + 'viewcard?title=' + rawtitle
|
153
401
|
end
|
154
|
-
|
402
|
+
|
155
403
|
link.url = url
|
156
|
-
|
404
|
+
|
157
405
|
end
|
158
|
-
|
406
|
+
|
159
407
|
@pl.save @outline_xml
|
160
408
|
|
161
409
|
end
|
162
|
-
|
410
|
+
|
163
411
|
def cardview(rawtitle)
|
164
|
-
|
412
|
+
|
165
413
|
puts 'rawtitle: ' + rawtitle.inspect if @debug
|
166
|
-
|
167
|
-
|
168
|
-
file =
|
414
|
+
filetitle = rawtitle.downcase.gsub(/ +/,'-')
|
415
|
+
|
416
|
+
file = filetitle + '.txt'
|
169
417
|
filepath = File.join(@dir, file)
|
170
418
|
puts 'filepath: ' + filepath.inspect if @debug
|
171
|
-
|
172
|
-
kvx = if
|
419
|
+
|
420
|
+
kvx = if FileX.exists? filepath then
|
173
421
|
Kvx.new(filepath)
|
174
422
|
else
|
175
|
-
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: ''}}, \
|
423
|
+
Kvx.new({summary: {title: rawtitle}, body: {md: '', url: '', wiki: rawtitle.capitalize}}, \
|
176
424
|
debug: false)
|
177
425
|
end
|
178
|
-
|
426
|
+
|
179
427
|
puts 'kvx: ' + kvx.inspect if @debug
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
.to_html).to_html
|
428
|
+
|
429
|
+
md = if kvx.body[:md].is_a? Hash then
|
430
|
+
kvx.body[:md][:description].to_s
|
184
431
|
else
|
185
|
-
|
432
|
+
kvx.body[:md].to_s
|
186
433
|
end
|
187
|
-
|
188
|
-
%Q(<h1></h1>
|
189
|
-
<ul>
|
190
|
-
<li><label>info:</label> #{ html }</li>
|
191
|
-
<li><label>url:</label> <a href="#{kvx.url}">#{kvx.url}</a></li>
|
192
|
-
</ul>
|
193
|
-
<a href="editcard?title=#{rawtitle}">edit</a>
|
194
|
-
)
|
195
|
-
end
|
196
|
-
|
197
|
-
def linkedit(rawtitle)
|
198
|
-
|
199
|
-
r = @pl.find_by_link_title rawtitle
|
200
|
-
|
201
|
-
"<form action='updatelink' type='psot'>
|
202
|
-
<input type='hidden' name='title' value='#{r.title}'/>
|
203
|
-
<input type='input' name='url' value='#{r.url}'/>
|
204
|
-
<input type='submit' value='apply'/>
|
205
|
-
</form>
|
206
|
-
"
|
207
|
-
|
208
|
-
end
|
209
|
-
|
210
|
-
def linkupdate(rawtitle, rawurl)
|
211
|
-
|
212
|
-
r = @pl.find_by_link_title rawtitle
|
213
|
-
return unless r
|
214
|
-
|
215
|
-
r.url = rawurl
|
216
|
-
|
217
|
-
@outline_xml = File.join(@dir, 'outline.xml') unless @outline_xml
|
218
|
-
@pl.save @outline_xml
|
219
434
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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)
|
230
458
|
else
|
231
|
-
|
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'
|
232
466
|
end
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
links = raw_links.to_h
|
238
|
-
|
239
|
-
a2 = a.map do |title, rawurl, rawpath|
|
240
|
-
|
241
|
-
path = rawpath[0..-2].reverse.map {|x| links[x]}.join('/')
|
242
|
-
"<tr><td>%s</td><td>%s</td></tr>" % [links[title], path]
|
243
|
-
|
467
|
+
|
468
|
+
e.text = ''
|
469
|
+
e.add link
|
244
470
|
end
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
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
|
+
|
257
482
|
end
|
258
|
-
|
483
|
+
|
259
484
|
def mindwords_update(s)
|
260
|
-
|
261
|
-
@mw =
|
262
|
-
|
485
|
+
|
486
|
+
@mw = MindWordsX.new(@dir, s)
|
487
|
+
|
263
488
|
pl = @pl.migrate @mw.to_outline
|
264
|
-
pl.save @outline_xml
|
489
|
+
pl.save @outline_xml
|
265
490
|
@pl = pl
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
def outlinefile_edit()
|
270
|
-
|
271
|
-
%Q(<form action="fileupdate" method="post">
|
272
|
-
<textarea name="treelinks" cols="73" rows="17">#{@pl.to_s}</textarea>
|
273
|
-
<input type="submit" value="apply"/>
|
274
|
-
</form>
|
275
|
-
)
|
276
|
-
|
277
|
-
end
|
278
|
-
|
279
|
-
def outlinefile_update(s)
|
280
|
-
|
281
|
-
@pl = PolyrexLinks.new
|
282
|
-
@pl.import s
|
283
|
-
|
284
|
-
end
|
285
|
-
|
286
|
-
def tree_edit()
|
287
|
-
|
288
|
-
base_url = 'linkedit?title='
|
289
|
-
@pl.each_recursive { |x| x.url = base_url + x.title }
|
290
|
-
jtb = JsTreeBuilder.new({src: @pl, type: :plain, debug: true})
|
291
|
-
|
292
|
-
style = "
|
293
|
-
<style>
|
294
|
-
.newspaper1 {
|
295
|
-
columns: 100px 3;
|
296
|
-
}
|
297
|
-
ul {list-style-type: none; background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 1.3em}
|
298
|
-
ul li {background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 0.3em}
|
299
|
-
</style>
|
300
|
-
"
|
301
|
-
html = "<div class='newspaper1'>#{jtb.to_html}</div>"
|
302
|
-
style + "\n" + html
|
491
|
+
|
303
492
|
end
|
304
|
-
|
305
|
-
def treeview()
|
306
493
|
|
307
494
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
.
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
</style>
|
319
|
-
"
|
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()
|
320
505
|
|
321
|
-
style + "\n" + html
|
322
|
-
|
323
506
|
end
|
324
|
-
|
325
|
-
end
|
326
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
|
327
524
|
|
328
525
|
module Wmcd
|
329
526
|
|
330
527
|
class Server < OneDrb::Server
|
331
528
|
|
332
|
-
def initialize(host: '127.0.0.1', port: '21200', dir: '.')
|
529
|
+
def initialize(host: '127.0.0.1', port: '21200', dir: '.', dxpath: nil)
|
333
530
|
|
334
|
-
super(host: host, port: port, obj:
|
531
|
+
super(host: host, port: port, obj: MultiWmcd.new(dir: dir, dxpath: dxpath))
|
335
532
|
|
336
533
|
end
|
337
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.3.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-01-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: martile
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '0.6'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.6.
|
69
|
+
version: 0.6.6
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0.6'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.6.
|
79
|
+
version: 0.6.6
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: polyrex-links
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,22 +101,62 @@ dependencies:
|
|
101
101
|
name: onedrb
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.1.0
|
104
107
|
- - "~>"
|
105
108
|
- !ruby/object:Gem::Version
|
106
109
|
version: '0.1'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
107
114
|
- - ">="
|
108
115
|
- !ruby/object:Gem::Version
|
109
116
|
version: 0.1.0
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0.1'
|
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
|
110
130
|
type: :runtime
|
111
131
|
prerelease: false
|
112
132
|
version_requirements: !ruby/object:Gem::Requirement
|
113
133
|
requirements:
|
114
134
|
- - "~>"
|
115
135
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0.
|
136
|
+
version: '0.2'
|
117
137
|
- - ">="
|
118
138
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.
|
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.4'
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.4.1
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0.4'
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.4.1
|
120
160
|
description:
|
121
161
|
email: digital.robertson@gmail.com
|
122
162
|
executables: []
|
@@ -143,7 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
183
|
- !ruby/object:Gem::Version
|
144
184
|
version: '0'
|
145
185
|
requirements: []
|
146
|
-
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.7.10
|
147
188
|
signing_key:
|
148
189
|
specification_version: 4
|
149
190
|
summary: An experimental MindWords driven wiki editor which uses “cards”.
|
metadata.gz.sig
CHANGED
Binary file
|