wiki_md 0.8.3 → 0.8.4

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: 408698c62b969e712beb279dee3d60915fc46a023cf44b9b7d17d2d03ff4a32f
4
- data.tar.gz: a72992cc840872a1dde3c8918d42d46f3ba83a03887b1527b3899dc5ac48f137
3
+ metadata.gz: f179c7fda9f033d0fd9480f52210a7fc7cdbd130284438382287dcf23a2ba86c
4
+ data.tar.gz: 8ad74ac23cf8e38085e52e1873358117cefc5f0785fd4031c5816dd8a05229ea
5
5
  SHA512:
6
- metadata.gz: 43d2129e8231a72c2b29da45211980bfdf7bfacfed17ea1e7f46f8e68a09367b4cf27a1fc4b56354543b5e4f49b54d5e57b4a03e2bfbe51f54e376faca7d55f0
7
- data.tar.gz: 9962124d7bf79537502b5aa2bb62eff4b48a36cfe3705ecd6e1bfaddc785f8c2b296c27a5fa200d433550c2f93f42293514a492ea6d0fe75acced2a44af0408a
6
+ metadata.gz: 0c970215b77aee87f6f4c553ae473eeacac64274f0f64465288a8cfa39699081e51d0fee84176b9b781e3b58f8926adf650711e67fd33fce7a731c0704f8728a
7
+ data.tar.gz: 68834b7e7629348c33c721e4fd191287b9162c830ffce2f88a89d86fc456a655d08f35ba70c1263286857973913de42432da2311597a667f4ffceeba84575b65
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/wiki_md.rb CHANGED
@@ -88,6 +88,8 @@ class WikiMd
88
88
 
89
89
  end
90
90
 
91
+
92
+
91
93
  if type == :unknown and s.lines.length == 1 then
92
94
 
93
95
  #if FileX.exists?(File.dirname(s)) then
@@ -109,7 +111,14 @@ class WikiMd
109
111
 
110
112
  @filename = wiki
111
113
 
112
- valid, msg = validate s
114
+ valid, msg = if s =~ /^<\?wikimd\b/ then
115
+ true
116
+ else
117
+ validate(s)
118
+ end
119
+
120
+
121
+
113
122
  raise WikiMdReadError, msg unless valid
114
123
 
115
124
  puts ('s: ' + s.inspect).debug if @debug
@@ -120,15 +129,23 @@ class WikiMd
120
129
 
121
130
  indexfile = File.join(@filepath, 'index.xml')
122
131
 
132
+ if s != FileX.read(wiki) then
133
+
134
+ puts '*** file changed! ***'.info if @debug
135
+ FileX.rm indexfile
136
+ FileX.rm File.join(@filepath, 'dxtags.xml')
137
+
138
+ end
139
+
123
140
  # check for the index.xml file
124
- @dx = load_index(indexfile)
125
- save()
141
+ @dx = load_index(indexfile) if FileX.exists? indexfile
126
142
 
127
143
  else
128
144
 
129
145
  @dxsx = read_raw_document s
130
146
 
131
147
  end
148
+
132
149
 
133
150
  else
134
151
 
@@ -136,10 +153,10 @@ class WikiMd
136
153
 
137
154
  end
138
155
 
139
-
156
+
140
157
  @filepath ||= '.'
141
158
 
142
- @dxtags = DynarexTags.new(@filepath, debug: debug)
159
+ @dxtags = DynarexTags.new(@filepath, debug: debug)
143
160
 
144
161
  end
145
162
 
@@ -348,7 +365,13 @@ EOF
348
365
  @filepath = File.expand_path(File.dirname(@filename).to_s)
349
366
  puts '@filepath: ' + @filepath.inspect if @debug
350
367
 
351
- FileX.write @filename=filename, dx_to_wmd(@dxsx.to_dx)
368
+ puts 'dx_to_wmd: ' + dx_to_wmd(@dxsx.to_dx) if @debug
369
+
370
+ contents = dx_to_wmd(@dxsx.to_dx)
371
+ FileX.write @filename=filename, contents
372
+
373
+ # make a backup file
374
+ FileX.write @filename.sub(/\.\w+$/,'.bak'), contents
352
375
 
353
376
  puts ('before @dxsx save').debug if @debug
354
377
  @dxsx.save filename.sub(/\.md$/, '.xml')
@@ -400,7 +423,7 @@ EOF
400
423
  .gsub(/-{2,}/,'-').gsub(/^-|-$/,'')]
401
424
  end
402
425
 
403
- OpenStruct.new(heading: key, body: body.join("\n"))
426
+ OpenStruct.new(heading: key + " (#{value.length})", body: body.join("\n"))
404
427
 
405
428
  end
406
429
 
@@ -570,6 +593,7 @@ EOF
570
593
  dx = Dynarex.new 'entries[doc]/entry(title, url)', autosave: true,
571
594
  debug: @debug, order: 'title ascending', filepath: indexfile
572
595
 
596
+ @dxtags = DynarexTags.new(@filepath, debug: @debug)
573
597
 
574
598
  entries.each do |entry|
575
599
 
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.3
4
+ version: 0.8.4
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-02-04 00:00:00.000000000 Z
38
+ date: 2020-02-05 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dxsectionx
metadata.gz.sig CHANGED
Binary file