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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f5aa2a91b9258fa609b6e9bb08aca5d91dd570d
4
- data.tar.gz: ca4e379f7d992f9545c32e7f492e0c4f01357d66
3
+ metadata.gz: 533e2c755cd1383e4d42c5904db3ff94a5b6a0a6
4
+ data.tar.gz: e52b3d3e4c071ac359d8581557459bac3a518e11
5
5
  SHA512:
6
- metadata.gz: 2f9c137dc7bad47c8b026aff236bf3567650bdff10738875067fa1205c9d91773838d19b452a46b4bf4951255f753f6f87d4f9bac515524b256317c66a1049de
7
- data.tar.gz: 5f7f90fe348ccc0d175270f7f7e5430da19429076b31aae84a124b1e6fd353ee87c4bb7ef2631d2cd1e25a08d75faa12b2c364e78b4c27cb1dff51a0c0af20f7
6
+ metadata.gz: 8a5f231715d1ee779371a5c9ebc814e6f3e864356f01dcf660a4ec08f46a85b466939fd15c9c4e91ea06f9f03842696ec0a13b22b93928a0d2e4a8868d3759ba
7
+ data.tar.gz: 26ffb30df58af15de82cd18e867209c17c1c5f0a05c85e2bdd10b6ddd9866473a17fe3b87aa070c9e81485eeea2f12617109eb24aebefc2a1063573c6b1b6272
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- ������6L��=��c�'�ګ?-q&�v2ѽ��~9uDB�~T`FYb_qgu)R��W��F�"��>���5>��ݜ}-�(GD?�|;]*���D8y�!Q��?����qq@��x� ���?������j���r�y��5$hb.mcΝ<��Oy/�;v9
1
+ $���t<��qz X��gHL�����{P��s��>�n!6/٩��&��q�ofe,��R~#���MtOH7;��ڏ�BG�,⿈-P��k5�i��)KeT.wO���򷯆���U��kk�,gT��E�Wl�3�z�iv7������ӳ��+"��*���,�W���hB��Ҫ)cR^��� ��B���loevdGɁ3�9��)-�,�wnl�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 = s11
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/,' &#9744; ').gsub(/\s\[x\]\s/,' &#9745; ')
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
- end
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.11
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-03-29 00:00:00.000000000 Z
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