wiki_md 0.8.1 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 812073421ddfee0070fd6c340e54853949d4ba7cfbb5cd736a9b4ef54640efb1
4
- data.tar.gz: bf512609589a4eb78fd2eeb9052fa4626052a4408621d32bd4417f9aaa461c31
3
+ metadata.gz: '0827d3ff8a838f7dbd0a7c579aa9614085a07e417973c47deb24c80fd7ca4422'
4
+ data.tar.gz: 56ddf102fae4fc8b8464389fb1d0d3b70fca3079eccde9ea7d388d5ee5fcc537
5
5
  SHA512:
6
- metadata.gz: d8c2045c900695dd6eb122e1e869b34d2dd27aa79d62b2f64f746c924c668914003e92d94d3218358f5af0f80cd951782514b4cde6ef9df829a773a08515b0e6
7
- data.tar.gz: 0c34abcedaf88c4cc771f6f9e66019f9ac684bd095afb2c7560e2a2b02a2a953754da3d3334b614463967192e2a3c46be49c0ab204a7eebddb6c32660c12f49b
6
+ metadata.gz: 904e3d93b2f9c20b75bf11dae84c066f79bcdce24d42a11d4a7555ca9992d47f976d34c733f5701269b99ef3b73f413ea5c45003446418a25c30a03be8545dcd
7
+ data.tar.gz: f07a725919290bbdaf79f2e379b28091592f0f20d9c985cefaf1a5a3a3f67d44fa5a8e5d87f77ea1f5fb7beb12db3b365a968ae61e36ed7d08664098bb29c0f1
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/wiki_md.rb CHANGED
@@ -19,9 +19,9 @@ class WikiMd
19
19
 
20
20
  attr_reader :heading, :body, :footer, :tags, :x
21
21
 
22
- def initialize(rx)
22
+ def initialize(rx, debug: false)
23
23
 
24
- @rx = rx
24
+ @rx, @debug = rx, debug
25
25
  @x = @rx.x
26
26
  parse_x()
27
27
 
@@ -52,6 +52,8 @@ class WikiMd
52
52
  def parse_x()
53
53
 
54
54
  a = @rx.x.lines
55
+ puts 'a: ' + a.inspect if @debug
56
+
55
57
  @heading, @footer, @body = a.shift.chomp[/(?<=# ).*/], a.pop,
56
58
  a.join.strip
57
59
  @tags = @footer[1..-1].strip.split
@@ -69,7 +71,9 @@ class WikiMd
69
71
  if wiki then
70
72
 
71
73
  puts 'before rxfhelper wiki: ' + wiki.inspect if @debug
72
- s, type = RXFHelper.read(wiki, auto: false)
74
+ raw_s, type = RXFHelper.read(wiki, auto: false)
75
+ s = raw_s.strip
76
+
73
77
  puts 'after rxfhelper s: ' + s.inspect if @debug
74
78
 
75
79
  puts ('type: ' + type.inspect).debug if debug
@@ -201,7 +205,7 @@ class WikiMd
201
205
  @dxsx.dx.all.map do |x|
202
206
 
203
207
  puts 'x: ' + x.inspect if @debug
204
- Entry.new(x)
208
+ Entry.new(x, debug: @debug)
205
209
 
206
210
  end
207
211
 
@@ -339,9 +343,12 @@ EOF
339
343
  def save(filename=@filename || 'mywiki.md')
340
344
 
341
345
  @filename = filename
342
- @filepath = File.dirname(@filename)
346
+ puts '@filename: ' + @filename.inspect if @debug
343
347
 
344
- FileX.write @filename=filename, dx_to_wmd(@dxsx.to_s)
348
+ @filepath = File.expand_path(File.dirname(@filename).to_s)
349
+ puts '@filepath: ' + @filepath.inspect if @debug
350
+
351
+ FileX.write @filename=filename, dx_to_wmd(@dxsx.to_dx)
345
352
 
346
353
  puts ('before @dxsx save').debug if @debug
347
354
  @dxsx.save filename.sub(/\.md$/, '.xml')
@@ -370,11 +377,11 @@ EOF
370
377
  # generates an accordion menu in XML format. It can be rendered to
371
378
  # HTML using the Martile gem
372
379
  #
373
- def to_accordion()
380
+ def to_accordion(ascending: true)
374
381
 
375
382
  doc = Rexle.new('<accordion/>')
376
383
 
377
- sort!()
384
+ sort!() if ascending
378
385
 
379
386
  entries.each do |x|
380
387
 
@@ -487,7 +494,7 @@ EOF
487
494
 
488
495
  def save_files()
489
496
  @filepath = File.dirname(@filename)
490
- FileX.write @filename=filename, @dxsx.to_s
497
+ FileX.write @filename=filename, dx_to_wmd(@dxsx.to_dx)
491
498
  @dx.save
492
499
  end
493
500
 
@@ -529,8 +536,21 @@ EOF
529
536
  def new_index(indexfile)
530
537
 
531
538
  dx = Dynarex.new 'entries[doc]/entry(title, url)', autosave: true,
532
- debug: @debug, order: 'title ascending'
533
- dx.save indexfile
539
+ debug: @debug, order: 'title ascending', filepath: indexfile
540
+
541
+
542
+ entries.each do |entry|
543
+
544
+ record = {title: entry.heading + ' #' + entry.tags.join(' #'),
545
+ url: [@base_url, File.basename(@filename)[/.*(?=\.\w+)/],
546
+ URI.escape(entry.heading.gsub(/ /,'_'))].join('/')}
547
+
548
+ dx.create record
549
+
550
+ end
551
+
552
+ puts ('indexfile: ' + indexfile.inspect).debug if @debug
553
+ dx.save indexfile
534
554
  dx
535
555
 
536
556
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiki_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  N5hZmnA6M2h3NysLCPRtwS2vMJh8qq6OS5RjU9cc5V08vyIkQ7/YC/x+7kLm5Kn0
36
36
  kvoWXxa8gpUBS+qMlSYFDHlq
37
37
  -----END CERTIFICATE-----
38
- date: 2020-01-24 00:00:00.000000000 Z
38
+ date: 2020-02-03 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dxsectionx
metadata.gz.sig CHANGED
Binary file