shell2html 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/shell2html.rb +10 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d6c4e48de66749123a5c827b3218283bbd9b4fe
|
4
|
+
data.tar.gz: 129d95bdf1b584ea22cd8188aa451df71afe229b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e018aa57b2bbbcdb0c42f18f2ecd5f22936275c925bbbec0113f308070a255f65bdda8e02b3c4f1640435e714f0ab2149f42064fc2760896118f01284ee5db9
|
7
|
+
data.tar.gz: e202dcfcf2e47c190d20370bf60eda9387a5a4159c50f25260f9d617a0a3f528dc2da1c8da2020b80dbf69a2a856e60ffe1aacd13d07ddb39885e0bf431ffaf5
|
data/CHANGELOG.md
CHANGED
data/lib/shell2html.rb
CHANGED
@@ -46,13 +46,16 @@ module Shell2html
|
|
46
46
|
}
|
47
47
|
|
48
48
|
def to_html(text, inline = false)
|
49
|
+
count = 0
|
49
50
|
text.gsub!(/\n/, '<br>')
|
50
51
|
text.gsub!(/ /, ' ')
|
51
52
|
text.split(27.chr).map do |e|
|
52
53
|
if /^\[([0-9;]+)m(.*)$/.match e
|
53
54
|
case $1
|
54
55
|
when '0'
|
55
|
-
|
56
|
+
span = '</span>' * count
|
57
|
+
count = 0
|
58
|
+
"#{span}#{$2}"
|
56
59
|
else
|
57
60
|
key = $1
|
58
61
|
t = $2
|
@@ -69,13 +72,16 @@ module Shell2html
|
|
69
72
|
end
|
70
73
|
o
|
71
74
|
end.flatten.join(';')
|
72
|
-
|
75
|
+
count = 1
|
76
|
+
"#{'</span>' * count}<span style=\"#{span_style}\">#{t}"
|
73
77
|
else
|
78
|
+
count = 1
|
74
79
|
span_class = css.map { |c| c[:css] }.join(' ')
|
75
|
-
"<span class=\"#{span_class}\">#{t}"
|
80
|
+
"#{'</span>' * count}<span class=\"#{span_class}\">#{t}"
|
76
81
|
end
|
77
82
|
else
|
78
|
-
|
83
|
+
count = 1
|
84
|
+
"#{'</span>' * count}<span>#{t}"
|
79
85
|
end
|
80
86
|
end
|
81
87
|
else
|