shell2html 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/shell2html.rb +10 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c38a9b69cc930f56f4e7d2cc272e33b2ba2caf31
4
- data.tar.gz: a4c263bec1f18d7a851872c18263198e8a80a3c6
3
+ metadata.gz: 4d6c4e48de66749123a5c827b3218283bbd9b4fe
4
+ data.tar.gz: 129d95bdf1b584ea22cd8188aa451df71afe229b
5
5
  SHA512:
6
- metadata.gz: a4d11a5c8dc41e8e2a95d3c01f48a33b1bdd4a0921976a71d3bd1a83397428bd77839c2c1f35f1d1ea9e5c443f39f2c3fa2f5015b02abb2594da4e54bfefc788
7
- data.tar.gz: 49a0d03222cbc40cf2a12da6615a188074471c5918a10979ec94aada5f34062ad91a9365e85062573968580e3e0d17ebb93b3339c6d7fe5dedfbcd9fe3ee2239
6
+ metadata.gz: 7e018aa57b2bbbcdb0c42f18f2ecd5f22936275c925bbbec0113f308070a255f65bdda8e02b3c4f1640435e714f0ab2149f42064fc2760896118f01284ee5db9
7
+ data.tar.gz: e202dcfcf2e47c190d20370bf60eda9387a5a4159c50f25260f9d617a0a3f528dc2da1c8da2020b80dbf69a2a856e60ffe1aacd13d07ddb39885e0bf431ffaf5
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Shell to HTML
2
2
  ==================
3
3
 
4
+ v0.0.3 - 2014-08-19
5
+ --------------------
6
+ - fix span closing
7
+
4
8
  v0.0.2 - 2014-08-19
5
9
  --------------------
6
10
  - add conversion of spaces and linefeeds
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!(/ /, ' &nbsp;')
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
- "</span>#{$2}"
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
- "<span style=\"#{span_style}\">#{t}"
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
- "<span>#{t}"
83
+ count = 1
84
+ "#{'</span>' * count}<span>#{t}"
79
85
  end
80
86
  end
81
87
  else
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mose