ansi-sys 0.7.1 → 0.8.0
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.
- data/ChangeLog +13 -0
- data/History.txt +11 -0
- data/Manifest.txt +4 -0
- data/bin/ansi-to-html +39 -0
- data/lib/ansisys.rb +2 -2
- data/spec/ansi-to-html_spec.rb +9 -0
- data/spec/attach/test_utf8_wide.rendered.txt +2 -0
- data/spec/attach/test_utf8_wide.txt +1 -0
- data/website/index.html +1 -1
- metadata +10 -4
data/ChangeLog
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
* 2007-11-16 zunda <zunda at freeshell.org>
|
2
|
+
- (0.8.0)
|
3
|
+
- bin/ansi-to-html: modified to guess character codes of the inputs
|
4
|
+
- spec/ansi-to-html_spec.rb: added
|
5
|
+
- spec/attach/test_utf8_wide.txt and spec/attach/test_utf8_wide.rendered.txt:
|
6
|
+
added as test data for spec/ansi-to-html_spec.rb
|
7
|
+
- Manifest.txt: updated
|
8
|
+
- so far, bin/ansi-to-html was not incuded in packages. sorry.
|
9
|
+
- History.txt: updated
|
10
|
+
|
11
|
+
* 2007-11-16 zunda <zunda at freeshell.org>
|
12
|
+
- History.txt: updated
|
13
|
+
|
1
14
|
* 2007-11-16 zunda <zunda at freeshell.org>
|
2
15
|
- (0.7.1)
|
3
16
|
- lib/ansisys.rb: modified not to put wide-characters beyond right edge
|
data/History.txt
CHANGED
@@ -1,7 +1,18 @@
|
|
1
|
+
== 0.8.0 2007-11-14
|
2
|
+
|
3
|
+
* Added a command line interface: bin/ansi-to-html, really
|
4
|
+
* Modified bin/ansi-to-html to guess input character codes
|
5
|
+
|
6
|
+
== 0.7.0 2007-11-14
|
7
|
+
|
8
|
+
* Added a command line interface: bin/ansi-to-html
|
9
|
+
|
1
10
|
== 0.6.0 2007-11-03
|
11
|
+
|
2
12
|
* Clarified spec documents
|
3
13
|
|
4
14
|
== 0.5.0 2007-11-03
|
15
|
+
|
5
16
|
* Made Rdoc
|
6
17
|
|
7
18
|
== 0.4.1 2007-10-27
|
data/Manifest.txt
CHANGED
@@ -5,6 +5,7 @@ Makefile
|
|
5
5
|
Manifest.txt
|
6
6
|
README.txt
|
7
7
|
Rakefile
|
8
|
+
bin/ansi-to-html
|
8
9
|
config/hoe.rb
|
9
10
|
config/requirements.rb
|
10
11
|
gpl.rd.txt
|
@@ -15,9 +16,12 @@ script/destroy
|
|
15
16
|
script/generate
|
16
17
|
script/txt2html
|
17
18
|
setup.rb
|
19
|
+
spec/ansi-to-html_spec.rb
|
18
20
|
spec/attach/test_data.html
|
19
21
|
spec/attach/test_data.txt
|
20
22
|
spec/attach/test_utf8.txt
|
23
|
+
spec/attach/test_utf8_wide.rendered.txt
|
24
|
+
spec/attach/test_utf8_wide.txt
|
21
25
|
spec/character_screen_spec.rb
|
22
26
|
spec/character_spec.rb
|
23
27
|
spec/cursor_spec.rb
|
data/bin/ansi-to-html
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# ansi-to-html: command to convert ANSI-escaped texts to HTML fragments
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright (C) 2007 zunda <zunda at freeshell.org>
|
6
|
+
# License:: GPL
|
7
|
+
#
|
8
|
+
# == Todos
|
9
|
+
# * Command Line Options
|
10
|
+
# * Output character code
|
11
|
+
# * Colors
|
12
|
+
require 'nkf'
|
13
|
+
require 'ansisys'
|
14
|
+
|
15
|
+
# Following parameters are to be defined through command line options
|
16
|
+
srcs = ARGV
|
17
|
+
max_col = 80
|
18
|
+
colors = AnsiSys::Screen.default_css_colors(false, true)
|
19
|
+
style = AnsiSys::Screen.css_style(colors, max_col)
|
20
|
+
terminal = AnsiSys::Terminal.new
|
21
|
+
|
22
|
+
# Print out the HTML while reading
|
23
|
+
puts "<html>\n<head>\n<style>\n#{style}</style>\n</head>\n<body>"
|
24
|
+
srcs.each do |src|
|
25
|
+
prev_kcode = $KCODE
|
26
|
+
data = File.open(src){|f| f.read}
|
27
|
+
case NKF.guess(data)
|
28
|
+
when NKF::EUC
|
29
|
+
$KCODE = 'e'
|
30
|
+
when NKF::SJIS
|
31
|
+
$KCODE = 's'
|
32
|
+
when NKF::UTF8
|
33
|
+
$KCODE = 'u'
|
34
|
+
end
|
35
|
+
puts terminal.echo(data).render(:html, max_col, nil, colors)
|
36
|
+
terminal.echo("\e[2J\e[m")
|
37
|
+
$KCODE = prev_kcode
|
38
|
+
end
|
39
|
+
puts "</body>\n</html>"
|
data/lib/ansisys.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
script = File.join('bin', 'ansi-to-html')
|
2
|
+
source = File.join('spec', 'attach', 'test_utf8_wide.txt')
|
3
|
+
target = File.join('spec', 'attach', 'test_utf8_wide.rendered.txt')
|
4
|
+
|
5
|
+
describe "when rendering a UTF-8 text" do
|
6
|
+
it "should fold characters as expected" do
|
7
|
+
`ruby -Ilib #{script} #{source}`.should include(File.read(target).chomp)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
NoMethodError in 'BlogsController GET /show/:id は最大5件のエントリをロードすること'
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Ruby-ANSI.SYS</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ansi-sys"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ansi-sys" class="numbers">0.
|
36
|
+
<a href="http://rubyforge.org/projects/ansi-sys" class="numbers">0.8.0</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ansi-sys
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 0.8.0
|
7
|
+
date: 2007-11-17 00:00:00 -10:00
|
8
8
|
summary: Ruby-ANSI.SYS is a library to render texts with ANSI escape sequences.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- Manifest.txt
|
37
37
|
- README.txt
|
38
38
|
- Rakefile
|
39
|
+
- bin/ansi-to-html
|
39
40
|
- config/hoe.rb
|
40
41
|
- config/requirements.rb
|
41
42
|
- gpl.rd.txt
|
@@ -46,9 +47,12 @@ files:
|
|
46
47
|
- script/generate
|
47
48
|
- script/txt2html
|
48
49
|
- setup.rb
|
50
|
+
- spec/ansi-to-html_spec.rb
|
49
51
|
- spec/attach/test_data.html
|
50
52
|
- spec/attach/test_data.txt
|
51
53
|
- spec/attach/test_utf8.txt
|
54
|
+
- spec/attach/test_utf8_wide.rendered.txt
|
55
|
+
- spec/attach/test_utf8_wide.txt
|
52
56
|
- spec/character_screen_spec.rb
|
53
57
|
- spec/character_spec.rb
|
54
58
|
- spec/cursor_spec.rb
|
@@ -82,9 +86,11 @@ extra_rdoc_files:
|
|
82
86
|
- lgpl.rd.txt
|
83
87
|
- spec/attach/test_data.txt
|
84
88
|
- spec/attach/test_utf8.txt
|
89
|
+
- spec/attach/test_utf8_wide.rendered.txt
|
90
|
+
- spec/attach/test_utf8_wide.txt
|
85
91
|
- website/index.txt
|
86
|
-
executables:
|
87
|
-
|
92
|
+
executables:
|
93
|
+
- ansi-to-html
|
88
94
|
extensions: []
|
89
95
|
|
90
96
|
requirements: []
|