martile 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/martile.rb +9 -8
  2. metadata +3 -5
data/lib/martile.rb CHANGED
@@ -5,6 +5,7 @@
5
5
  require 'rexle-builder'
6
6
  require 'rexle'
7
7
 
8
+ # bug fix: 04-Aug-2012; replaced \s with a space in regex patterns
8
9
  # modified: 28-Mar-2012; Added dynarex_to_table
9
10
  # modified: 28-Aug-2011; Added escaping of HTML within a code block
10
11
 
@@ -14,7 +15,7 @@ class Martile
14
15
 
15
16
  def initialize(s)
16
17
  s2 = code_block_to_html(s)
17
- s3 = ordered_list_to_html(s2)
18
+ s3 = ordered_list_to_html(s2)
18
19
  s4 = dynarex_to_table(s3)
19
20
  s5 = table_to_html(s4)
20
21
  @to_html = s5
@@ -25,21 +26,21 @@ class Martile
25
26
  def code_block_to_html(s)
26
27
 
27
28
  b =[]
28
-
29
- while s =~ /^\s{4}/ do
29
+
30
+ while s =~ /^ {4}/ do
30
31
 
31
32
  a = s.lines.to_a
32
- r = a.take_while{|x| x[/^(\s{4}|\n)/]}
33
-
33
+ r = a.take_while{|x| x[/^( {4}|\n)/]}
34
+ exit
34
35
  if r.join.strip.length > 0 then
35
36
  code_block = "<pre><code>%s</code></pre>" % \
36
- a.shift(r.length).map{|x| x.sub(/^\s{4}/,'')}.join\
37
+ a.shift(r.length).map{|x| x.sub(/^ {4}/,'')}.join\
37
38
  .gsub('<','&lt;').gsub('>','&gt;')
38
39
  b << code_block
39
40
  s = a.join
40
41
  i = r.length
41
42
  else
42
- i = (s =~ /^\s{4}/)
43
+ i = (s =~ /^ {4}/)
43
44
  end
44
45
 
45
46
  b << s.slice!(0,i)
@@ -106,4 +107,4 @@ class Martile
106
107
  return s
107
108
  end
108
109
 
109
- end
110
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: martile
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-28 00:00:00 +01:00
14
- default_executable:
13
+ date: 2012-08-04 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rexle-builder
@@ -45,7 +44,6 @@ extra_rdoc_files: []
45
44
 
46
45
  files:
47
46
  - lib/martile.rb
48
- has_rdoc: true
49
47
  homepage:
50
48
  licenses: []
51
49
 
@@ -69,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
67
  requirements: []
70
68
 
71
69
  rubyforge_project:
72
- rubygems_version: 1.5.2
70
+ rubygems_version: 1.8.23
73
71
  signing_key:
74
72
  specification_version: 3
75
73
  summary: Converts a martile string to html