ansi_sgr_to_html 1.1.0 → 1.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/ansi_sgr_to_html.rb +6 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODcxYmU1NDNiN2FjNjRlM2QxNDNiYjc4NWFmYzU5MGRlZWIyNmE4NA==
4
+ NzIyMTc5YTBhNDZiNzJlNjdjZWUwNzI2YzUxMGUxMzRiYzI3OTE3ZQ==
5
5
  data.tar.gz: !binary |-
6
- Y2Y0N2JlMDI4NTliNjNlZDBhNGQwNjRhYWIyOWQxNDdhNmVhY2MzMQ==
6
+ MTA5MzgyYWQ0MmNhOGIxMTljNzEwZTdlZWQxZjhlMzg1NTAxZjQ2YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDcxM2Y0ODk1ODczMmIzNTNjMmIzYjIxMzc4NDNhYjg1ZWU5MjFiNjY3OGJh
10
- MjFlNWJiMDc0N2EyODQ1NzVkYTg4NTM1OGJkOGFkOTY2ZWJjNTUwYTkyMjlh
11
- NTliZjc1MDNmYTczNmE2ZmU1NmUzYjk5ZmRkMzRhYjE1MTE3ZDk=
9
+ MTIxYTIxMjVjMWMwOTgwMWM4OWE4NmFkMGE2MzYyZjYyNGJhMDlhYmZmNjc0
10
+ YmM4YmY5OTlkYTIyZGQ3YzY0MmRkYzc2Mjg2ZTc3NzZjODFhZTI5MzhhOTEz
11
+ MDI1ODRiM2Y4OTA1ZjQ2MDk0MDg0YjhhMzY0NjczNGUzOTdjMTI=
12
12
  data.tar.gz: !binary |-
13
- OGE4MTZiNzM0Y2MxOTgxMjRhYjZhZWE0NjNhNzI0YmMyZTFhMGM0NWYyYzJl
14
- ODZhZDdkOGVjNjliOGUzNjM1MTBjZGU0ZGNjZGEwMGM2YmE4YWU5N2M1OWZi
15
- NjMwYjU5YWQ2NWQ2NGYzMGJhMjkxYWQzZWYxMjQ5Y2EwZWI1MDM=
13
+ ZWEyMWM1Yzc0MzYxZDBmYjZjY2QwMjU4MWM3MmUxZmNjZGExYmJmZTM2OGM3
14
+ Zjc5ZGY5OTRlNmJlYjg3YjliMGE0NDc4ZTI5NDNjNzhhODZlNjQyZTJjYmEx
15
+ MWRmNzg5NmMzMjAzMDZhNzBjNDgxNGNhZmUwYzMyYzY4NTk4ODQ=
@@ -9,14 +9,16 @@
9
9
  # * this means it supports alternative fonts (user specified)
10
10
  # * blink codes supported! Slow and fast!
11
11
  # * full support for all SGR color codes, meaning 4bit, 8bit and 24bit colors, for both, foreground and background (most other gems do not, especially not 24bit colors)
12
+ # * supports SGR codes 7 and 27, for reversing back- and foreground colors (however, does only work when having explicitly set using SGR color code, before)
12
13
  # - supports sequences of SGR codes separated by ';' (some other gems do not)
14
+ # - unicode strings supported
13
15
  # - configurable options by user
14
16
  # * custom set all 10 alternative fonts (default: all inherit default font)
15
17
  # * is bold only bold, or also bright (default: both)
16
18
  # * fully user defineable basic 16 color tables, or pick from preset (default: xterm)
17
19
  # - flat output, no nested spans like some other gems (smaller output than most other gems)
18
20
  class ANSI_SGR_To_HTML
19
- @@HTML_escapes = {'&'=>'&amp;','"'=>'&quot;','<'=>'&lt;','>'=>'&gt;',"\r"=>"\r","\n"=>"\n"} # newlines controlled by option
21
+ @@HTML_escapes = {'&'.ord=>'&amp;', '"'.ord=>'&quot;', '<'.ord=>'&lt;', '>'.ord=>'&gt;', "\r".ord=>"\r", "\n".ord=>"\n"} # newlines controlled by option
20
22
  @@Col_tab_256 = [
21
23
  '000000','800000','008000','808000','000080','800080','008080','c0c0c0',
22
24
  '808080','ff0000','00ff00','ffff00','0000ff','ff00ff','00ffff','ffffff',
@@ -369,7 +371,7 @@ when 2 then
369
371
  @cur_css['font-weight'] = 'bold'; if(@k_1_is_bold_and_bright) then @curcol=@hicol; if(@cur_css['color']) then k = @locol.index(@cur_css['color'][1,6]); @cur_css['color'] = '#'+@curcol[k] if(k); end; end; end
370
372
  when 3 then
371
373
  begin
372
- if(@k_21_is_double_underline) then @cur_css.delete('text-decoration'); @cur_css['border-bottom'] = '3px double'; else @cur_css.delete('font-weight'); @curcol = @locol; end; end
374
+ if(@k_21_is_double_underline) then @cur_css.delete('text-decoration'); @cur_css['border-bottom'] = '3px double currentColor'; else @cur_css.delete('font-weight'); @curcol = @locol; end; end
373
375
  when 4 then
374
376
  begin
375
377
  @cur_css['font-weight'] = 'lighter'; end
@@ -450,10 +452,10 @@ when 29 then
450
452
  @cur_css = {}; @curcol = @locol end
451
453
  when 30 then
452
454
  begin
453
- o<<(@html_escapes[ i[p].ord.chr]); end
455
+ o<<(@html_escapes[ i[p].ord]); end
454
456
  when 31 then
455
457
  begin
456
- o<<( i[p].ord.chr); end
458
+ o<< i[p].ord.chr(Encoding::UTF_8); end
457
459
  when 32 then
458
460
  begin
459
461
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansi_sgr_to_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tassilo Philipp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-21 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Converter for complete ANSI SGR codes to HTML. Similar to ansitags gem,
14
14
  but smaller output (no nested spans), faster (converts everything in one pass),