wikimindcards_directory 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afb809ae2f95d576731e37c163ab3c9f0fe1fc77dfc2f48eebaf76aa658144a1
4
- data.tar.gz: 967c0729b99b3d2df41093bbca94e2e34ce2cf046dca8a56529cd7b660547de2
3
+ metadata.gz: 6b59cefe21bf6ae5b976d6a9dce62dc8f8e228d12e413841e2d3e7d9c911800e
4
+ data.tar.gz: be2fb281be914839913c0aea34fd51b03a16e1a3b3a47b45cc8cae1747782869
5
5
  SHA512:
6
- metadata.gz: ccd6cee70e1487702e1bf5f3bba3147fdd005ebec2a30a97796a5d69776a9ad2854446da8d8c10b4b03ab6932b50eafe7ad394478ddb5a97c083742638f7d3e7
7
- data.tar.gz: 7ce2a010efe0414d2e9a9627eb73f53f061aa254276df9bbe500172311dc13a4c59277679f54cf45387a59a7ea5bd9092759d5d929c1a348b20e53d9f6162a95
6
+ metadata.gz: 0e20c99c053b69102c913e823ef6d9119c536e8da87ceb481a0a5d98e67a69699cfafdd632cc75d3f1114e36f9aa19f6a39da44163ebc3e3a16d4d21dcf7a331
7
+ data.tar.gz: ae308c26c3f23e117ce25fd71062fa217626c6bd6df6e818251feaa8ac49f6b4f464d2d02332acf8a685722c196e04c2228f9f2c90d6dc32f0a6890547f8782c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -14,7 +14,8 @@ class WikiMindCardsDirectory
14
14
 
15
15
  def initialize(dir: '.', debug: false)
16
16
 
17
- @dir, @debug = dir, debug
17
+ @dir = File.expand_path(dir)
18
+ @debug = debug
18
19
 
19
20
  # open the file if it exists
20
21
  mindwords_file = File.join(dir, 'mindwords.txt')
@@ -47,21 +48,42 @@ class WikiMindCardsDirectory
47
48
  linkedit(title)
48
49
  when :mindwords
49
50
  mindwords_edit()
51
+ when :outline
52
+ outlinefile_edit()
50
53
  when :tree
51
54
  tree_edit()
52
55
  when :card
53
56
  cardedit(title)
54
57
  end
55
58
 
56
- end
59
+ end
60
+
61
+ def import_mindwords(s)
62
+
63
+ @mw = MindWords.new(s)
64
+ mindwords_file = File.join(@dir, 'mindwords.txt')
65
+ @mw.save mindwords_file
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
+
74
+ end
57
75
 
58
- def update(type, title, s)
76
+ def update(type, title=nil, s)
59
77
 
60
78
  case type
79
+ when :mindwords
80
+ mindwords_update(s)
61
81
  when :link
62
82
  linkupdate(title, s)
63
83
  when :card
64
84
  cardupdate(title, s)
85
+ when :outline
86
+ outlinefile_update(s)
65
87
  end
66
88
 
67
89
  end
@@ -190,6 +212,8 @@ class WikiMindCardsDirectory
190
212
  return unless r
191
213
 
192
214
  r.url = rawurl
215
+
216
+ @outline_xml = File.join(@dir, 'outline.xml') unless @outline_xml
193
217
  @pl.save @outline_xml
194
218
 
195
219
  end
@@ -231,11 +255,38 @@ class WikiMindCardsDirectory
231
255
 
232
256
  end
233
257
 
258
+ def mindwords_update(s)
259
+
260
+ @mw = MindWords.new(s)
261
+
262
+ pl = @pl.migrate @mw.to_outline
263
+ pl.save @outline_xml
264
+ @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
+
234
285
  def tree_edit()
235
286
 
236
287
  base_url = 'linkedit?title='
237
288
  @pl.each_recursive { |x| x.url = base_url + x.title }
238
- jtb = JsTreeBuilder.new({src: links, type: :plain, debug: true})
289
+ jtb = JsTreeBuilder.new({src: @pl, type: :plain, debug: true})
239
290
 
240
291
  style = "
241
292
  <style>
@@ -271,3 +322,25 @@ ul li {background-color: transparent; margin: 0.1em 0.1em; padding: 0.3em 0.3em}
271
322
  end
272
323
 
273
324
  end
325
+
326
+
327
+ module Wmcd
328
+
329
+ class Server < OneDrb::Server
330
+
331
+ def initialize(host: '127.0.0.1', port: '21200', dir: '.')
332
+
333
+ super(host: host, port: port, obj: WikiMindCardsDirectory.new(dir: dir))
334
+
335
+ end
336
+
337
+ end
338
+
339
+ class Client < OneDrb::Client
340
+
341
+ def initialize(host: '127.0.0.1', port: '21200')
342
+ super(host: host, port: port)
343
+ end
344
+ end
345
+
346
+ end
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.1.1
4
+ version: 0.2.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: 2021-06-07 00:00:00.000000000 Z
38
+ date: 2021-06-30 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.3
69
+ version: 0.6.4
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.3
79
+ version: 0.6.4
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: polyrex-links
82
82
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file