ansi-sys 0.6.0 → 0.7.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 +7 -0
- data/README.txt +1 -1
- data/lib/ansisys.rb +6 -5
- data/website/index.html +8 -8
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
* 2007-11-14 zunda <zunda at freeshell.org>
|
2
|
+
- (0.7.0)
|
3
|
+
- bin/ansi-to-html: added
|
4
|
+
- still having a problem in measureing widths multibyte characters
|
5
|
+
- lib/ansisys.rb: added RDoc, fixed some typos
|
6
|
+
- README.txt: fixed a typo
|
7
|
+
|
1
8
|
* 2007-11-03 zunda <zunda at freeshell.org>
|
2
9
|
- (0.6.0)
|
3
10
|
- spec/*_spec.rb: Clarified spec documents
|
data/README.txt
CHANGED
data/lib/ansisys.rb
CHANGED
@@ -11,7 +11,7 @@ require 'webrick'
|
|
11
11
|
module AnsiSys
|
12
12
|
module VERSION #:nodoc:
|
13
13
|
MAJOR = 0
|
14
|
-
MINOR =
|
14
|
+
MINOR = 7
|
15
15
|
TINY = 0
|
16
16
|
|
17
17
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
@@ -456,7 +456,8 @@ module AnsiSys
|
|
456
456
|
return h
|
457
457
|
end
|
458
458
|
|
459
|
-
# CSS stylelet to be used in <head
|
459
|
+
# CSS stylelet to be used in <head>.
|
460
|
+
# Takes the same arguments as Screen::css_styles().
|
460
461
|
def self.css_style(*args)
|
461
462
|
return "pre.screen {\n\t" + CSSFormatter.hash_to_styles(self.css_styles(*args), ";\n\t") + ";\n}\n"
|
462
463
|
end
|
@@ -695,7 +696,7 @@ if defined?(Hiki) and Hiki::Plugin == self.class
|
|
695
696
|
# _max_row_ can be specified.
|
696
697
|
# _invert_ and _bright_ can be specified to change colors.
|
697
698
|
# _page_ can be specified to show a file attached to another page.
|
698
|
-
def ansi_screen(file_name,
|
699
|
+
def ansi_screen(file_name, max_col = 80, invert = false, bright = true, page = @page)
|
699
700
|
return '' unless file_name =~ /\.(txt|rd|rb|c|pl|py|sh|java|html|htm|css|xml|xsl|sql|yaml)\z/i
|
700
701
|
page_file_name = "#{page.untaint.escape}/#{file_name.untaint.escape}"
|
701
702
|
path = "#{@conf.cache_path}/attach/#{page_file_name}"
|
@@ -705,10 +706,10 @@ if defined?(Hiki) and Hiki::Plugin == self.class
|
|
705
706
|
data = File.open(path){|f| f.read}.to_euc
|
706
707
|
|
707
708
|
colors = AnsiSys::Screen.default_css_colors(invert, bright)
|
708
|
-
styles = AnsiSys::CSSFormatter.hash_to_styles(AnsiSys::Screen.css_styles(colors,
|
709
|
+
styles = AnsiSys::CSSFormatter.hash_to_styles(AnsiSys::Screen.css_styles(colors, max_col, nil), '; ')
|
709
710
|
|
710
711
|
terminal = AnsiSys::Terminal.new
|
711
712
|
terminal.echo(data)
|
712
|
-
return terminal.render(:html,
|
713
|
+
return terminal.render(:html, max_col, nil, colors, 'screen', styles) + "\n"
|
713
714
|
end
|
714
715
|
end
|
data/website/index.html
CHANGED
@@ -33,9 +33,12 @@
|
|
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.3.0</a>
|
37
37
|
</div>
|
38
|
-
<
|
38
|
+
<h1>→ ‘ansi-sys’</h1>
|
39
|
+
|
40
|
+
|
41
|
+
<h2>What</h2>
|
39
42
|
|
40
43
|
|
41
44
|
<p>MS-DOS console (with <code>DEVICE=ANSI.SYS</code>), Linux
|
@@ -82,12 +85,9 @@ misc/plugin directory and configure Hiki to enable the plugin.</p>
|
|
82
85
|
<p>As a Ruby library:</p>
|
83
86
|
|
84
87
|
|
85
|
-
<pre>
|
86
|
-
require 'ansisys'
|
87
|
-
terminal = AnsiSys::Terminal.new
|
88
|
+
<pre>terminal = Terminal.new
|
88
89
|
terminal.echo("ansi-escaped-text")
|
89
|
-
terminal.render #=> HTML fragment
|
90
|
-
</pre>
|
90
|
+
terminal.render #=> HTML fragment</pre>
|
91
91
|
|
92
92
|
<p>As a Hiki plugin:</p>
|
93
93
|
|
@@ -110,7 +110,7 @@ terminal.render #=> HTML fragment
|
|
110
110
|
<p>Please refer
|
111
111
|
<a href="rdoc/files/License_txt.html">License.txt</a></p>
|
112
112
|
<p class="coda">
|
113
|
-
zunda,
|
113
|
+
zunda, 23rd October 2007<br>
|
114
114
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
115
115
|
</p>
|
116
116
|
</div>
|
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.7.0
|
7
|
+
date: 2007-11-14 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
|