martile 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/martile.rb +28 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1180f8084a2a565f0413e5559ba1b49edac1616
|
4
|
+
data.tar.gz: 832e0107f0e7964b8d6f1b49724ef37499d513be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f1f55791cec859496fdda8c4c1e203a16fd20cdcdbf9b94b7ab559ffb9aea7d376c2ad1c757d33ec17896ef90915eedad6b906fd1b93196788b049a9ff4dee6
|
7
|
+
data.tar.gz: be29e0b4d49468f782eea9ce318bb5ccc2552d208d7391d8765ac23fa33cc220b9a09ab11001b87cc464c9b499d53f8f71d7912806f645b4737c9529c55b4121
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -8,6 +8,8 @@ require 'dynarex'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
|
11
|
+
# feature: 06-Jul-2015 dynarex_to_table(): A URL within a
|
12
|
+
# col is now hyperlinked
|
11
13
|
# feature: 02-Jul-2015 Apply_filter() now filters out pre and code tags
|
12
14
|
# The shorthand !i[]() can now render an iframe tag
|
13
15
|
# e.g. !i[](http://somefile.url/sometext.txt)
|
@@ -213,7 +215,32 @@ class Martile
|
|
213
215
|
dx = Dynarex.new($1)
|
214
216
|
keys = dx.to_h.map(&:keys).first
|
215
217
|
|
216
|
-
|
218
|
+
raw_vals = dx.to_h.map(&:values)
|
219
|
+
|
220
|
+
# create Markdown hyperlinks for any URLs
|
221
|
+
|
222
|
+
vals = raw_vals.map do |row|
|
223
|
+
|
224
|
+
row.map do |col|
|
225
|
+
|
226
|
+
found_match = col.match(/https?:\/\/([^\/]+)(.*)/)
|
227
|
+
|
228
|
+
r = if found_match then
|
229
|
+
|
230
|
+
domain, path = found_match.captures
|
231
|
+
|
232
|
+
a = domain.split('.')
|
233
|
+
a.shift if a.length > 2
|
234
|
+
url_title = (a.join + path)[0..39] + '...'
|
235
|
+
|
236
|
+
"[%s](%s)" % [url_title, col]
|
237
|
+
else
|
238
|
+
col
|
239
|
+
end
|
240
|
+
|
241
|
+
r
|
242
|
+
end
|
243
|
+
end
|
217
244
|
|
218
245
|
widths = ([keys] + vals).transpose.map{|x| x.max_by(&:length).length}
|
219
246
|
th = '|' + keys.join('|') + "|\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: martile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
fnr5l+RI/6f8lfxBNgDrktGB/RwPkOyWtyKk1tu9CWgHmptxL0JglikCXg5MzuZI
|
32
32
|
tZzXOvXUoUf1VQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-07-
|
34
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
metadata.gz.sig
CHANGED
Binary file
|