martile 0.6.31 → 0.6.32

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
  SHA1:
3
- metadata.gz: 41448a9a72bef7a0b5e53a5713cfeb9a65359398
4
- data.tar.gz: 8494bc55ced4cb4734d3d46c53d6cd498b9eae7a
3
+ metadata.gz: 9f2923ea96d408824def1ebffedd006f6f5e1a60
4
+ data.tar.gz: 7c870c715b34ef66dce979418fad4198a443c2b7
5
5
  SHA512:
6
- metadata.gz: 7272cfa72e8c80e55aca395234f2b63be9fde6ce080298940e9350d023ed913381fa478b59afdf5d1895fc30dee3e376c10e4947b1864c019703cfbeb2aa0270
7
- data.tar.gz: adcafa313630728c10b95776148a5cc4274acd37003724aa3986392bc7e9f49734d20cb26716990b00d1882e82d9745b64deb04d5eedddbec55f3593d4554a21
6
+ metadata.gz: 7f5e18ef28c75eab6bac5d79f0f1d21c927d18c2b91ca9167c891b6c0b561c069b2693cc5d2d3aafe767339cd1be49a2ef4750ae095b251b49ef7ad7e5e3776b
7
+ data.tar.gz: fa842dfcc0e79e25c688c242cf9ffd407dfeffac7da600e458bd0b174ce0ab0900366712c426c0dae35e7469974dc1cecc7af88ee2424258bdd47f6835f9b323
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -9,6 +9,8 @@ require 'rdiscount'
9
9
  require 'kvx'
10
10
 
11
11
 
12
+ # minor feature:
13
+ # 3-Feb-2017 a video smartlink can now include options e.g. loop: true
12
14
  # bug fix: 29-Jan-2017 2 or more code listings should now be parsed correctly
13
15
  # feature: 24-Jun-2016 links containing a right parenthesis at the
14
16
  # end are no longer cropped
@@ -545,21 +547,27 @@ class Martile
545
547
 
546
548
  def videotag(s)
547
549
 
548
- s.gsub(/\B!v\[\]\((https?:\/\/[^\)]+)\)\B/) do |x|
549
-
550
+ s.gsub(/\B!v\[\]\((https?:\/\/[^\)]+)\)(\{[^\}]+\})?/) do |match|
551
+
550
552
  files = ($1).split
553
+ attr = ($2)
554
+
555
+ h = attr ? attr.scan(/(\w+):\s+(\w+)/).to_h : {}
556
+ attributes = h.any? ? (' ' +
557
+ h.map {|k,v| "%s='%s'" % [k,v]}.join(' ')) : ''
551
558
 
552
- h = {
559
+ h2 = {
553
560
  /\.og[gv]$/ => 'ogg', /\.mp4$/ => 'mp4', /\.mov$/ => 'mov',
554
561
  /\.webm$/ => 'webm'
555
562
  }
556
563
 
557
564
  sources = files.map do |file|
558
- type = h.detect{|k,v| file[k] }.last
565
+
566
+ type = h2.detect{|k,v| file[k] }.last
559
567
  " <source src='%s' type='video/%s'/>" % [file, type]
560
568
  end
561
569
 
562
- "<video controls='controls'>\n%s\n</video>" % [sources.join("\n")]
570
+ "<video controls='controls'%s>\n%s\n</video>" % [attributes, sources.join("\n")]
563
571
  end
564
572
 
565
573
  end
data.tar.gz.sig CHANGED
Binary file
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.31
4
+ version: 0.6.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- g]د�j�� ۯ��b
2
- C��yحð���!|Wo)j6R2��uY������^ғ�9��i.���n�u����h�* M��� }Pj�`�;�ƲL(ZHbgFޣ�Ϳ9�$�X���`g����Da��5��Z�J��L"��n
3
- 2(��v*���Q_�d��Tiޔf  �֞)B�E��EY��qO�xD���K\�$���� �7�-�d��!�`�.� �0��vZ� ��{�7�����U-F�B��jr
1
+ �==�HV��8x��-:�#m�ɐ�ԑ�(�p8
2
+ &�nQ �O�AȄ���B��P�� � "N��JQQJ�)���Jz��En��,w|��[*���˕��� CEkt܌�39(���,)�i�d�Y +�d��?���F�(�{|��G��o���x��W��^dq����|p�6X�tёZ-�ܿ�U�cͣ�,�Ɣ�r�����#Җ{���`L9IX(�$�G�QhFv��t_ `&��3W-F��n�O&�V