html2slim 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/html2slim/converter.rb +4 -4
- data/lib/html2slim/version.rb +2 -2
- metadata +10 -10
data/lib/html2slim/converter.rb
CHANGED
@@ -15,20 +15,20 @@ module HTML2Slim
|
|
15
15
|
def initialize(file)
|
16
16
|
# open.read makes it works for files & IO
|
17
17
|
erb = File.exists?(file) ? open(file).read : file
|
18
|
-
|
18
|
+
|
19
19
|
erb.gsub!(/<%(.+?)\s*\{\s*(\|.+?\|)?\s*%>/){ %(<%#{$1} do #{$2}%>) }
|
20
20
|
|
21
21
|
# while, case, if, for and blocks...
|
22
|
-
erb.gsub!(/<%(\s*while .+?|\s*case .+?|\s*if .+?|\s*for .+?|.+?do\s*(\|.+?\|)?\s*)%>/){ %(<ruby code="#{$
|
22
|
+
erb.gsub!(/<%(-\s+)?(\s*while .+?|\s*case .+?|\s*if .+?|\s*for .+?|.+?do\s*(\|.+?\|)?\s*)%>/){ %(<ruby code="#{$2.gsub(/"/, '"')}">) }
|
23
23
|
# else
|
24
24
|
erb.gsub!(/<%\s*else\s*%>/, %(</ruby><ruby code="else">))
|
25
25
|
# elsif
|
26
26
|
erb.gsub!(/<%\s*(elsif .+?)\s*%>/){ %(</ruby><ruby code="#{$1}">) }
|
27
27
|
# when
|
28
28
|
erb.gsub!(/<%\s*(when .+?)\s*%>/){ %(</ruby><ruby code="#{$1}">) }
|
29
|
-
erb.gsub!(/<%\s*(end|})\s*%>/, %(</ruby>))
|
29
|
+
erb.gsub!(/<%\s*(end|}|end\s+-)\s*%>/, %(</ruby>))
|
30
30
|
erb.gsub!(/<%(.+?)\s*%>/){ %(<ruby code="#{$1.gsub(/"/, '"')}"></ruby>) }
|
31
31
|
@slim ||= Hpricot(erb).to_slim
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
data/lib/html2slim/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module HTML2Slim
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.3'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hpricot
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153452860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153452860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &2160455300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2160455300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &2160454880 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2160454880
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: slim
|
49
|
-
requirement: &
|
49
|
+
requirement: &2160454360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2160454360
|
58
58
|
description: Convert HTML to Slim templates. Because HTML sux and Slim rules. That's
|
59
59
|
why.
|
60
60
|
email:
|