html2slim 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2slim/converter.rb +1 -2
- data/lib/html2slim/hpricot_monkeypatches.rb +3 -3
- data/lib/html2slim/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28bcd8f53ea559fa98de58411e7a05d798b9f34a
|
4
|
+
data.tar.gz: 73b83d8151046b9490517db175ffe8e0246c4c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc892a892be65315ddd54423431731f6aff146860437826bc2a708f67a8c2651fc860bb1c65b5332a5a5c6fe5f4d6975e460a327becb73ebec7c213ba9a82978
|
7
|
+
data.tar.gz: ee218a556404152cd3df416aff6bdb1e6541ab80917f7173b7417c5d62e30af2f7a417ed15cb2d884c46b736a9af322659f89a0e2247de8cef80eefa8e37d61b
|
data/lib/html2slim/converter.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'hpricot_monkeypatches'
|
2
2
|
|
3
3
|
module HTML2Slim
|
4
|
-
B
|
5
4
|
class Converter
|
6
5
|
def to_s
|
7
6
|
@slim
|
@@ -28,7 +27,7 @@ module HTML2Slim
|
|
28
27
|
# when
|
29
28
|
erb.gsub!(/<%-?\s*(when .+?)\s*-?%>/){ %(</ruby><ruby code="#{$1}">) }
|
30
29
|
erb.gsub!(/<%\s*(end|}|end\s+-)\s*%>/, %(</ruby>))
|
31
|
-
erb.gsub!(/<%(.+?)\s
|
30
|
+
erb.gsub!(/<%(.+?)\s*-?%>/m){ %(<ruby code="#{$1.gsub(/"/, '"')}"></ruby>) }
|
32
31
|
@slim ||= Hpricot(erb).to_slim
|
33
32
|
end
|
34
33
|
end
|
@@ -47,7 +47,7 @@ class Hpricot::Elem
|
|
47
47
|
def slim(lvl=0)
|
48
48
|
r = ' ' * lvl
|
49
49
|
|
50
|
-
return r + slim_ruby_code if ruby?
|
50
|
+
return r + slim_ruby_code(r) if ruby?
|
51
51
|
|
52
52
|
r += name unless skip_tag_name?
|
53
53
|
r += slim_id
|
@@ -66,8 +66,8 @@ class Hpricot::Elem
|
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
-
def slim_ruby_code
|
70
|
-
(code.strip[0] == "=" ? "" : "- ") + code.strip
|
69
|
+
def slim_ruby_code(r)
|
70
|
+
(code.strip[0] == "=" ? "" : "- ") + code.strip.gsub(/\n/, "\n#{r}- ")
|
71
71
|
end
|
72
72
|
|
73
73
|
def code
|
data/lib/html2slim/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maiz Lulkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hpricot
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: slim
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.0.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.0
|
69
69
|
description: Convert HTML to Slim templates. Because HTML sux and Slim rules. That's
|
@@ -90,22 +90,22 @@ licenses: []
|
|
90
90
|
metadata: {}
|
91
91
|
post_install_message:
|
92
92
|
rdoc_options:
|
93
|
-
- --charset=UTF-8
|
93
|
+
- "--charset=UTF-8"
|
94
94
|
require_paths:
|
95
95
|
- lib
|
96
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.2.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: HTML to Slim converter.
|