martile 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/martile.rb +37 -23
  5. metadata +22 -62
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d54722ac1ba698b83d8a0e8e7a0a89877e05ab08
4
- data.tar.gz: a62031606c9f955aaf98cfe7f49f80e3e63e2ca4
3
+ metadata.gz: 9b1ab59b9e27447edce7ae0f83115e026b576598
4
+ data.tar.gz: fa8187355519c2a3652c6cd622ea458ba350b780
5
5
  SHA512:
6
- metadata.gz: 769eb88b46d7a5c2ebc95e5f53371a88eff67146105178e679063c92623c68f2d39af48030504c9f52bd5106c8435713f41ad52a9b5b9b685306324514b94b1e
7
- data.tar.gz: c31d4735aaa1fc0ed97208b9ceef2609fc941251afaddd427e6e8913b461dc58b2654ab18fba5a4cd740a64a0125206f9af0e8866a27fb6d623364780e549c82
6
+ metadata.gz: 5ed3dd4912ee68d876af4fe72a12149dcffed8d832c569a7ac1fa5e0fdd2233de6b290c875d4adf21a102eaefa480702477be42f425a880c9f159cade20ad4ca
7
+ data.tar.gz: 6b2e341d605ab8c39f806c4a894a9f4d1deb5ae8180d9480b213358dd2c41430fb7e7de72b53f9b57a066379da5ab2f80ed9493a56b54b0a73f0cee4b75eb538
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -2,12 +2,14 @@
2
2
 
3
3
  # file: martile.rb
4
4
 
5
- require 'rexle-builder'
6
- require 'rexle'
5
+ #require 'rexle-builder'
6
+ #require 'rexle'
7
7
  require 'dynarex'
8
8
  require 'rdiscount'
9
9
 
10
10
 
11
+ # bug fix: 01-Mar-2015: code_block_to_html() now only searches strings which
12
+ # are outside of angle brackets
11
13
  # bug fix: 10-Dec-2014: Generation of pre tags using // can now only happen
12
14
  # when the // appears at the beginning of the line
13
15
  # feature: 30-Oct-2014: A section can now be between a set of equal signs at
@@ -58,9 +60,9 @@ class Martile
58
60
  def initialize(raw_s)
59
61
 
60
62
  s = slashpre raw_s
61
-
63
+ #puts 's : ' + s.inspect
62
64
  raw_s2 = apply_filter(s.strip + "\n") {|x| code_block_to_html x }
63
-
65
+ #puts 'raw_s2 : ' + raw_s2.inspect
64
66
  # ensure all angle brackets within <pre><code> is escaped
65
67
  s2 = raw_s2.split(/(?=<pre><code>)/m).map { |y|
66
68
  y.sub(/<pre><code>(.*)<\/code><\/pre>/m) do |x|
@@ -81,6 +83,7 @@ class Martile
81
83
 
82
84
  #puts 's2 : ' + s2.inspect
83
85
  s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
86
+ #puts 's3 : ' + s3.inspect
84
87
  s4 = apply_filter(s3) {|x| ordered_list_to_html x }
85
88
  #puts 's4 : ' + s4.inspect
86
89
 
@@ -106,30 +109,41 @@ class Martile
106
109
 
107
110
  def code_block_to_html(s)
108
111
 
109
- b =[]
112
+
113
+ s.split(/(?=<pre>)/).map do |s2|
114
+
115
+ if s2[0] != '<' then
116
+
117
+ b =[]
110
118
 
111
- while s =~ /^ {4}/ do
119
+ while s2 =~ /^ {4}/ do
112
120
 
113
- a = s.lines.to_a
114
- r = a.take_while{|x| x[/^( {4}|\n)/]}
115
-
116
- if r.join.strip.length > 0 then
117
- raw_code = a.shift(r.length).map{|x| x.sub(/^ {4}/,'')}.join
121
+ a = s2.lines.to_a
122
+ r = a.take_while{|x| x[/^( {4}|\n)/]}
123
+
124
+ if r.join.strip.length > 0 then
125
+ raw_code = a.shift(r.length).map{|x| x.sub(/^ {4}/,'')}.join
118
126
 
119
- code_block = "<pre><code>%s</code></pre>" % raw_code
127
+ code_block = "<pre><code>%s</code></pre>" % raw_code
120
128
 
121
- b << code_block
122
- s = a.join
123
- i = r.length
124
- else
125
- i = (s =~ /^ {4}/)
126
- end
129
+ b << code_block
130
+ s2 = a.join
131
+ i = r.length
132
+ else
133
+ i = (s =~ /^ {4}/)
134
+ end
127
135
 
128
- b << s.slice!(0,i)
136
+ b << s2.slice!(0,i)
137
+
138
+ end
139
+
140
+ b.join + s2
141
+ else
142
+ s2
143
+ end
144
+
145
+ end.join
129
146
 
130
- end
131
-
132
- b.join + s
133
147
 
134
148
  end
135
149
 
@@ -179,7 +193,7 @@ class Martile
179
193
  else
180
194
 
181
195
  if names.grep x.name then
182
- block.call(x.xml)
196
+ block.call(x.xml pretty: false)
183
197
  else
184
198
  x
185
199
  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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -12,67 +12,27 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
14
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE0MDMwMTE1MTM1N1oXDTE1MDMwMTE1MTM1N1owSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE1MDMwMTE4MTQyNFoXDTE2MDIyOTE4MTQyNFowSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
17
  EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBALpyB7g/7JKFOoKguOcHbRBeYoJEFgk4+6gOTYSUMc9QbwHOHx2+tgozZ+No
19
- 7B8S+DuHtehMdkZNb17ImyYhFMNCZhzIPNYhNlGNgQd8gzgmyPD3wdBa4xz9tcNH
20
- L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+jK2cZ0igknaptsIlLdopY8mI3e
29
- 03XFF0RJYehvRb/7p7hUXduEW3MZdt6xS5gYU09gk8hDAIGBsr4REw2NHOj7RUDR
30
- d9yujmbsdLOwkY9Yel5ADtzsebPb3fKp2+qG1ojdsQujGbiOIZs7e+T8Q65mPn4W
31
- YF3JmVOebtMx3b9sXkLX1YyX0fsg59FXvg9CVfAoaG6qjG2Y/okBwMSqqMLQiiao
32
- aRfEuwOkM9Z+zA==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAjRuICZ1L
27
+ FQgCWlo7lCUp8vrF554+OdGk5+/v+5MfDUoNXfXUDdyajEiv4uQ0vcUylHv5jxw5
28
+ AeCJrrf7WumDG9N0CcDb2VPr9ZDzEjknIN3hH4//tYdgwsleJo+SUCuFo9bI1FXz
29
+ KlFeMb4up8Yu/N/Y6MwlqdnFEj9QqLdIKPZjm5E0WpCW5tbeF3XL1FJx+wG68cKt
30
+ UJinqIgLKrEPKrGxzCf3kInYUatxGx5IT4dg+tnik+GkPzgausNb1Ida9XioBmRJ
31
+ fnr5l+RI/6f8lfxBNgDrktGB/RwPkOyWtyKk1tu9CWgHmptxL0JglikCXg5MzuZI
32
+ tZzXOvXUoUf1VQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-12-10 00:00:00.000000000 Z
34
+ date: 2015-03-01 00:00:00.000000000 Z
35
35
  dependencies:
36
- - !ruby/object:Gem::Dependency
37
- name: rexle-builder
38
- requirement: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '0.1'
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: 0.1.9
46
- type: :runtime
47
- prerelease: false
48
- version_requirements: !ruby/object:Gem::Requirement
49
- requirements:
50
- - - "~>"
51
- - !ruby/object:Gem::Version
52
- version: '0.1'
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 0.1.9
56
- - !ruby/object:Gem::Dependency
57
- name: rexle
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '1.0'
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: 1.0.33
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '1.0'
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 1.0.33
76
36
  - !ruby/object:Gem::Dependency
77
37
  name: rdiscount
78
38
  requirement: !ruby/object:Gem::Requirement
@@ -99,20 +59,20 @@ dependencies:
99
59
  requirements:
100
60
  - - "~>"
101
61
  - !ruby/object:Gem::Version
102
- version: '1.2'
62
+ version: '1.4'
103
63
  - - ">="
104
64
  - !ruby/object:Gem::Version
105
- version: 1.2.90
65
+ version: 1.4.1
106
66
  type: :runtime
107
67
  prerelease: false
108
68
  version_requirements: !ruby/object:Gem::Requirement
109
69
  requirements:
110
70
  - - "~>"
111
71
  - !ruby/object:Gem::Version
112
- version: '1.2'
72
+ version: '1.4'
113
73
  - - ">="
114
74
  - !ruby/object:Gem::Version
115
- version: 1.2.90
75
+ version: 1.4.1
116
76
  description:
117
77
  email: james@r0bertson.co.uk
118
78
  executables: []
@@ -143,5 +103,5 @@ rubyforge_project:
143
103
  rubygems_version: 2.2.2
144
104
  signing_key:
145
105
  specification_version: 4
146
- summary: Converts a martile string to html
106
+ summary: A flavour of Markdown which converts a Martile string to html
147
107
  test_files: []
metadata.gz.sig CHANGED
Binary file