martile 0.6.8 → 0.6.11

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: 047df8e816c678ff60a333e8b0b1a7883781b2b6
4
- data.tar.gz: 725d1fa7318ddcb909475a216076587505b50f38
3
+ metadata.gz: bd4522ed58390fe2c6f6eb491467e2a8d1963bc6
4
+ data.tar.gz: 076fae861973d8a222a422219014316f39ef799e
5
5
  SHA512:
6
- metadata.gz: 5785400f160e2565afc7244253c8be5d8adb37225bc8b6451936df3b982534f5d0af94af213b102527135763a8e54e5c265144e0c440af2130f0cf8d4ad224c1
7
- data.tar.gz: 51f2a250dcba07bfe43e11ffcb98a555f005aa5ac6e75932bfe1e9464364a9d6856e5c6ec3208787b025c173bf887115cd2929b4dec1f06f311ad4b652fef86b
6
+ metadata.gz: ee0becd0a1a4e4b8ed2c74de64d23196afeab8540fbe4bb986464cb7dabc2c2f94893b84e3b0c05b6560d8d90aeb6931953a40e1dbf7f9246064cea623769b75
7
+ data.tar.gz: d3ea9542e9956c2d344ec33f62686eca3fdf070e8b290791a758ac539769355d0f636947c1dab0f4ccd49ff70b595703ed15e2705117733fcdc0ce2c36c7758a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -6,8 +6,11 @@
6
6
  #require 'rexle'
7
7
  require 'dynarex'
8
8
  require 'rdiscount'
9
+ require 'kvx'
9
10
 
10
11
 
12
+ # feature: 09-Aug-2015 kvx_to_dl() can convert a kind of
13
+ # markdown URL to a DL HTML list
11
14
  # feature: 02-Aug-2015 dynarex_to_table() is now know as dynarex_to_markdown()
12
15
  # A markdown list will be rendered from a Dynarex
13
16
  # document if there is only a single field column
@@ -125,10 +128,11 @@ class Martile
125
128
  s12 = apply_filter(s11){|x| audiotag x}
126
129
  s13 = apply_filter(s12){|x| videotag x}
127
130
  s14 = apply_filter(s13){|x| iframetag x}
131
+ s15 = apply_filter(s14){|x| kvx_to_dl x}
128
132
 
129
133
  #puts 's8 : ' + s8.inspect
130
134
 
131
- @to_s = s14
135
+ @to_s = s15
132
136
  end
133
137
 
134
138
  def to_html()
@@ -220,7 +224,22 @@ class Martile
220
224
  end
221
225
  end
222
226
  end
223
-
227
+
228
+ def kvx_to_dl(s)
229
+
230
+ s.gsub(/:(\[.*\])\(((?:https?:\/\/)?[\w\/\.\-]+)\)?/) do |match|
231
+
232
+ source = ($1)
233
+ raw_select = ($2)
234
+ h = Kvx.new(raw_select).body
235
+
236
+ a = h.map do |k,v|
237
+ "<dt>%s</dt><dd>%s</dd>" % [k,v]
238
+ end
239
+ "<dl>" + a.join("\n") + "</dl>"
240
+ end
241
+
242
+ end
224
243
 
225
244
  def escape(s)
226
245
  s.gsub('<','&lt;').gsub('>','&gt;')
@@ -235,7 +254,9 @@ class Martile
235
254
  "<iframe src='%s'></iframe>" % [url]
236
255
  end
237
256
 
238
- end
257
+ end
258
+
259
+
239
260
 
240
261
  def list_to_html(s,symbol='#')
241
262
 
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.8
4
+ version: 0.6.11
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-08-02 00:00:00.000000000 Z
34
+ date: 2015-08-09 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdiscount
@@ -73,6 +73,26 @@ dependencies:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.5.26
76
+ - !ruby/object:Gem::Dependency
77
+ name: kvx
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.5'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 0.5.8
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '0.5'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 0.5.8
76
96
  description:
77
97
  email: james@r0bertson.co.uk
78
98
  executables: []
metadata.gz.sig CHANGED
Binary file