wiki_md 0.7.2 → 0.7.3

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: 38973a10f21192f8544110548615d754d018e988a12feba21e4bb1e67a3cc23e
4
- data.tar.gz: ae0624231185e275069de171bfa4ab23b67eb7ff14d6210107399a62b2006c12
3
+ metadata.gz: 530d021b34044f9b6c7c898aa12ad389ddb51ed46fa0daedf203d6c5a0daf2a3
4
+ data.tar.gz: 770507b1927a1f58ddb7927d9a4f4e381f84a85ac25093f9c2efc38714e047a4
5
5
  SHA512:
6
- metadata.gz: 9b14eae599801501a44c0b02f3a67a1a0160511254f2f938b65c04730d31c5aa474b5763cffab98f3b32994241da7202ae71f35f430ea7ee6f6d96ef05ea0d70
7
- data.tar.gz: aa5693cc2fd3ee12620e24705ecfa0a47e10c17e5bdb24a80fb68ad0b87e9aea75126ab0db98da721a9f2732802f0e8fdcfe053f69ef9386e225dd726661fac3
6
+ metadata.gz: 9b335fde528b54db2da43e56744ea19f90ea9f240c8b6dc82e87874d7c136b4aa85ade7b0cdbd3110df7f717575d5b93a152726b1a4aeadb6445aa7978f0fa15
7
+ data.tar.gz: 6053f8a680cadd4861cf1630a837301530b8d04b18d10f9c59de2d14da42aa2caf6725aeee87eab8aa3109a0d6c0b835e78d4b5246bf39a4b56133d95b62bfb3
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/wiki_md.rb CHANGED
@@ -129,7 +129,7 @@ class WikiMd
129
129
 
130
130
 
131
131
  def create_section(s)
132
-
132
+
133
133
  @active_heading = title = s[/(?<=^# ).*/]
134
134
 
135
135
  tagline = s.rstrip.lines.last[/(?<=^\+\s).*/]
@@ -185,12 +185,23 @@ class WikiMd
185
185
  end
186
186
 
187
187
 
188
- def find(q)
188
+ def find(q, exact_match: false)
189
189
 
190
190
  puts ('WikiMd::find q: ' + q.inspect).debug if @debug
191
191
  return Entry.new(@dxsx.dx.find q) if q =~ /^\d+$/
192
- regex = q.is_a?(String) ? /#{q}/i : q
193
- r = @dxsx.dx.all.find {|section| section.x.lines.first =~ regex }
192
+
193
+ regex = if q.is_a?(String) then
194
+ exact_match ? /#{q}$/i : /#{q}/i
195
+ else
196
+ q
197
+ end
198
+
199
+ r = @dxsx.dx.all.find do |section|
200
+
201
+ section.x.lines.first =~ regex
202
+
203
+ end
204
+
194
205
  puts (' r: ' + r.inspect).debug if @debug
195
206
  return unless r
196
207
 
@@ -234,8 +245,37 @@ EOF
234
245
  section = find heading
235
246
 
236
247
  if section then
248
+
249
+ # find any newly created links which now have a destination page
237
250
 
238
- r = section.x
251
+ sectionx = section.x.lines.map do |x|
252
+
253
+ link = x[/\?([^\?]+)\?/,1]
254
+
255
+ if link then
256
+
257
+ a = link.split
258
+ r = a.last =~ /\//
259
+
260
+ if not r then
261
+
262
+ heading = a[0..2].join
263
+
264
+ if find heading then
265
+ x.sub!(/\?[^\?]+\?/, "[%s](%s)" % [heading, a.last])
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ x
272
+ end.join
273
+
274
+ puts ('sectionx: ' + sectionx.inspect).debug if @debug
275
+
276
+ section.x = sectionx unless section.x == sectionx
277
+
278
+ r = section
239
279
 
240
280
  puts ('@domain: ' + @domain.inspect).debug if @debug
241
281
  r.instance_variable_set(:@domain, @domain)
@@ -244,7 +284,7 @@ EOF
244
284
 
245
285
  def r.to_html()
246
286
 
247
- lines = self.lines
287
+ lines = self.x.lines
248
288
  last_line = lines.last
249
289
 
250
290
  content, tags = if last_line[0] == '+' then
@@ -255,11 +295,13 @@ EOF
255
295
 
256
296
  else
257
297
 
258
- [self, []]
298
+ [self.x, []]
259
299
 
260
300
  end
261
301
 
262
- html = Martile.new(content, ignore_domainlabel: @domain).to_html
302
+ s = block_given? ? yield(content) : content
303
+
304
+ html = Martile.new(s, ignore_domainlabel: @domain).to_html
263
305
  tags_html = Kramdown::Document.new(tags.join("\n")).to_html\
264
306
  .sub('<ul>','<ul id="tags">')
265
307
  html + "\n\n" + tags_html
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.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,48 +35,48 @@ cert_chain:
35
35
  nEQURKgvgTAqVg9tuqcjEE861mSCPc+12rmUHVBZDxMDQF6CQbnOxrYRIS+7fnia
36
36
  kikBQtN17cUMyGOrZTVRhVGR
37
37
  -----END CERTIFICATE-----
38
- date: 2019-01-15 00:00:00.000000000 Z
38
+ date: 2019-01-20 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dxsectionx
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '0.3'
47
44
  - - ">="
48
45
  - !ruby/object:Gem::Version
49
46
  version: 0.3.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.3'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '0.3'
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
56
  version: 0.3.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.3'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: dynarex-tags
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '0.4'
67
64
  - - ">="
68
65
  - !ruby/object:Gem::Version
69
66
  version: 0.4.0
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.4'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '0.4'
77
74
  - - ">="
78
75
  - !ruby/object:Gem::Version
79
76
  version: 0.4.0
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.4'
80
80
  description:
81
81
  email: james@jamesrobertson.eu
82
82
  executables: []
@@ -103,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubyforge_project:
107
- rubygems_version: 2.7.6
106
+ rubygems_version: 3.0.2
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: 'Designed for maintaining many wiki entries within a single document in Markdown
metadata.gz.sig CHANGED
Binary file