martile 0.5.11 → 0.5.12
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 +1 -1
- data.tar.gz.sig +0 -0
- data/lib/martile.rb +47 -2
- 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: 533e2c755cd1383e4d42c5904db3ff94a5b6a0a6
|
4
|
+
data.tar.gz: e52b3d3e4c071ac359d8581557459bac3a518e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a5f231715d1ee779371a5c9ebc814e6f3e864356f01dcf660a4ec08f46a85b466939fd15c9c4e91ea06f9f03842696ec0a13b22b93928a0d2e4a8868d3759ba
|
7
|
+
data.tar.gz: 26ffb30df58af15de82cd18e867209c17c1c5f0a05c85e2bdd10b6ddd9866473a17fe3b87aa070c9e81485eeea2f12617109eb24aebefc2a1063573c6b1b6272
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
$���t<��qz�X��g�H�L�����{P��s��>�n!6/٩��&��q�ofe,��R~#���MtOH7;��ڏ�BG�,⿈-P��k5�i��)K�eT.wO������U��kk�,gT��E�Wl�3�z�iv7������ӳ��+"��*���,�W���hB��Ҫ)�cR^��� ��B���loevdGɁ3�9��)-�,�w�n�l�I���G@�����lB�� P��u�U�����-����:
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -8,6 +8,9 @@ require 'dynarex'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
|
11
|
+
# feature: 31-May-2015: Transforms a kind-of markdown URL to an audio tag
|
12
|
+
# e.g. !a[](http://someurl) transforms to ). Transforms a kind-of
|
13
|
+
# markdown URL to an video tag e.g. !v[](http://someurl) transforms to )
|
11
14
|
# feature: 29-Mar-2015: Borrowed the strikethru feature from Mtlite
|
12
15
|
# bug fix: 28-Mar-2015: Fixes a bug introduced on the 20-Mar-2015 relating to
|
13
16
|
# Markdown lists not being converted to HTML
|
@@ -102,15 +105,35 @@ class Martile
|
|
102
105
|
#s10 = apply_filter(s9) {|x| section x }
|
103
106
|
s10 = apply_filter(s9) {|x| mtlite_utils x }
|
104
107
|
s11 = section s10
|
108
|
+
s12 = apply_filter(s11){|x| audiotag x}
|
109
|
+
s13 = apply_filter(s12){|x| videotag x}
|
105
110
|
|
106
111
|
|
107
112
|
|
108
113
|
#puts 's8 : ' + s8.inspect
|
109
114
|
|
110
|
-
@to_html =
|
115
|
+
@to_html = s13
|
111
116
|
end
|
112
117
|
|
113
118
|
private
|
119
|
+
|
120
|
+
def audiotag(s)
|
121
|
+
|
122
|
+
s.gsub(/\B!a\[\]\((https?:\/\/[^\)]+)\)\B/) do |x|
|
123
|
+
|
124
|
+
files = ($1).split
|
125
|
+
|
126
|
+
h = {/\.ogg$/ => 'ogg', /\.wav$/ => 'wav', /\.mp3$/ => 'mp3' }
|
127
|
+
|
128
|
+
sources = files.map do |file|
|
129
|
+
type = h.detect{|k,v| file[k] }.last
|
130
|
+
" <source src='%s' type='audio/%s'/>" % [file, type]
|
131
|
+
end
|
132
|
+
|
133
|
+
"<audio controls='controls'>\n%s\n</audio>" % [sources.join("\n")]
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
114
137
|
|
115
138
|
def code_block_to_html(s)
|
116
139
|
|
@@ -243,6 +266,8 @@ class Martile
|
|
243
266
|
# and [x] with a unicode checked checkbox
|
244
267
|
s2 = s.gsub(/\s\[\s*\]\s/,' ☐ ').gsub(/\s\[x\]\s/,' ☑ ')
|
245
268
|
|
269
|
+
# create domain labels for hyperlinks
|
270
|
+
#
|
246
271
|
s3 = s2.gsub(/(?:^\[|\s\[)[^\]]+\]\((https?:\/\/[^\s]+)/) do |x|
|
247
272
|
|
248
273
|
next x if @ignore_domainlabel and x[/#{@ignore_domainlabel}/]
|
@@ -349,4 +374,24 @@ class Martile
|
|
349
374
|
a2.join
|
350
375
|
end
|
351
376
|
|
352
|
-
|
377
|
+
def videotag(s)
|
378
|
+
|
379
|
+
s.gsub(/\B!v\[\]\((https?:\/\/[^\)]+)\)\B/) do |x|
|
380
|
+
|
381
|
+
files = ($1).split
|
382
|
+
|
383
|
+
h = {
|
384
|
+
/\.og[gv]$/ => 'ogg', /\.mp4$/ => 'mp4', /\.mov$/ => 'mov',
|
385
|
+
/\.webm$/ => 'webm'
|
386
|
+
}
|
387
|
+
|
388
|
+
sources = files.map do |file|
|
389
|
+
type = h.detect{|k,v| file[k] }.last
|
390
|
+
" <source src='%s' type='video/%s'/>" % [file, type]
|
391
|
+
end
|
392
|
+
|
393
|
+
"<video controls='controls'>\n%s\n</video>" % [sources.join("\n")]
|
394
|
+
end
|
395
|
+
|
396
|
+
end
|
397
|
+
end
|
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.5.
|
4
|
+
version: 0.5.12
|
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-
|
34
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
metadata.gz.sig
CHANGED
Binary file
|