wiki_md 0.4.1 → 0.4.2

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: a314fa02253872441fd68c16c6d8158745401fe6e58ef5fdd8657421a88577e9
4
- data.tar.gz: b4f20db2f094e64b9b43a7fbcf2eefb6b040f9b60b7382da94ba930272b7caff
3
+ metadata.gz: d7dae25e868d52bfea1461356265ae5b03e61fd5c88eab4c1c777d5b5d7e8e00
4
+ data.tar.gz: 6915a2cbe47d1e4149c3382b1115b7e7381d139cc717090f35203bd045ae0cdc
5
5
  SHA512:
6
- metadata.gz: 1f9bf04cb1e0ec4daa637148acdea9158e8d078684dfa7d7e6338144e07b32da4e4ff16ace51d1e1ae349f19dd15f58ad00fb617b90489467e42fea8d5b05ad4
7
- data.tar.gz: 0dc5efff3dcfb9380ed01e9018a4d5a045b4f7311050bc90021e7d6e173105a33df12d1443c34c8c1a72da75043573c551cd51eca272e7c58f3a3799e5d68adf
6
+ metadata.gz: 1322e935d64b161170ba2954929c7997b5f02e07605b0b4672b3e9f62e81792cb3a2d5329ff908cf9bbee31677c6a718343ca99838cbd80b7c9ec0e8150516d9
7
+ data.tar.gz: dcf4f022352ca137e5c504237e45e1387913770206d08d5ce4e5be0c300bee7e8bb6e4a0bad65872c0f6ed9310fc98f0d727c78f41c94e61de9ae6da41275f9f
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- j��4뇫q�;j�Аd��ڌ��ޓ�h�\2�É��K�C:�i;��>#��Q��o}p{1����2li�Ƴ֤�Š�i�<Z\�Q�y8r=6|H$wۉ'-�i��M��`�O�7�#���M�K�͓�$ �O�
2
- l�� �d`6�#f*
3
- �Z�㗟N�^V���%�<y��W��5r�cR0��Xw��oW�1���R�:<��-x܏��]9"��n�+|�בI��fnv`�;~�S1Z�j�%BB6�F#�
1
+ �9��O��p솰 ��87^L�<j rn��.��ݙʗy����I��Ğ���Z;�ɾ�l������
2
+ ���.4�s���(�v��*�J�����g��i�g���D��p-�q��lB��������7�7�
data/lib/wiki_md.rb CHANGED
@@ -3,10 +3,12 @@
3
3
  # file: wiki_md.rb
4
4
 
5
5
  require 'dxsectionx'
6
+ require 'dynarex-tags'
6
7
 
7
8
 
8
9
  class WikiMd
9
10
  include RXFHelperModule
11
+ using ColouredText
10
12
 
11
13
  attr_reader :active_heading, :filename, :dx
12
14
 
@@ -20,7 +22,7 @@ class WikiMd
20
22
 
21
23
  s, type = RXFHelper.read(wiki, auto: false)
22
24
  @filename = wiki if type == :file or type == :dfs
23
- puts 's: ' + s.inspect if @debug
25
+ puts ('s: ' + s.inspect).debug if @debug
24
26
  @dxsx = DxSectionX.new s, debug: debug, autosave: true
25
27
 
26
28
  @filepath = File.dirname @filename
@@ -40,7 +42,7 @@ class WikiMd
40
42
 
41
43
  @filepath ||= '.'
42
44
 
43
- @dxtags = DynarexTags.new(@filepath)
45
+ @dxtags = DynarexTags.new(@filepath, debug: debug)
44
46
 
45
47
  end
46
48
 
@@ -83,11 +85,11 @@ class WikiMd
83
85
 
84
86
  def find(q)
85
87
 
86
- puts 'WikiMd::find q: ' + q.inspect if @debug
88
+ puts ('WikiMd::find q: ' + q.inspect).debug if @debug
87
89
  return @dxsx.dx.find q if q =~ /^\d+$/
88
90
  regex = q.is_a?(String) ? /#{q}/i : q
89
91
  r = @dxsx.dx.all.find {|section| section.x.lines.first =~ regex }
90
- puts ' r: ' + r.inspect if @debug
92
+ puts (' r: ' + r.inspect).debug if @debug
91
93
  return unless r
92
94
 
93
95
  heading2 = r.x.lines.last[/(?<=redirect ).*/]
@@ -131,7 +133,7 @@ EOF
131
133
 
132
134
  r = section.x
133
135
 
134
- puts '@domain: ' + @domain.inspect if @debug
136
+ puts ('@domain: ' + @domain.inspect).debug if @debug
135
137
  r.instance_variable_set(:@domain, @domain)
136
138
  r.instance_variable_set(:@tag_url, "%s/%s" % [@tag_base_url,
137
139
  File.basename(@filename)[/.*(?=\.\w+$)/]])
@@ -171,7 +173,7 @@ EOF
171
173
  @filepath = File.dirname(@filename)
172
174
  FileX.write @filename=filename, @dxsx.to_s
173
175
 
174
- puts 'before @dxsx save' if @debug
176
+ puts ('before @dxsx save').debug if @debug
175
177
  @dxsx.save filename.sub(/\.md$/, '.xml')
176
178
  @dx = new_index(File.join(@filepath, 'index.xml')) unless @dx
177
179
 
@@ -210,7 +212,7 @@ EOF
210
212
 
211
213
  def update_section(*args)
212
214
 
213
- puts 'inside update_section' if @debug
215
+ puts 'inside update_section'.debug if @debug
214
216
 
215
217
  val, raw_q = args.reverse
216
218
  puts ' val: ' + val.inspect if @debug
@@ -222,11 +224,23 @@ EOF
222
224
  return false unless r
223
225
 
224
226
  content = val =~ /# / ? val : r.x.lines.first + "\n" + val
225
- @active_heading = content[/(?<=^# ).*/]
226
- r.x = content
227
+ @active_heading = title = content[/(?<=^# ).*/]
228
+
227
229
 
228
230
  rx = @dx.all.find {|x| x.title =~ /#{q}/}
229
231
  tagline1 = content.lines.last[/^\+\s+(.*)/,1]
232
+
233
+ puts 'tagline1: ' + tagline1.inspect if @debug
234
+
235
+ s2 = if tagline1 then
236
+ content
237
+ else
238
+ a = title.split
239
+ tagline1 = a.length > 1 ? a.map(&:capitalize).join : a.first
240
+ content + "\n\n+ " + tagline1
241
+ end
242
+
243
+ r.x = s2
230
244
 
231
245
  if rx then
232
246
 
@@ -257,8 +271,10 @@ EOF
257
271
  end
258
272
 
259
273
  @dx.create title: @active_heading + ' #' + newtagline,
260
- url: [@base_url, File.basename(@filename),
274
+ url: [@base_url, File.basename(@filename)[/.*(?=\.\w+)/],
261
275
  URI.escape(@active_heading)].join('/')
276
+ @dxtags.generate
277
+
262
278
  end
263
279
 
264
280
  end
@@ -269,8 +285,8 @@ EOF
269
285
 
270
286
  if FileX.exists? indexfile then
271
287
 
272
- puts 'file found: ' + indexfile.inspect if @debug
273
- Dynarex.new indexfile, autosave: true
288
+ puts ('file found: ' + indexfile.inspect).debug if @debug
289
+ Dynarex.new indexfile, autosave: true, debug: @debug
274
290
 
275
291
  else
276
292
 
data.tar.gz.sig CHANGED
@@ -1,5 +1,5 @@
1
- T�
2
- ��S��0²Ad_�!����c{B��k��TJW.Ȣ�y=�ԃ���d;<M�C
3
- n���[!���?�����""�����~�
4
- �;''Vx��V��Se,�\0���~�@�����<��^��zE_���U����������3z=Gk�w;��Bm�n�M���H\ ��Hoʋ����]�[�R�4�*�/[�u�SS�rS�H�[�o�ST�v�t9s��rP���V��"��C3.ϋ��
5
- ���y���D�׍+�A .\�Y���kly0��Z�UD��9�H���^��.�#�+�x�Te��N���j�U�+��Ƶ�ЎF��
1
+ jeR�a����ؖ7T\��4�$��o/t�j+�o��24�Sd
2
+ NU�\,�����q���L
3
+ ��v��|���Y��1ą"�%����x
4
+ v��Mܞ�(��GKnAM�?®���
5
+ �`���f��XeuC��;
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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  nEQURKgvgTAqVg9tuqcjEE861mSCPc+12rmUHVBZDxMDQF6CQbnOxrYRIS+7fnia
36
36
  kikBQtN17cUMyGOrZTVRhVGR
37
37
  -----END CERTIFICATE-----
38
- date: 2018-11-02 00:00:00.000000000 Z
38
+ date: 2018-11-03 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dxsectionx
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0.3'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.3.1
69
+ version: 0.3.2
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.3'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.3.1
79
+ version: 0.3.2
80
80
  description:
81
81
  email: james@jamesrobertson.eu
82
82
  executables: []
metadata.gz.sig CHANGED
Binary file