martile 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b75f3c95fc2a30c6dd89a276c093f0fa37a3785
4
- data.tar.gz: b577d1a25320935cef0997acf3b384045561c7f7
3
+ metadata.gz: 5a0dd4c5ddeba3c248c3d6ba296153b2e26a39ab
4
+ data.tar.gz: a7b86a55464a246e8f85c9fc48809a24fffb0f2b
5
5
  SHA512:
6
- metadata.gz: 861658a4cd3e4d0dd43d047c03bb438ed78b60b32adc30ea7b303f72f86249b3d671444f98120605adc2a9119f5db2b1432193d37da309da43117b6f39d5ccae
7
- data.tar.gz: 56378242f0518e7c9c61d533a8b799f9d207a1487b9a02b5bdafe1fcb34d3bb1c3e8ec79a9cd398800686a122826a2829a66ac65c08bd5740c4c9fb28d86f137
6
+ metadata.gz: 33e29722349e4e28231a2a58da76c85f918d2e0f29f9bebf39c66c89cfbab8beae2fd23dce843ee357db7b18b936560f3b9452c550b79ccb26208131a7084878
7
+ data.tar.gz: 5fdfceb4823eac7a234e789fa05e9afe99459d3a8b279235b78b38bbf3b2c56b7132dfa17ce74c9739cbdb13df3d0d1fdf72d71d29b757ef26271c3bd27cb314
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -8,6 +8,7 @@ require 'dynarex'
8
8
  require 'rdiscount'
9
9
 
10
10
 
11
+ # feature: 03-Oct-2013: HTML tags now handled
11
12
  # bug fix: 25-Sep-2013: removed the new line statement from the join command.
12
13
  # headings etc. should no longer be split with a new line
13
14
  # feature: 12-Aug-2013: unordered_list supported
@@ -26,16 +27,16 @@ class Martile
26
27
  attr_reader :to_html
27
28
 
28
29
  def initialize(s)
29
- s2 = code_block_to_html(s)
30
- puts 's2 : ' + s2.inspect
31
- s3 = ordered_list_to_html(s2)
32
- puts 's3 : ' + s3.inspect
33
- s4 = unordered_list_to_html(s3)
34
- puts 's4 : ' + s4.inspect
35
- s5 = dynarex_to_table(s4)
36
- puts 's5 :' + s5.inspect
37
- s6 = table_to_html(s5)
38
- puts 's6 : ' + s6.inspect
30
+ s2 = filter_out_html(s, :code_block_to_html)
31
+ #puts 's2 : ' + s2.inspect
32
+ s3 = filter_out_html(s2, :ordered_list_to_html)
33
+ #puts 's3 : ' + s3.inspect
34
+ s4 = filter_out_html(s3, :unordered_list_to_html)
35
+ #puts 's4 : ' + s4.inspect
36
+ s5 = filter_out_html(s4, :dynarex_to_table)
37
+ #puts 's5 :' + s5.inspect
38
+ s6 = filter_out_html(s5, :table_to_html)
39
+ #puts 's6 : ' + s6.inspect
39
40
  @to_html = s6
40
41
  end
41
42
 
@@ -105,6 +106,17 @@ class Martile
105
106
  end.join
106
107
 
107
108
  end
109
+
110
+ def filter_out_html(s, name)
111
+
112
+ s.gsub(/<(\w+)>.*<\/\1>[^<]*|.+/m) do |x|
113
+
114
+ html = x[/<(\w+)>.*<\/\1>/]
115
+ plain_text = html ? ($') : x
116
+ s2 = plain_text.length > 0 ? self.method(name).call(plain_text.to_s) : ''
117
+ ($`).to_s + html.to_s + s2
118
+ end
119
+ end
108
120
 
109
121
  def ordered_list_to_html(s)
110
122
  list_to_html s, '#'
@@ -137,4 +149,5 @@ class Martile
137
149
  return s
138
150
  end
139
151
 
152
+
140
153
  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.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  dxxPRWzHhWwDxwQSM9uhSReVj7QoO/gFoKZHmN7+/EhAwKMqI6IK1QwiXHhjaAJG
30
30
  NC9ItVKLmT+Y6rbeYcoXRv6i5t7GjD4m
31
31
  -----END CERTIFICATE-----
32
- date: 2013-09-25 00:00:00.000000000 Z
32
+ date: 2013-10-03 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rexle-builder
metadata.gz.sig CHANGED
Binary file