shell2html 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +13 -2
  4. data/lib/shell2html.rb +5 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c8a7b42dba54e95fd2d1c81f6e3aa6b251249ba
4
- data.tar.gz: 84ff4bcddb343a30fda105e1a12efc2c21cc20f7
3
+ metadata.gz: 5eb1bc4e0dc68a7c3c76db7a1aaba7de6e85c634
4
+ data.tar.gz: fe087019cd925c77d4cd3243642f530dccf413dd
5
5
  SHA512:
6
- metadata.gz: 5f13e1b48c7f1c53ecf0e8c05764f1d9374c60d87febac822c350b50429f83a458ad93413cfc386e480e401f4e59b5077b7a5dd5f605d0cf6321765b55a36b84
7
- data.tar.gz: ab14a63f6bda83942f914a2cbdc6afd216765d62e4668915746f461222a200fa8cdaef821373d90d7b40e889e4129239f3136de363fe0ca1ac2abaa22860ee55
6
+ metadata.gz: 2215133ce6fa7ac128ae86eab2d640d87ce9b180a6519e6fba020d79ea2abdfa9d858a838bc639470bacdb0f3af08e1038088e344d5a82321b56d19fbd1f4e59
7
+ data.tar.gz: 8348b33514269583c6735c1f728ead1315ab6fb0c5af9563f3ae30d61937e26b2c70aa6a455e2f6ebd683f33ce22797076a2161f412f2dae0767eeaa8b733536
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Shell to HTML
2
2
  ==================
3
3
 
4
+ v0.0.5 - 2014-08-19
5
+ -------------------
6
+ - added a link on urls with a custom style
7
+ - also added a hover on links
8
+
4
9
  v0.0.4 - 2014-08-19
5
10
  --------------------
6
11
  - fix htmlentities encoding
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: { "text-decoration" => "underline" } },
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!(/ /, ' &nbsp;')
53
56
  text.split(27.chr).map do |e|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shell2html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose