dom 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dom.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5fa791a4e500fdbd727915ccd58b8762d070543
|
4
|
+
data.tar.gz: 1906c21e96eed5e55d92bf54aa98b0cce3278759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a57beacfe0992d5ca6f356aabe9c6aefa6efefac97ba858d3ae2c7be049081c5b11841c9ee3c8b1d02bfa5f40075092454333c77b4c46890afaef5d8db3a87
|
7
|
+
data.tar.gz: 4ce4864868494e6831319b8cd489a7476127fce1f69c6655975a24282693232bd65502a2cd414c622e784a18b77b7d89f94e093f61df02f4b437c55acd9af06e
|
data/lib/dom.rb
CHANGED
@@ -31,7 +31,7 @@ end
|
|
31
31
|
class String
|
32
32
|
def dom tag, attr = {}
|
33
33
|
"<#{Dom.hyphenize(tag)}#{Dom.attr(attr)}>"\
|
34
|
-
"#{escape_html(tag)}"\
|
34
|
+
"#{escape_html(tag).ansi2html}"\
|
35
35
|
"</#{Dom.hyphenize(tag)}>".escaped
|
36
36
|
end
|
37
37
|
def escape_html tag = nil
|
@@ -42,8 +42,6 @@ class String
|
|
42
42
|
AnsiColor = {
|
43
43
|
"1" => "bold",
|
44
44
|
"4" => "underline",
|
45
|
-
"5" => "blink",
|
46
|
-
"7" => "inverse",
|
47
45
|
"30" => "black",
|
48
46
|
"31" => "red",
|
49
47
|
"32" => "green",
|
@@ -62,7 +60,7 @@ class String
|
|
62
60
|
"47" => "bg-white",
|
63
61
|
}
|
64
62
|
def ansi2html
|
65
|
-
ansi = StringScanner.new(
|
63
|
+
ansi = StringScanner.new(self)
|
66
64
|
html = StringIO.new
|
67
65
|
until ansi.eos?
|
68
66
|
if ansi.scan(/\e\[0?m/)
|
@@ -73,7 +71,7 @@ class String
|
|
73
71
|
html.print(ansi.scan(/./m))
|
74
72
|
end
|
75
73
|
end
|
76
|
-
html.string
|
74
|
+
html.string
|
77
75
|
end
|
78
76
|
end
|
79
77
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
36
|
version: '0'
|
37
37
|
requirements: []
|
38
38
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.
|
39
|
+
rubygems_version: 2.1.10
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
42
|
summary: Creates HTML DOM strings
|