martile 0.4.2 → 0.5.0
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.tar.gz.sig +0 -0
- data/lib/martile.rb +10 -23
- metadata +8 -8
- 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: 57c77f14ea96d92bec54a35e63e2123c33c186a1
|
4
|
+
data.tar.gz: ce9a89ce4f2da190f7c38dba918ea634ffd380f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea430a364e7e58a7b99db5bc2cee89d968b2585b644f4cb57422668c43e9637e20d91b7a986a57113461f2886d7bc28f416362d13f807bbca0d08f79ebd3ee4
|
7
|
+
data.tar.gz: a146c2bda3edc11975ceb660cc75b72fa8672472f7ddca31e1893324874e45cfb1298f836ce652a2077fd2fa31ec03ca3be83f7622e1102f620ab23aff03e8e1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -8,6 +8,8 @@ require 'dynarex'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
|
11
|
+
# bug fix: 11-Mar-2015: Escapes angle brackets within a code block *before*
|
12
|
+
# the string is passed to Rexle
|
11
13
|
# bug fix: 01-Mar-2015: code_block_to_html() now only searches strings which
|
12
14
|
# are outside of angle brackets
|
13
15
|
# bug fix: 10-Dec-2014: Generation of pre tags using // can now only happen
|
@@ -61,25 +63,7 @@ class Martile
|
|
61
63
|
|
62
64
|
s = slashpre raw_s
|
63
65
|
#puts 's : ' + s.inspect
|
64
|
-
|
65
|
-
#puts 'raw_s2 : ' + raw_s2.inspect
|
66
|
-
# ensure all angle brackets within <pre><code> is escaped
|
67
|
-
s2 = raw_s2.split(/(?=<pre><code>)/m).map { |y|
|
68
|
-
y.sub(/<pre><code>(.*)<\/code><\/pre>/m) do |x|
|
69
|
-
s3 = ($1)
|
70
|
-
"<pre><code>%s</code></pre>" % s3.gsub(/</,'<').gsub(/>/,'>')
|
71
|
-
end
|
72
|
-
}.join
|
73
|
-
|
74
|
-
# escape the content of <pre> tags which doesn't contain the code tag
|
75
|
-
s2.gsub(/<(pre)>[^(?:<\/\1>)]+<\/\1>/m) do |x|
|
76
|
-
s = x[5..-7]
|
77
|
-
if s[/^<code>/] then
|
78
|
-
x
|
79
|
-
else
|
80
|
-
"<pre>%s</pre>" % s.gsub(/</,'<').gsub(/>/,'>')
|
81
|
-
end
|
82
|
-
end
|
66
|
+
s2 = code_block_to_html(s.strip + "\n")
|
83
67
|
|
84
68
|
#puts 's2 : ' + s2.inspect
|
85
69
|
s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
|
@@ -124,7 +108,7 @@ class Martile
|
|
124
108
|
if r.join.strip.length > 0 then
|
125
109
|
raw_code = a.shift(r.length).map{|x| x.sub(/^ {4}/,'')}.join
|
126
110
|
|
127
|
-
code_block = "<pre><code>%s</code></pre>" % raw_code
|
111
|
+
code_block = "<pre><code>%s</code></pre>" % escape(raw_code)
|
128
112
|
|
129
113
|
b << code_block
|
130
114
|
s2 = a.join
|
@@ -153,10 +137,13 @@ class Martile
|
|
153
137
|
|
154
138
|
dynarex = Dynarex.new($1)
|
155
139
|
dynarex.to_h.map(&:values)
|
156
|
-
'[' + dynarex.to_h.map{|x| x.values.join('|').
|
157
|
-
.gsub('>','>') + "\n"}.join('|').chomp + ']'
|
140
|
+
'[' + dynarex.to_h.map{|x| escape(x.values.join('|')) + "\n"}.join('|').chomp + ']'
|
158
141
|
end
|
159
142
|
end
|
143
|
+
|
144
|
+
def escape(s)
|
145
|
+
s.gsub('<','<').gsub('>','>')
|
146
|
+
end
|
160
147
|
|
161
148
|
def list_to_html(s,symbol='#')
|
162
149
|
|
@@ -248,7 +235,7 @@ class Martile
|
|
248
235
|
rows.each do |cols|
|
249
236
|
xml.tr do
|
250
237
|
cols.each do |col|
|
251
|
-
xml.td col
|
238
|
+
xml.td escape(col)
|
252
239
|
end
|
253
240
|
end
|
254
241
|
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.
|
4
|
+
version: 0.5.0
|
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-
|
34
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdiscount
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: '2.1'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.1.
|
45
|
+
version: 2.1.8
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,27 +52,27 @@ dependencies:
|
|
52
52
|
version: '2.1'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.1.
|
55
|
+
version: 2.1.8
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: dynarex
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
62
|
+
version: '1.5'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.
|
65
|
+
version: 1.5.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '1.
|
72
|
+
version: '1.5'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.5.0
|
76
76
|
description:
|
77
77
|
email: james@r0bertson.co.uk
|
78
78
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|