wikisys 0.4.3 → 0.4.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: efc308c07d4ba81540d515d9e0ea02f7c60c74aedeea31e771a228af9c29b436
4
- data.tar.gz: fccd8271b207195f628a8f0bd7aea544545b02aead003bfd401cb51b1b589ac2
3
+ metadata.gz: ae7927009247eb0c4ba3820315c78e8a1f822ba201ccd20ed29fc909068a8f95
4
+ data.tar.gz: 5f153c0f68c9c1497fed420e6569d731932d8ea9666a8cd8b76d5324c65775d4
5
5
  SHA512:
6
- metadata.gz: 25bfc39f238a76d18e37d62b104abb495adb83739a1cb2122c03078b92d1b6b353b5331f7bd483aeb6760ac580fa7823b82c9f1d9bfe2ae59f68b5b7718bd46a
7
- data.tar.gz: 0b0e0335c7e15496b52b8f09bd14442f1bf9877671de04e46f47d7e73f610711052896c967f0fe05569322ed2b3d11377449731cbbafca593fcb957e47fa3c13
6
+ metadata.gz: 10f1a4712a081beff1b802960a7930ca6f69be9363671ba2191ea1ac4e2098a6538cfd68f07ae1852d1b7f690febae6de9e2441376bdcb1b17a4bf34e97d2b49
7
+ data.tar.gz: c5c771e88170a318f3972e34314e14d91db806cfe951649bcd2e87db40c8656f18e309975c00025ebb610dea2722e5813efef13aacf3aaaa5d77d152ea2477dc
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/wikisys.rb CHANGED
@@ -28,11 +28,24 @@ module FileFetch
28
28
  end
29
29
  end
30
30
 
31
+ module StringCase
32
+
33
+ refine String do
34
+
35
+ def capitalize2()
36
+ self.sub(/^[a-z]/) {|x| x.upcase }
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
31
43
  module Wikisys
32
44
 
33
45
  class Wiki
34
46
  include FileFetch
35
47
  using ColouredText
48
+ using StringCase
36
49
 
37
50
  attr_accessor :title, :content, :tags
38
51
  attr_reader :to_xml
@@ -201,13 +214,13 @@ module Wikisys
201
214
 
202
215
  if r then
203
216
 
204
- e.attributes[:title] = title.capitalize
217
+ e.attributes[:title] = title.capitalize2
205
218
 
206
219
  else
207
220
 
208
- make_page(title.capitalize)
221
+ make_page(title.capitalize2)
209
222
  e.attributes[:class] = 'new'
210
- e.attributes[:title] = title.capitalize + ' (page does not exist)'
223
+ e.attributes[:title] = title.capitalize2 + ' (page does not exist)'
211
224
 
212
225
  end
213
226
 
@@ -334,19 +347,51 @@ module Wikisys
334
347
  def new_pg(filename)
335
348
 
336
349
  @pg.new_build(filename)
350
+ @entries.save
351
+
337
352
  update_mw(@pg.title, @pg.tags)
353
+ @mw.save if @mw.lines.any?
354
+
355
+ build_html(filename)
338
356
 
339
357
  end
340
358
 
341
359
  def update_pg(filename)
342
360
 
343
361
  @pg.modify_build(filename)
362
+ @entries.save
363
+
344
364
  update_mw(@pg.title, @pg.tags)
365
+ @mw.save if @mw.lines.any?
366
+
367
+ build_html(filename)
345
368
 
346
369
  end
347
370
 
348
371
  private
349
372
 
373
+ def build_html(filename)
374
+
375
+ xml_file = filename.sub(/\.md$/,'.xml')
376
+ filepath = File.join(@filepath, 'xml', xml_file)
377
+ s = @pg.read_file filepath
378
+ title = Rexle.new(s).root.text('heading')
379
+ puts 'about to search title: ' + title.inspect if @debug
380
+ found = @mw.search(title)
381
+
382
+ if found then
383
+
384
+ links = found.breadcrumb.map do |x|
385
+ [x, x.gsub(/ +/,'-') + '.html']
386
+ end
387
+
388
+ @pg.create_breadcrumb(filepath, links)
389
+
390
+ end
391
+
392
+ @pg.write_html xml_file
393
+
394
+ end
350
395
 
351
396
  # Check if any of the md files have been modified or newly created
352
397
  #
@@ -370,24 +415,7 @@ module Wikisys
370
415
 
371
416
  (h[:new] + h[:modified]).each do |filename|
372
417
 
373
- xml_file = filename.sub(/\.md$/,'.xml')
374
- filepath = File.join(@filepath, 'xml', xml_file)
375
- s = pg.read_file filepath
376
- title = Rexle.new(s).root.text('heading')
377
- puts 'about to search title: ' + title.inspect if @debug
378
- found = @mw.search(title)
379
-
380
- if found then
381
-
382
- links = found.breadcrumb.map do |x|
383
- [x, x.gsub(/ +/,'-') + '.html']
384
- end
385
-
386
- pg.create_breadcrumb(filepath, links)
387
-
388
- end
389
-
390
- pg.write_html xml_file
418
+ build_html filename
391
419
 
392
420
  end
393
421
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikisys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  O3SRDzvvWXrwDFGyRDmGqdEw51FKHPw/6pk4ci0QPIvQEgOyPKfdSesPWmNmtxpf
36
36
  KX/89ohIpftt89vtcCI21R5u
37
37
  -----END CERTIFICATE-----
38
- date: 2021-01-31 00:00:00.000000000 Z
38
+ date: 2021-02-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dir-to-xml
metadata.gz.sig CHANGED
Binary file