martile 0.6.27 → 0.6.28
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/lib/martile.rb +48 -51
- data.tar.gz.sig +3 -3
- metadata +4 -3
- 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: 2c27a84eb62497e8c17af299fdb740c14e80f709
|
4
|
+
data.tar.gz: c62e29e1f18f2b76ab6f850cd7f3ffc58b8845f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc74c733a4aaf5e1fa3c638fdde27c3f56a3ae3d55fdb8cf5685cc569ddb01e80bc9ecfb1a269ed10af3cef4c74c63399d64ef64822036be12a65d5020fb5c9e
|
7
|
+
data.tar.gz: 1110f77cf75e3241839f5ae909dce8a71477375c9a083a54db88e6ef26d423820de5792b8f593c3a6a14afd9e2c87a83ae02c253bf189f6253b7a3f7d50790d7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -9,6 +9,7 @@ require 'rdiscount'
|
|
9
9
|
require 'kvx'
|
10
10
|
|
11
11
|
|
12
|
+
# bug fix: 11-Jun-2016 pre tags are now filtered out properly
|
12
13
|
# feature: 22-May-2016 Introduced the __DATA__ section which appears at
|
13
14
|
# the end of the document to reference 1 or more raw
|
14
15
|
# Dynarex documents
|
@@ -68,12 +69,13 @@ class Martile
|
|
68
69
|
@data_source = {}
|
69
70
|
|
70
71
|
@ignore_domainlabel = ignore_domainlabel
|
72
|
+
|
71
73
|
|
72
74
|
s0 = raw_s =~ /^__DATA__$/ ? parse__data__(raw_s) : raw_s
|
73
|
-
|
74
|
-
s1 = slashpre
|
75
|
-
#puts '
|
76
|
-
s2 = code_block_to_html(
|
75
|
+
#puts 's0: ' + s0.inspect
|
76
|
+
s1 = apply_filter(s0) {|x| slashpre x }
|
77
|
+
#puts 's1 : ' + s1.inspect
|
78
|
+
s2 = apply_filter(s1) {|x| code_block_to_html(x.strip + "\n") }
|
77
79
|
|
78
80
|
#puts 's2 : ' + s2.inspect
|
79
81
|
#s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
|
@@ -90,9 +92,9 @@ class Martile
|
|
90
92
|
s7 = apply_filter(s6) {|x| table_to_html x }
|
91
93
|
#puts 's7 : ' + s7.inspect
|
92
94
|
|
93
|
-
s8 = apply_filter(s7) {|x| underline x
|
95
|
+
s8 = apply_filter(s7) {|x| underline x}
|
94
96
|
#puts 's8: ' + s8.inspect
|
95
|
-
s9 = apply_filter(s8) {|x| section x }
|
97
|
+
s9 = apply_filter(s8) {|x| section x }
|
96
98
|
#puts 's9: ' + s9.inspect
|
97
99
|
|
98
100
|
s10 = apply_filter(s9) {|x| smartlink x }
|
@@ -101,20 +103,20 @@ class Martile
|
|
101
103
|
|
102
104
|
#s11 = section s9
|
103
105
|
#puts 's11 : ' + s11.inspect
|
104
|
-
s12 = apply_filter(s10){|x| audiotag x}
|
106
|
+
s12 = apply_filter(s10) {|x| audiotag x }
|
105
107
|
#puts 's12 : ' + s12.inspect
|
106
|
-
s13 = apply_filter(s12){|x| videotag x}
|
108
|
+
s13 = apply_filter(s12) {|x| videotag x }
|
107
109
|
#puts 's13 : ' + s13.inspect
|
108
|
-
s14 = apply_filter(s13){|x| iframetag x}
|
110
|
+
s14 = apply_filter(s13) {|x| iframetag x }
|
109
111
|
#puts 's14 : ' + s14.inspect
|
110
|
-
s15 = apply_filter(s14){|x| kvx_to_dl x}
|
112
|
+
s15 = apply_filter(s14) {|x| kvx_to_dl x }
|
111
113
|
#puts 's15 : ' + s15.inspect
|
112
|
-
s16 = apply_filter(s15){|x| list_item_to_hyperlink x}
|
114
|
+
s16 = apply_filter(s15) {|x| list_item_to_hyperlink x }
|
113
115
|
#puts 's16 : ' + s16.inspect
|
114
|
-
s17 = apply_filter(s16) {|x| mtlite_utils x }
|
116
|
+
s17 = apply_filter(s16) {|x| mtlite_utils x }
|
115
117
|
|
116
118
|
#puts 's17 : ' + s17.inspect
|
117
|
-
|
119
|
+
|
118
120
|
@to_s = s17
|
119
121
|
end
|
120
122
|
|
@@ -145,8 +147,8 @@ class Martile
|
|
145
147
|
def code_block_to_html(s)
|
146
148
|
|
147
149
|
|
148
|
-
s.split(/(?=<pre>)/).map do |s2|
|
149
|
-
|
150
|
+
s.split(/(?=<pre>)/).map do |s2|
|
151
|
+
|
150
152
|
if s2[0] != '<' then
|
151
153
|
|
152
154
|
b =[]
|
@@ -180,17 +182,7 @@ class Martile
|
|
180
182
|
end.join
|
181
183
|
|
182
184
|
|
183
|
-
end
|
184
|
-
|
185
|
-
def dynarex_to_markdown2(s)
|
186
|
-
|
187
|
-
s.gsub(/-\[((https?:\/\/)?[\w\/\.\-]+)\]/) do |match|
|
188
|
-
|
189
|
-
dynarex = Dynarex.new($1)
|
190
|
-
dynarex.to_h.map(&:values)
|
191
|
-
'[' + dynarex.to_h.map{|x| escape(x.values.join('|')) + "\n"}.join('|').chomp + ']'
|
192
|
-
end
|
193
|
-
end
|
185
|
+
end
|
194
186
|
|
195
187
|
def dynarex_to_markdown(s)
|
196
188
|
|
@@ -274,36 +266,42 @@ class Martile
|
|
274
266
|
|
275
267
|
end.join
|
276
268
|
|
277
|
-
end
|
278
|
-
|
279
|
-
def
|
280
|
-
|
281
|
-
separator = "\n1449232851\n"
|
282
|
-
|
283
|
-
a, apre = s.split(/(?=<pre)/).inject([[],[]]) do |r, row|
|
269
|
+
end
|
270
|
+
|
271
|
+
def filter_on(s)
|
284
272
|
|
285
|
-
|
273
|
+
@filter = []
|
286
274
|
|
287
|
-
|
288
|
-
|
289
|
-
|
275
|
+
a = s.split(/(?=<pre)/).map.with_index do |row, i|
|
276
|
+
|
277
|
+
row.sub(/<pre.*<\/pre>/m) do |pattern|
|
278
|
+
placeholder = '!' + Time.now.to_i.to_s + i.to_s
|
279
|
+
@filter << [placeholder, pattern]
|
280
|
+
placeholder
|
290
281
|
end
|
291
282
|
|
292
|
-
r.first << s2
|
293
|
-
r.last << pre if pre
|
294
|
-
r
|
295
|
-
|
296
283
|
end
|
297
|
-
|
298
|
-
r2 = blk.call a.join
|
284
|
+
a.join
|
299
285
|
|
300
|
-
|
301
|
-
|
302
|
-
|
286
|
+
end
|
287
|
+
|
288
|
+
def filter_off(raw_s)
|
289
|
+
|
290
|
+
s = raw_s.clone
|
291
|
+
@filter.each {|id, x| s.sub!(id, x) }
|
292
|
+
return s
|
293
|
+
|
294
|
+
end
|
303
295
|
|
304
|
-
|
296
|
+
def apply_filter(s)
|
297
|
+
|
298
|
+
s1 = filter_on(s)
|
299
|
+
s2 = yield s1
|
300
|
+
s3 = filter_off s2
|
305
301
|
|
302
|
+
return s3
|
306
303
|
end
|
304
|
+
|
307
305
|
|
308
306
|
def explicit_list_to_html(s)
|
309
307
|
|
@@ -315,7 +313,7 @@ class Martile
|
|
315
313
|
symbol = ('\\' + symbol) if symbol == '*'
|
316
314
|
|
317
315
|
a3 = s.split(/(?=<#{type}>)/).map do |x|
|
318
|
-
|
316
|
+
|
319
317
|
if x =~ /<ol>/ then
|
320
318
|
"<%s>%s</%s>" % \
|
321
319
|
[type, x[/<#{type}>[#{symbol}]\s*(.*)<\/#{type}>/m,1]\
|
@@ -438,7 +436,6 @@ class Martile
|
|
438
436
|
s2 = x.strip
|
439
437
|
next if s2.empty?
|
440
438
|
|
441
|
-
puts 's2: ' + s2.inspect
|
442
439
|
id = s2.lines.first[/id=["']([^"']+)/,1]
|
443
440
|
dx = Dynarex.new
|
444
441
|
dx.import s2
|
@@ -515,7 +512,7 @@ class Martile
|
|
515
512
|
a = s.lines
|
516
513
|
|
517
514
|
a2 = a.inject([[]]) do |r,x|
|
518
|
-
|
515
|
+
|
519
516
|
match = x.match(/^={1}(?:#)?(\w+)?$/)
|
520
517
|
|
521
518
|
if match then
|
@@ -575,4 +572,4 @@ class Martile
|
|
575
572
|
s.gsub(/\B(\* +)([^\n]+)\s+(https?:\/\/.*)/,'\1[\2](\3)')
|
576
573
|
|
577
574
|
end
|
578
|
-
end
|
575
|
+
end
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
�
|
2
|
-
n
|
3
|
-
|
1
|
+
U������9U�s7���V�6�B<X[F����e�$��.�%����h�T),�;�!FqO>���ٮ�ˁ�$���t�
|
2
|
+
�(m"��}T�v`��n��&�p�����SU�̂���
|
3
|
+
�9�9g���: 8o�q�,�"a_|</��މ�| &�����������]p��]N"��$ŃĀ�� �!.�O��@P�,B
|
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.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
fHJRwdYS8tvLYH9UFytJxDKjlovBuFUsfKP0FJlZGQGJM5JiIj5LWelTGJtJD8hI
|
32
32
|
2jPlwrOtiqZt2A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-06-11 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
@@ -123,5 +123,6 @@ rubyforge_project:
|
|
123
123
|
rubygems_version: 2.5.1
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
|
-
summary:
|
126
|
+
summary: Martile is a Markdown pre formatter which is designed to format custom Markdown
|
127
|
+
tags prior to being passed to the Markdown gem.
|
127
128
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|