shell2html 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/shell2html.rb +15 -3
- 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: c38a9b69cc930f56f4e7d2cc272e33b2ba2caf31
|
4
|
+
data.tar.gz: a4c263bec1f18d7a851872c18263198e8a80a3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4d11a5c8dc41e8e2a95d3c01f48a33b1bdd4a0921976a71d3bd1a83397428bd77839c2c1f35f1d1ea9e5c443f39f2c3fa2f5015b02abb2594da4e54bfefc788
|
7
|
+
data.tar.gz: 49a0d03222cbc40cf2a12da6615a188074471c5918a10979ec94aada5f34062ad91a9365e85062573968580e3e0d17ebb93b3339c6d7fe5dedfbcd9fe3ee2239
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Shell to HTML
|
2
2
|
==================
|
3
3
|
|
4
|
+
v0.0.2 - 2014-08-19
|
5
|
+
--------------------
|
6
|
+
- add conversion of spaces and linefeeds
|
7
|
+
- add export of the css colors
|
8
|
+
- fix bold when 01 is used instead of 1
|
9
|
+
|
4
10
|
v0.0.1 - 2014-08-17
|
5
11
|
-----------------
|
6
12
|
- base gem skeleton
|
data/lib/shell2html.rb
CHANGED
@@ -46,16 +46,19 @@ module Shell2html
|
|
46
46
|
}
|
47
47
|
|
48
48
|
def to_html(text, inline = false)
|
49
|
+
text.gsub!(/\n/, '<br>')
|
50
|
+
text.gsub!(/ /, ' ')
|
49
51
|
text.split(27.chr).map do |e|
|
50
52
|
if /^\[([0-9;]+)m(.*)$/.match e
|
51
53
|
case $1
|
52
54
|
when '0'
|
53
55
|
"</span>#{$2}"
|
54
56
|
else
|
57
|
+
key = $1
|
55
58
|
t = $2
|
56
59
|
css = []
|
57
|
-
|
58
|
-
css << COLORS["#{i}"] if COLORS["#{i}"]
|
60
|
+
key.split(';').each do |i|
|
61
|
+
css << COLORS["#{i.to_i}"] if COLORS["#{i.to_i}"]
|
59
62
|
end
|
60
63
|
if css.count > 0
|
61
64
|
if inline
|
@@ -81,7 +84,16 @@ module Shell2html
|
|
81
84
|
end.join
|
82
85
|
end
|
83
86
|
|
84
|
-
def
|
87
|
+
def css
|
88
|
+
back = []
|
89
|
+
COLORS.each do |_, c|
|
90
|
+
o = []
|
91
|
+
css = c[:style].each do |k, v|
|
92
|
+
o << "#{k}:#{v}"
|
93
|
+
end
|
94
|
+
back << ".#{c[:css]} { #{o.join(';')} }"
|
95
|
+
end
|
96
|
+
back.join("\n")
|
85
97
|
end
|
86
98
|
|
87
99
|
def to_sass(text)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shell2html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|