shell2html 0.0.4 → 0.0.5
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 +5 -0
- data/README.md +13 -2
- data/lib/shell2html.rb +5 -2
- 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: 5eb1bc4e0dc68a7c3c76db7a1aaba7de6e85c634
|
4
|
+
data.tar.gz: fe087019cd925c77d4cd3243642f530dccf413dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2215133ce6fa7ac128ae86eab2d640d87ce9b180a6519e6fba020d79ea2abdfa9d858a838bc639470bacdb0f3af08e1038088e344d5a82321b56d19fbd1f4e59
|
7
|
+
data.tar.gz: 8348b33514269583c6735c1f728ead1315ab6fb0c5af9563f3ae30d61937e26b2c70aa6a455e2f6ebd683f33ce22797076a2161f412f2dae0767eeaa8b733536
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,9 +9,9 @@ Shell2html
|
|
9
9
|
|
10
10
|
----
|
11
11
|
|
12
|
-
A ruby lib for conversion between bash colors and HTML.
|
12
|
+
A ruby lib for conversion between bash colors and HTML. It was created to help the Shellplay tool to export html from colored shell output.
|
13
13
|
|
14
|
-
Code is still experimental, use at your own risk.
|
14
|
+
Code is still experimental, use at your own risk. But "it works for me".
|
15
15
|
|
16
16
|
Installation
|
17
17
|
-------------------
|
@@ -30,8 +30,17 @@ Or install it yourself as:
|
|
30
30
|
Usage
|
31
31
|
-----------------
|
32
32
|
|
33
|
+
````
|
34
|
+
require "shell2html"
|
35
|
+
|
36
|
+
puts Shell2html.to_html("\e[33m>\e[0m\e[1;31m some colored thing.\e[0m")
|
37
|
+
````
|
38
|
+
|
33
39
|
Commandline command
|
34
40
|
-------------------
|
41
|
+
|
42
|
+
(not functionnal yet)
|
43
|
+
|
35
44
|
There is a command `shell2html` provided in this lib for commandline execution.
|
36
45
|
|
37
46
|
shell2html <file>
|
@@ -39,6 +48,8 @@ There is a command `shell2html` provided in this lib for commandline execution.
|
|
39
48
|
|
40
49
|
The html is output in stdout.
|
41
50
|
|
51
|
+
An example of usage is visible on http://mose.com/20140814-dokku/
|
52
|
+
|
42
53
|
Contributing
|
43
54
|
-----------------
|
44
55
|
1. Fork it
|
data/lib/shell2html.rb
CHANGED
@@ -5,7 +5,7 @@ module Shell2html
|
|
5
5
|
COLORS = {
|
6
6
|
"1" => { css: "sh_bold", style: { "font-weight" => "bold" } },
|
7
7
|
"2" => { css: "sh_dim", style: { "opacity" => ".5" } },
|
8
|
-
"4" => { css: "sh_underlined", style: { "
|
8
|
+
"4" => { css: "sh_underlined", style: { "border-bottom" => "1px solid rgba(255,255,255,.6)", "padding-bottom" => "1px" } },
|
9
9
|
"5" => { css: "sh_blink", style: { "text-decoration" => "blink" } },
|
10
10
|
"7" => { css: "sh_inverted", style: { "font-weight" => "bold" } },
|
11
11
|
"8" => { css: "sh_hidden", style: { "opacity" => "0" } },
|
@@ -42,12 +42,15 @@ module Shell2html
|
|
42
42
|
"104" => { css: "sh_bg_lightblue", style: { "background-color" => "#4682b4" } },
|
43
43
|
"105" => { css: "sh_bg_lightmagenta", style: { "background-color" => "#ff00ff" } },
|
44
44
|
"106" => { css: "sh_bg_lightcyan", style: { "background-color" => "#00ffff" } },
|
45
|
-
"107" => { css: "sh_bg_white", style: { "background-color" => "#ffffff" } }
|
45
|
+
"107" => { css: "sh_bg_white", style: { "background-color" => "#ffffff" } },
|
46
|
+
"a" => { css: "sh_a", style: { "color" => "inherit", "text-decoration" => "inherit" } },
|
47
|
+
"ah" => { css: "sh_a:hover", style: { "background-color" => "#ffffff", "color" => "#000000" } }
|
46
48
|
}
|
47
49
|
|
48
50
|
def to_html(text, inline = false)
|
49
51
|
count = 0
|
50
52
|
text = CGI.escapeHTML(text)
|
53
|
+
text.gsub!(/(https?:\/\/[^'"\s\e\n<]*)/, "<a class=\"sh_a\" href=\"\\1\">\\1</a>")
|
51
54
|
text.gsub!(/\n/, '<br>')
|
52
55
|
text.gsub!(/ /, ' ')
|
53
56
|
text.split(27.chr).map do |e|
|