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