ansi_stream 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b4720f95b21296654c6a78831eeb147ce974e9d
4
- data.tar.gz: 70c57a31f3941699d388ffa946da543dbf23041c
3
+ metadata.gz: 963abfafb3372c786d2271e70cada44a40612f7d
4
+ data.tar.gz: ac3d49adf268f9604b42b1e0360abb1a6e79cb86
5
5
  SHA512:
6
- metadata.gz: 14c84a8c76714cbef8887e2499a2ae26dbe943106d90132ecd39392d8f641daeed5021f5a5918c66fdc3c03684f435c19daa610a3fb4c4cd11ac271c5fe49bdc
7
- data.tar.gz: 1b6d377aba05ba03bd74e6dd3315b5070b8af4ab49103a8e799536e16081977a2ea22cf6bd28c05ba16bd8b33ac0251c38ced218387c4ab107bd1d62d43c9513
6
+ metadata.gz: d8839c5779c2f0f32ba3cdba240c8768e68f7e1bf516537e331e87ee9933896fc6c533bb673542cbc833d028bbfc9b765de09fe3e605cb9dccebbffb1cfdc62b
7
+ data.tar.gz: b8d693e439d3b4eda617902d51bfbca1e2834eb092dd963d9d8fabd5a2340c8985ae4515207af86dbe749f58bc82ee3d5a55a5962970f7a1727ae742ae4762c8
@@ -1,3 +1,3 @@
1
1
  module AnsiStream
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,9 +7,10 @@ describe "AnsiStream", ->
7
7
  expect(span.className.indexOf(color)).toBeGreaterThan(-1)
8
8
 
9
9
  it 'returns uncolorized spans if there are no escape codes', ->
10
- span = stream.process("toto").childNodes[0]
10
+ span = stream.process("mkdir").childNodes[0]
11
11
  expectClass(span, 'ansi-background-default')
12
12
  expectClass(span, 'ansi-foreground-default')
13
+ expect(span.innerHTML).toBe('mkdir')
13
14
 
14
15
  it 'returns colorized spans if there is an foreground color code', ->
15
16
  expectClass(stream.process('\u001B[31mtoto').childNodes[0], 'ansi-foreground-red')
@@ -35,4 +36,3 @@ describe "AnsiStream", ->
35
36
  spans = stream.process("\u001B[4mtoto\u001B[24mtiti")
36
37
  expectClass(spans.childNodes[0], 'ansi-underline')
37
38
  expect(spans.childNodes[1].className.indexOf('ansi-underline')).toBe(-1)
38
-
@@ -5,9 +5,10 @@ class @AnsiStream
5
5
 
6
6
  process: (text) ->
7
7
  parts = text.split(/\033\[/)
8
- parts = parts.filter (part) -> part
9
8
 
10
9
  spans = document.createDocumentFragment()
10
+ first_part = parts.shift()
11
+ spans.appendChild(@span.create(first_part, @style)) if first_part
11
12
  for part in parts
12
13
  [partText, styles] = @_extractTextAndStyles(part)
13
14
  @style.apply(styles)
@@ -17,7 +18,7 @@ class @AnsiStream
17
18
  spans
18
19
 
19
20
  _extractTextAndStyles: (originalText) ->
20
- matches = originalText.match(/^([\d;]*)m([^]*)$/m)
21
+ matches = originalText.match(/^([\d;]*)m([^]*)$/)
21
22
 
22
23
  return [originalText, null] unless matches
23
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansi_stream
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
  - Guillaume Malette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,4 +132,3 @@ test_files:
132
132
  - spec/javascripts/helpers/.gitkeep
133
133
  - spec/javascripts/support/jasmine.yml
134
134
  - spec/javascripts/support/jasmine_helper.rb
135
- has_rdoc: