rttool 1.0.2.0 → 1.0.3.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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ exec "rd2", "-r", "rd/rt-filter", "--with-part=RT:rt", *ARGV
data/bin/rt/rt2 CHANGED
@@ -2,7 +2,7 @@
2
2
  =begin
3
3
  = NAME
4
4
  rt2 - converter from RT to other mark-up language.
5
- $Id: rt2 597 2005-10-18 21:03:12Z rubikitch $
5
+ $Id: rt2 1532 2009-01-24 16:04:36Z rubikitch $
6
6
  = SYNOPSIS
7
7
  rt2 [-r <visitor>] [options] <file>
8
8
 
@@ -61,6 +61,7 @@ $RC = {}
61
61
  # initialize OptionParser
62
62
  ARGV.options = OptionParser.new("Usage: #{$0} [options] rt-file > output\n") do
63
63
  |q|
64
+ q.version = "1.0.3"
64
65
  q.on_head("global options:")
65
66
 
66
67
  q.on("-rLIB", "--require=LIB",
data/bin/rt2 ADDED
@@ -0,0 +1,163 @@
1
+ #! /usr/bin/env ruby
2
+ =begin
3
+ = NAME
4
+ rt2 - converter from RT to other mark-up language.
5
+ $Id: rt2 1532 2009-01-24 16:04:36Z rubikitch $
6
+ = SYNOPSIS
7
+ rt2 [-r <visitor>] [options] <file>
8
+
9
+ = DESCRIPTION
10
+ rt2 inputs from ((|<file>|)) and outputs in (({STDOUT})). you can
11
+ choose ((|<visitor>|)) to select output format. For example, use
12
+ "rt/rt2html-lib.rb" to turn it into HTML.
13
+
14
+ = OPTIONS
15
+ please check the output of
16
+ % rt2 --help
17
+ and
18
+ % rt2 -r rt/rt2html-lib.rb --help
19
+
20
+ = FILES
21
+ * ~/.rt2rc - User configuration file.
22
+
23
+ = SEE ALSO
24
+ ruby(1)
25
+ =end
26
+
27
+ require "kconv"
28
+ require "optparse"
29
+ require "rt/rtparser"
30
+
31
+ def Kconv.name2const(name)
32
+ case name
33
+ when "iso-2022-jp"
34
+ Kconv::JIS
35
+ when "euc-jp"
36
+ Kconv::EUC
37
+ when "shift_jis"
38
+ Kconv::SJIS
39
+ end
40
+ end
41
+
42
+ include RT
43
+
44
+ # global vars
45
+ $Visitor = nil
46
+ $RT2_Sub_OptionParser = nil
47
+
48
+ # local vars
49
+ include_path = []
50
+ with_part = []
51
+ output_file = nil
52
+ output_index = nil
53
+ out_code = nil
54
+ from_rto = nil
55
+
56
+ # user option
57
+ $DEFAULT_FORMAT_LIB = "rt/rt2txt-lib"
58
+ $RC = {}
59
+
60
+
61
+ # initialize OptionParser
62
+ ARGV.options = OptionParser.new("Usage: #{$0} [options] rt-file > output\n") do
63
+ |q|
64
+ q.version = "1.0.3"
65
+ q.on_head("global options:")
66
+
67
+ q.on("-rLIB", "--require=LIB",
68
+ String,
69
+ "choose format library.") do |i|
70
+ # require LIB
71
+ require i
72
+ if $Visitor_Class && !$Visitor
73
+ $Visitor = $Visitor_Class.new()
74
+ if $RT2_Sub_OptionParser
75
+ require $RT2_Sub_OptionParser
76
+ $RT2_Sub_OptionParser = nil
77
+ end
78
+ end
79
+ end
80
+
81
+ q.on("-oNAME",
82
+ String,
83
+ "indicate base name of output file") do |i|
84
+ output_file = i
85
+ end
86
+
87
+ q.on("--out-code=KCODE",
88
+ String,
89
+ "character encoding of output.(jis|euc|sjis)") do |i|
90
+ case i
91
+ when /sjis|shift-jis/i
92
+ out_code = "shift_jis"
93
+ when /jis|iso-2022-jp/i
94
+ out_code = "iso-2022-jp"
95
+ when /euc|euc-jp/i
96
+ out_code = "euc-jp"
97
+ end
98
+ end
99
+
100
+ q.on("-IPATH", "--include-path=PATH",
101
+ String,
102
+ "add PATH to list of include path") do |i|
103
+ # add to include path
104
+ include_path.unshift(i)
105
+ end
106
+
107
+ q.on_tail("--help",
108
+ "print this message") do
109
+ STDERR.print(q.to_s)
110
+ exit(0)
111
+ end
112
+ end # OptionParser.new
113
+
114
+ # require format lib implicitly
115
+ unless File.basename($0) == "rt2"
116
+ require "rt/" + File.basename($0) + "-lib.rb"
117
+ require $RT2_Sub_OptionParser if $RT2_Sub_OptionParser
118
+ # make visitor
119
+ $Visitor = $Visitor_Class.new()
120
+ end
121
+
122
+ begin
123
+ ARGV.parse!
124
+ rescue
125
+ STDERR.print("Error: " + $!.inspect + "\n")
126
+ STDERR.print(ARGV.options.to_s)
127
+ exit(1)
128
+ end
129
+
130
+ unless $Visitor_Class
131
+ require $DEFAULT_FORMAT_LIB
132
+ $Visitor = $Visitor_Class.new
133
+ end
134
+
135
+
136
+ # file base name setup
137
+ $Visitor.filename = output_file if output_file
138
+
139
+ # character encoding
140
+ if out_code
141
+ begin
142
+ $Visitor.charcode = out_code
143
+ rescue NameError
144
+ end
145
+ end
146
+
147
+ parsed = RTParser::parse(readlines.join)
148
+ # output
149
+ out = $Visitor.visit(parsed)
150
+
151
+ # character encoding convert
152
+ out = Kconv.kconv(out, Kconv.name2const(out_code), Kconv::AUTO) if out_code
153
+
154
+ if output_file
155
+ filename = output_file + "." + $Visitor.type::OUTPUT_SUFFIX
156
+ file = open(filename, "w")
157
+ file.print(out)
158
+ file.close
159
+ STDERR.print("#{$0}: output to #{filename}...\n")
160
+ else
161
+ print(out)
162
+ end
163
+
@@ -4,7 +4,7 @@
4
4
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
5
  <html xmlns="http://www.w3.org/1999/xhtml">
6
6
  <head>
7
- <title>rttest.rd</title>
7
+ <title>examples/rttest.rd</title>
8
8
  </head>
9
9
  <body>
10
10
  <h1><a name="label-0" id="label-0">Sample RD/RT</a></h1><!-- RDLabel: "Sample RD/RT" -->
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/ruby
2
2
  =begin
3
3
  rt2html-lib.rb
4
- $Id: rt2html-lib.rb 603 2005-10-22 08:05:44Z rubikitch $
4
+ $Id: rt2html-lib.rb 1531 2009-01-21 17:21:23Z rubikitch $
5
5
  =end
6
6
  require 'rt/rtvisitor'
7
+ require 'cgi'
7
8
 
8
9
  module RT
9
10
  class RT2HTMLVisitor < RTVisitor
10
11
  OUTPUT_SUFFIX = "html"
11
12
  INCLUDE_SUFFIX = ["html"]
12
13
 
13
- def initialize
14
- super
15
- end
14
+ def initialize() super end
16
15
 
17
16
  def block(name)
18
17
  %Q[<!-- #{name} -->\n] +
@@ -21,10 +20,13 @@ module RT
21
20
  end
22
21
  private :block
23
22
 
23
+ def esc(str) CGI.escapeHTML(str) end
24
+ private :esc
25
+
24
26
  def setup
25
27
  block('setup') do
26
28
  s = %Q[<table border="1">\n]
27
- s << %Q[<caption>#{caption}</caption>\n] if caption
29
+ s << %Q[<caption>#{esc(caption)}</caption>\n] if caption
28
30
  s
29
31
  end
30
32
  end
@@ -60,7 +62,7 @@ module RT
60
62
  ret << '<tr>'
61
63
  each_cell(line) do |cell|
62
64
  ret << cell_element(cell, 'th')
63
- ret << cell.value
65
+ ret << esc(cell.value)
64
66
  ret << '</th>'
65
67
  end
66
68
  ret << "</tr>\n"
@@ -77,7 +79,7 @@ module RT
77
79
  ret << '<tr>'
78
80
  each_cell(line) do |cell|
79
81
  ret << cell_element(cell, %Q[td align="#{cell.align.id2name}"])
80
- ret << cell.value
82
+ ret << esc(cell.value)
81
83
  ret << '</td>'
82
84
  end
83
85
  ret << "</tr>\n"
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  =begin
3
3
  rtvisitor.rb
4
- $Id: rtvisitor.rb 597 2005-10-18 21:03:12Z rubikitch $
4
+ $Id: rtvisitor.rb 1531 2009-01-21 17:21:23Z rubikitch $
5
5
  =end
6
6
  require 'rt/rtparser'
7
7
 
@@ -11,7 +11,6 @@ module RT
11
11
  ary.each do |x|
12
12
  if x.class == RT::RTCell
13
13
  yield x
14
- else
15
14
  end
16
15
  end
17
16
  end
@@ -33,11 +32,7 @@ module RT
33
32
  @body = @rt.body
34
33
  @caption = @rt.config['caption']
35
34
 
36
- setup +
37
- visit_Caption +
38
- visit_Header +
39
- visit_Body +
40
- teardown
35
+ setup + visit_Caption + visit_Header + visit_Body + teardown
41
36
  end
42
37
 
43
38
  def setup
@@ -14,23 +14,24 @@
14
14
  <ul>
15
15
  <li><p><a href="#label:1">What's new</a></p>
16
16
  <ul>
17
- <li><a href="#label:2">[2006/09/20] 1.0.2 released</a></li>
18
- <li><a href="#label:3">[2005/10/28] 1.0.1 released</a></li>
19
- <li><a href="#label:4">[2005/10/26] 1.0.0 released</a></li>
17
+ <li><a href="#label:2">[2009/01/25] 1.0.3 released</a></li>
18
+ <li><a href="#label:3">[2006/09/20] 1.0.2 released</a></li>
19
+ <li><a href="#label:4">[2005/10/28] 1.0.1 released</a></li>
20
+ <li><a href="#label:5">[2005/10/26] 1.0.0 released</a></li>
20
21
  </ul></li>
21
- <li><a href="#label:5">Abstract</a></li>
22
- <li><a href="#label:6">Environment</a></li>
23
- <li><a href="#label:7">Install</a></li>
24
- <li><a href="#label:8">RT Syntax</a></li>
25
- <li><a href="#label:12">Attributes</a></li>
26
- <li><p><a href="#label:18">Examples</a></p>
22
+ <li><a href="#label:6">Abstract</a></li>
23
+ <li><a href="#label:7">Environment</a></li>
24
+ <li><a href="#label:8">Install</a></li>
25
+ <li><a href="#label:9">RT Syntax</a></li>
26
+ <li><a href="#label:13">Attributes</a></li>
27
+ <li><p><a href="#label:19">Examples</a></p>
27
28
  <ul>
28
- <li><a href="#label:19">The Easiest RT</a></li>
29
- <li><a href="#label:20">Use the Escape Attribute</a></li>
30
- <li><a href="#label:21">More Complex RT</a></li>
31
- <li><a href="#label:22">RT Included by RD (RD/RT)</a></li>
29
+ <li><a href="#label:20">The Easiest RT</a></li>
30
+ <li><a href="#label:21">Use the Escape Attribute</a></li>
31
+ <li><a href="#label:22">More Complex RT</a></li>
32
+ <li><a href="#label:23">RT Included by RD (RD/RT)</a></li>
32
33
  </ul></li>
33
- <li><a href="#label:23">License</a></li>
34
+ <li><a href="#label:24">License</a></li>
34
35
  </ul>
35
36
  <hr />
36
37
 
@@ -38,65 +39,71 @@
38
39
 
39
40
  <h2><a name="1" href="#1">1</a> <a name="label:1">What's new</a></h2><!-- RDLabel: "What's new" -->
40
41
 
41
- <h3><a name="1.1" href="#1.1">1.1</a> <a name="label:2">[2006/09/20] 1.0.2 released</a></h3><!-- RDLabel: "[2006/09/20] 1.0.2 released" -->
42
+ <h3><a name="1.1" href="#1.1">1.1</a> <a name="label:2">[2009/01/25] 1.0.3 released</a></h3><!-- RDLabel: "[2009/01/25] 1.0.3 released" -->
43
+
44
+ <ul>
45
+ <li>HTML XSS bug fix.</li>
46
+ <li>RTtool works with Ruby 1.9 now.</li>
47
+ </ul>
48
+ <h3><a name="1.2" href="#1.2">1.2</a> <a name="label:3">[2006/09/20] 1.0.2 released</a></h3><!-- RDLabel: "[2006/09/20] 1.0.2 released" -->
42
49
 
43
50
  <ul>
44
51
  <li>Bugfix about linefeed.</li>
45
52
  </ul>
46
- <h3><a name="1.2" href="#1.2">1.2</a> <a name="label:3">[2005/10/28] 1.0.1 released</a></h3><!-- RDLabel: "[2005/10/28] 1.0.1 released" -->
53
+ <h3><a name="1.3" href="#1.3">1.3</a> <a name="label:4">[2005/10/28] 1.0.1 released</a></h3><!-- RDLabel: "[2005/10/28] 1.0.1 released" -->
47
54
 
48
55
  <ul>
49
56
  <li>RTtool does not use .rd2rc anymore.</li>
50
57
  </ul>
51
- <h3><a name="1.3" href="#1.3">1.3</a> <a name="label:4">[2005/10/26] 1.0.0 released</a></h3><!-- RDLabel: "[2005/10/26] 1.0.0 released" -->
58
+ <h3><a name="1.4" href="#1.4">1.4</a> <a name="label:5">[2005/10/26] 1.0.0 released</a></h3><!-- RDLabel: "[2005/10/26] 1.0.0 released" -->
52
59
 
53
60
  <ul>
54
61
  <li>Escape.</li>
55
62
  <li>English document.</li>
56
63
  <li>Removed Ruby-1.8 warning.</li>
57
64
  </ul>
58
- <h2><a name="2" href="#2">2</a> <a name="label:5">Abstract</a></h2><!-- RDLabel: "Abstract" -->
65
+ <h2><a name="2" href="#2">2</a> <a name="label:6">Abstract</a></h2><!-- RDLabel: "Abstract" -->
59
66
 
60
67
  <p>RT is a simple and human-readable table format.
61
68
  RTtool is a converter from RT into various formats.
62
69
  RT can be incorporated into RD.</p>
63
70
  <p>At this time, RTtool can convert RT into HTML and plain text.
64
71
  To convert into plain text, you need <a href="http://w3m.sourceforge.net/">w3m</a>.</p>
65
- <h2><a name="3" href="#3">3</a> <a name="label:6">Environment</a></h2><!-- RDLabel: "Environment" -->
72
+ <h2><a name="3" href="#3">3</a> <a name="label:7">Environment</a></h2><!-- RDLabel: "Environment" -->
66
73
 
67
- <h2><a name="4" href="#4">4</a> <a name="label:7">Install</a></h2><!-- RDLabel: "Install" -->
74
+ <h2><a name="4" href="#4">4</a> <a name="label:8">Install</a></h2><!-- RDLabel: "Install" -->
68
75
 
69
76
  <p>Please execute the following commands.</p>
70
- <pre>ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz").read.display' &gt; rttool-1.0.2.tar.gz</pre>
71
- <pre>tar xzvf rttool-1.0.2.tar.gz</pre>
77
+ <pre>ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz").read.display' &gt; rttool-1.0.3.tar.gz</pre>
78
+ <pre>tar xzvf rttool-1.0.3.tar.gz</pre>
72
79
  <p>When you failed, please download it from the next link.</p>
73
80
  <ul>
74
- <li><a href="http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz">rttool-1.0.2.tar.gz</a></li>
81
+ <li><a href="http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz">rttool-1.0.3.tar.gz</a></li>
75
82
  </ul>
76
83
  <p>Then, install it.</p>
77
- <pre>cd rttool-1.0.2
84
+ <pre>cd rttool-1.0.3
78
85
  ruby setup.rb config
79
86
  ruby setup.rb setup
80
87
  ruby setup.rb install</pre>
81
- <h2><a name="5" href="#5">5</a> <a name="label:8">RT Syntax</a></h2><!-- RDLabel: "RT Syntax" -->
88
+ <h2><a name="5" href="#5">5</a> <a name="label:9">RT Syntax</a></h2><!-- RDLabel: "RT Syntax" -->
82
89
 
83
90
  <ul>
84
91
  <li><p>RT consists of three Blocks.</p>
85
92
  <dl>
86
- <dt><a name="label:9" id="label:9"></a>ConfigBlock</dt><!-- RDLabel: "ConfigBlock" -->
93
+ <dt><a name="label:10" id="label:10"></a>ConfigBlock</dt><!-- RDLabel: "ConfigBlock" -->
87
94
  <dd>
88
95
  <p>ConfigBlock consist of groups of "attribute = value".
89
96
  The following examples has <code>caption</code> attribute.
90
97
  ConfigBlock can be omitted.</p>
91
98
  </dd>
92
- <dt><a name="label:10" id="label:10"></a>HeaderBlock</dt><!-- RDLabel: "HeaderBlock" -->
99
+ <dt><a name="label:11" id="label:11"></a>HeaderBlock</dt><!-- RDLabel: "HeaderBlock" -->
93
100
  <dd>
94
101
  <p>A part of THEAD by HTML.
95
102
  HeaderBlock sets a header of the table.
96
103
  A header is located at the center.
97
104
  HeaderBlock can be omitted.</p>
98
105
  </dd>
99
- <dt><a name="label:11" id="label:11"></a>BodyBlock</dt><!-- RDLabel: "BodyBlock" -->
106
+ <dt><a name="label:12" id="label:12"></a>BodyBlock</dt><!-- RDLabel: "BodyBlock" -->
100
107
  <dd>
101
108
  <p>A part of TBODY by HTML.
102
109
  BodyBlock sets data of the table.
@@ -111,35 +118,35 @@ A number is located at the right and others are located at left.</p>
111
118
  <li><code>==</code> stretches the left column. (colspan)</li>
112
119
  <li><code>||</code> stretches the upper row. (rowspan)</li>
113
120
  </ul>
114
- <h2><a name="6" href="#6">6</a> <a name="label:12">Attributes</a></h2><!-- RDLabel: "Attributes" -->
121
+ <h2><a name="6" href="#6">6</a> <a name="label:13">Attributes</a></h2><!-- RDLabel: "Attributes" -->
115
122
 
116
123
  <p>In ConfigBlock, these attributes can be set.</p>
117
124
  <dl>
118
- <dt><a name="label:13" id="label:13"></a>caption</dt><!-- RDLabel: "caption" -->
125
+ <dt><a name="label:14" id="label:14"></a>caption</dt><!-- RDLabel: "caption" -->
119
126
  <dd>
120
127
  <p>The caption of the table.</p>
121
128
  </dd>
122
- <dt><a name="label:14" id="label:14"></a>delimiter</dt><!-- RDLabel: "delimiter" -->
129
+ <dt><a name="label:15" id="label:15"></a>delimiter</dt><!-- RDLabel: "delimiter" -->
123
130
  <dd>
124
131
  <p>The delimiter of the table.</p>
125
132
  </dd>
126
- <dt><a name="label:15" id="label:15"></a>rowspan</dt><!-- RDLabel: "rowspan" -->
133
+ <dt><a name="label:16" id="label:16"></a>rowspan</dt><!-- RDLabel: "rowspan" -->
127
134
  <dd>
128
135
  <p>A string which stretches the left column. (defalut: <code>==</code>)</p>
129
136
  </dd>
130
- <dt><a name="label:16" id="label:16"></a>colspan</dt><!-- RDLabel: "colspan" -->
137
+ <dt><a name="label:17" id="label:17"></a>colspan</dt><!-- RDLabel: "colspan" -->
131
138
  <dd>
132
139
  <p>A string which stretches the upper row. (default: <code>||</code>)</p>
133
140
  </dd>
134
- <dt><a name="label:17" id="label:17"></a>escape</dt><!-- RDLabel: "escape" -->
141
+ <dt><a name="label:18" id="label:18"></a>escape</dt><!-- RDLabel: "escape" -->
135
142
  <dd>
136
143
  <p>An escape character.
137
144
  This attribute is disabled by default.</p>
138
145
  </dd>
139
146
  </dl>
140
- <h2><a name="7" href="#7">7</a> <a name="label:18">Examples</a></h2><!-- RDLabel: "Examples" -->
147
+ <h2><a name="7" href="#7">7</a> <a name="label:19">Examples</a></h2><!-- RDLabel: "Examples" -->
141
148
 
142
- <h3><a name="7.1" href="#7.1">7.1</a> <a name="label:19">The Easiest RT</a></h3><!-- RDLabel: "The Easiest RT" -->
149
+ <h3><a name="7.1" href="#7.1">7.1</a> <a name="label:20">The Easiest RT</a></h3><!-- RDLabel: "The Easiest RT" -->
143
150
 
144
151
  <pre>$ cat examples/easiest.rt
145
152
  1, 2, 3
@@ -174,7 +181,7 @@ $ rt2 -r rt/rt2html-lib examples/easiest.rt
174
181
  &lt;!-- teardown --&gt;
175
182
  &lt;/table&gt;
176
183
  &lt;!-- teardown end --&gt;</pre>
177
- <h3><a name="7.2" href="#7.2">7.2</a> <a name="label:20">Use the Escape Attribute</a></h3><!-- RDLabel: "Use the Escape Attribute" -->
184
+ <h3><a name="7.2" href="#7.2">7.2</a> <a name="label:21">Use the Escape Attribute</a></h3><!-- RDLabel: "Use the Escape Attribute" -->
178
185
 
179
186
  <pre>$ cat examples/escape.rt
180
187
  delimiter = ;
@@ -204,7 +211,7 @@ $ rt2 -r rt/rt2html-lib examples/escape.rt
204
211
  &lt;!-- teardown --&gt;
205
212
  &lt;/table&gt;
206
213
  &lt;!-- teardown end --&gt;</pre>
207
- <h3><a name="7.3" href="#7.3">7.3</a> <a name="label:21">More Complex RT</a></h3><!-- RDLabel: "More Complex RT" -->
214
+ <h3><a name="7.3" href="#7.3">7.3</a> <a name="label:22">More Complex RT</a></h3><!-- RDLabel: "More Complex RT" -->
208
215
 
209
216
  <pre>$ cat examples/test1.rt
210
217
  caption = Test Table
@@ -250,7 +257,7 @@ $ rt2 -r rt/rt2html-lib examples/test1.rt
250
257
  &lt;!-- teardown --&gt;
251
258
  &lt;/table&gt;
252
259
  &lt;!-- teardown end --&gt;</pre>
253
- <h3><a name="7.4" href="#7.4">7.4</a> <a name="label:22">RT Included by RD (RD/RT)</a></h3><!-- RDLabel: "RT Included by RD (RD/RT)" -->
260
+ <h3><a name="7.4" href="#7.4">7.4</a> <a name="label:23">RT Included by RD (RD/RT)</a></h3><!-- RDLabel: "RT Included by RD (RD/RT)" -->
254
261
 
255
262
  <pre>$ cat examples/rttest.rd
256
263
  =begin
@@ -291,7 +298,7 @@ This RD contains a table. It is so-called RD/RT.
291
298
  $B(&(!(*(!(!(*(!(!(*(!(!(*(!(!(%(B
292
299
 
293
300
  It is simple.</pre>
294
- <h2><a name="8" href="#8">8</a> <a name="label:23">License</a></h2><!-- RDLabel: "License" -->
301
+ <h2><a name="8" href="#8">8</a> <a name="label:24">License</a></h2><!-- RDLabel: "License" -->
295
302
 
296
303
  <p>Ruby's</p>
297
304
 
@@ -6,6 +6,10 @@
6
6
  ##### [whats new]
7
7
  == What's new
8
8
 
9
+ === [2009/01/25] 1.0.3 released
10
+ * HTML XSS bug fix.
11
+ * RTtool works with Ruby 1.9 now.
12
+
9
13
  === [2006/09/20] 1.0.2 released
10
14
  * Bugfix about linefeed.
11
15
 
@@ -36,17 +40,17 @@ To convert into plain text, you need ((<w3m|URL:http://w3m.sourceforge.net/>)).
36
40
  == Install
37
41
  Please execute the following commands.
38
42
 
39
- ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz").read.display' > rttool-1.0.2.tar.gz
40
- tar xzvf rttool-1.0.2.tar.gz
43
+ ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz").read.display' > rttool-1.0.3.tar.gz
44
+ tar xzvf rttool-1.0.3.tar.gz
41
45
 
42
46
 
43
47
  When you failed, please download it from the next link.
44
48
 
45
- * ((<rttool-1.0.2.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz>))
49
+ * ((<rttool-1.0.3.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz>))
46
50
 
47
51
  Then, install it.
48
52
 
49
- cd rttool-1.0.2
53
+ cd rttool-1.0.3
50
54
  ruby setup.rb config
51
55
  ruby setup.rb setup
52
56
  ruby setup.rb install
@@ -14,29 +14,30 @@
14
14
  <ul>
15
15
  <li><p><a href="#label:1">$B99?7MzNr(B</a></p>
16
16
  <ul>
17
- <li><a href="#label:2">[2006/09/20] 1.0.2 released</a></li>
18
- <li><a href="#label:3">[2005/10/28] 1.0.1 released</a></li>
19
- <li><a href="#label:4">[2005/10/26] 1.0.0 released</a></li>
20
- <li><a href="#label:5">[2001/11/15] 0.1.7 released</a></li>
21
- <li><a href="#label:6">[2001/08/07] 0.1.6 released</a></li>
22
- <li><a href="#label:7">[2001/07/17] 0.1.5 released</a></li>
23
- <li><a href="#label:8">[2001/07/09] 0.1.4 released</a></li>
24
- <li><a href="#label:9">[2001/06/03] 0.1.3 released</a></li>
17
+ <li><a href="#label:2">[2009/01/25] 1.0.3 released</a></li>
18
+ <li><a href="#label:3">[2006/09/20] 1.0.2 released</a></li>
19
+ <li><a href="#label:4">[2005/10/28] 1.0.1 released</a></li>
20
+ <li><a href="#label:5">[2005/10/26] 1.0.0 released</a></li>
21
+ <li><a href="#label:6">[2001/11/15] 0.1.7 released</a></li>
22
+ <li><a href="#label:7">[2001/08/07] 0.1.6 released</a></li>
23
+ <li><a href="#label:8">[2001/07/17] 0.1.5 released</a></li>
24
+ <li><a href="#label:9">[2001/07/09] 0.1.4 released</a></li>
25
+ <li><a href="#label:10">[2001/06/03] 0.1.3 released</a></li>
25
26
  </ul></li>
26
- <li><a href="#label:10">$B35MW(B</a></li>
27
- <li><a href="#label:11">$B%$%s%9%H!<%k(B</a></li>
28
- <li><a href="#label:12">RT$B$NJ8K!(B</a></li>
29
- <li><a href="#label:16">$BB0@-0lMw(B</a></li>
30
- <li><p><a href="#label:22">$BNc(B</a></p>
27
+ <li><a href="#label:11">$B35MW(B</a></li>
28
+ <li><a href="#label:12">$B%$%s%9%H!<%k(B</a></li>
29
+ <li><a href="#label:13">RT$B$NJ8K!(B</a></li>
30
+ <li><a href="#label:17">$BB0@-0lMw(B</a></li>
31
+ <li><p><a href="#label:23">$BNc(B</a></p>
31
32
  <ul>
32
- <li><a href="#label:23">$B0lHV4JC1$J(BRT</a></li>
33
- <li><a href="#label:24">$B%(%9%1!<%W(B</a></li>
34
- <li><a href="#label:25">$B$A$g$C$HJ#;($J(BRT</a></li>
35
- <li><a href="#label:26">RD$B$KKd$a9~$`(B</a></li>
33
+ <li><a href="#label:24">$B0lHV4JC1$J(BRT</a></li>
34
+ <li><a href="#label:25">$B%(%9%1!<%W(B</a></li>
35
+ <li><a href="#label:26">$B$A$g$C$HJ#;($J(BRT</a></li>
36
+ <li><a href="#label:27">RD$B$KKd$a9~$`(B</a></li>
36
37
  </ul></li>
37
- <li><a href="#label:27">$B$J$<$K(BRT</a></li>
38
- <li><a href="#label:28">TODO</a></li>
39
- <li><a href="#label:29">$B%i%$%;%s%9(B</a></li>
38
+ <li><a href="#label:28">$B$J$<$K(BRT</a></li>
39
+ <li><a href="#label:29">TODO</a></li>
40
+ <li><a href="#label:30">$B%i%$%;%s%9(B</a></li>
40
41
  </ul>
41
42
  <hr />
42
43
 
@@ -44,48 +45,54 @@
44
45
 
45
46
  <h2><a name="1" href="#1">1</a> <a name="label:1">$B99?7MzNr(B</a></h2><!-- RDLabel: "$B99?7MzNr(B" -->
46
47
 
47
- <h3><a name="1.1" href="#1.1">1.1</a> <a name="label:2">[2006/09/20] 1.0.2 released</a></h3><!-- RDLabel: "[2006/09/20] 1.0.2 released" -->
48
+ <h3><a name="1.1" href="#1.1">1.1</a> <a name="label:2">[2009/01/25] 1.0.3 released</a></h3><!-- RDLabel: "[2009/01/25] 1.0.3 released" -->
49
+
50
+ <ul>
51
+ <li>HTML$B=PNO;~$N%/%m%9%5%$%H%9%/%j%W%F%#%s%0@H<e@-$r=$@5!#(B</li>
52
+ <li>Ruby 1.9$BBP1~!#(B</li>
53
+ </ul>
54
+ <h3><a name="1.2" href="#1.2">1.2</a> <a name="label:3">[2006/09/20] 1.0.2 released</a></h3><!-- RDLabel: "[2006/09/20] 1.0.2 released" -->
48
55
 
49
56
  <ul>
50
57
  <li>$B2~9T%3!<%I$,(BDOS, MAC$B$@$H$&$^$/F0:n$7$J$$%P%0$r=$@5!#(B</li>
51
58
  </ul>
52
- <h3><a name="1.2" href="#1.2">1.2</a> <a name="label:3">[2005/10/28] 1.0.1 released</a></h3><!-- RDLabel: "[2005/10/28] 1.0.1 released" -->
59
+ <h3><a name="1.3" href="#1.3">1.3</a> <a name="label:4">[2005/10/28] 1.0.1 released</a></h3><!-- RDLabel: "[2005/10/28] 1.0.1 released" -->
53
60
 
54
61
  <ul>
55
62
  <li>.rd2rc$B$r;H$o$J$/$J$C$?!#(B</li>
56
63
  </ul>
57
- <h3><a name="1.3" href="#1.3">1.3</a> <a name="label:4">[2005/10/26] 1.0.0 released</a></h3><!-- RDLabel: "[2005/10/26] 1.0.0 released" -->
64
+ <h3><a name="1.4" href="#1.4">1.4</a> <a name="label:5">[2005/10/26] 1.0.0 released</a></h3><!-- RDLabel: "[2005/10/26] 1.0.0 released" -->
58
65
 
59
66
  <ul>
60
67
  <li>$B%(%9%1!<%W$G$-$k$h$&$K$J$C$?!#1Q8l$N%I%-%e%a%s%HIUB0!#(B</li>
61
68
  <li>Ruby1.8$B$N(Bwarning$B$r:o=|!#(B</li>
62
69
  </ul>
63
- <h3><a name="1.4" href="#1.4">1.4</a> <a name="label:5">[2001/11/15] 0.1.7 released</a></h3><!-- RDLabel: "[2001/11/15] 0.1.7 released" -->
70
+ <h3><a name="1.5" href="#1.5">1.5</a> <a name="label:6">[2001/11/15] 0.1.7 released</a></h3><!-- RDLabel: "[2001/11/15] 0.1.7 released" -->
64
71
 
65
72
  <ul>
66
73
  <li>$BId9f$D$-$N?t;z$G$b1&B7$($K$9$k$h$&$K$7$?!#(B</li>
67
74
  </ul>
68
- <h3><a name="1.5" href="#1.5">1.5</a> <a name="label:6">[2001/08/07] 0.1.6 released</a></h3><!-- RDLabel: "[2001/08/07] 0.1.6 released" -->
75
+ <h3><a name="1.6" href="#1.6">1.6</a> <a name="label:7">[2001/08/07] 0.1.6 released</a></h3><!-- RDLabel: "[2001/08/07] 0.1.6 released" -->
69
76
 
70
77
  <ul>
71
78
  <li>$B6uGr%;%k$N=hM}$G$N%P%0$rBP=h!#(B</li>
72
79
  </ul>
73
- <h3><a name="1.6" href="#1.6">1.6</a> <a name="label:7">[2001/07/17] 0.1.5 released</a></h3><!-- RDLabel: "[2001/07/17] 0.1.5 released" -->
80
+ <h3><a name="1.7" href="#1.7">1.7</a> <a name="label:8">[2001/07/17] 0.1.5 released</a></h3><!-- RDLabel: "[2001/07/17] 0.1.5 released" -->
74
81
 
75
82
  <ul>
76
83
  <li>rt2html-lib.rb: caption$B$,;XDj$7$F$J$$$H$-$O(BCAPTION$BMWAG$r$D$1$J$$$h$&$K!#(B</li>
77
84
  </ul>
78
- <h3><a name="1.7" href="#1.7">1.7</a> <a name="label:8">[2001/07/09] 0.1.4 released</a></h3><!-- RDLabel: "[2001/07/09] 0.1.4 released" -->
85
+ <h3><a name="1.8" href="#1.8">1.8</a> <a name="label:9">[2001/07/09] 0.1.4 released</a></h3><!-- RDLabel: "[2001/07/09] 0.1.4 released" -->
79
86
 
80
87
  <ul>
81
88
  <li>$B$"$*$-$5$s$N(Bsetup.rb$B$r;HMQ!#(B $B$=$l$KH<$$!"%Q%C%1!<%89=@.$rJQ99!#(B</li>
82
89
  </ul>
83
- <h3><a name="1.8" href="#1.8">1.8</a> <a name="label:9">[2001/06/03] 0.1.3 released</a></h3><!-- RDLabel: "[2001/06/03] 0.1.3 released" -->
90
+ <h3><a name="1.9" href="#1.9">1.9</a> <a name="label:10">[2001/06/03] 0.1.3 released</a></h3><!-- RDLabel: "[2001/06/03] 0.1.3 released" -->
84
91
 
85
92
  <ul>
86
93
  <li>rt2html-lib.rb$B$K$*$$$F%?%0$r>.J8;z$KJQ99!#$3$l$G(BXHTML$B$G$bBg>fIW!#(B</li>
87
94
  </ul>
88
- <h2><a name="2" href="#2">2</a> <a name="label:10">$B35MW(B</a></h2><!-- RDLabel: "$B35MW(B" -->
95
+ <h2><a name="2" href="#2">2</a> <a name="label:11">$B35MW(B</a></h2><!-- RDLabel: "$B35MW(B" -->
89
96
 
90
97
  <p>RTtool$B$O%7%s%W%k$J:nI=%D!<%k!#(B
91
98
  RD$B$NGd$j$G$"$k(B<em>$B2DFI@-(B</em>$B$H(B<em>$B$5$^$6$^$J%U%)!<%^%C%H$KJQ492DG=(B</em>$B$r7Q>5$7!"(B
@@ -96,17 +103,17 @@ w3m$B$N(BWindows$BHG$O(BCygwin$B$7$+$J$$$N$G!"(BWindows$B$N?M$O(BCygwin
96
103
  HTML$B$X$NJQ49$N$_I,MW$J$i$P(Bw3m$B$OITMW$G$"$k!#(B</p>
97
104
  <p>$B@_7W$NJ}$b(BRDtool$B$H;w$;$F$$$k!#(B
98
105
  parser$B$H(Bvisitor$B$KJ,$1!"(Brt2html-lib.rb$B$r:n@.!#(B</p>
99
- <h2><a name="3" href="#3">3</a> <a name="label:11">$B%$%s%9%H!<%k(B</a></h2><!-- RDLabel: "$B%$%s%9%H!<%k(B" -->
106
+ <h2><a name="3" href="#3">3</a> <a name="label:12">$B%$%s%9%H!<%k(B</a></h2><!-- RDLabel: "$B%$%s%9%H!<%k(B" -->
100
107
 
101
108
  <p>$B0J2<$N%3%^%s%I$r<B9T!#(B</p>
102
- <pre>ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz").read.display' &gt; rttool-1.0.2.tar.gz</pre>
103
- <pre>tar xzvf rttool-1.0.2.tar.gz</pre>
109
+ <pre>ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz").read.display' &gt; rttool-1.0.3.tar.gz</pre>
110
+ <pre>tar xzvf rttool-1.0.3.tar.gz</pre>
104
111
  <p>$B<:GT$9$k>l9g$O<!$N%j%s%/$+$i%@%&%s%m!<%I!#(B</p>
105
112
  <ul>
106
- <li><a href="http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz">rttool-1.0.2.tar.gz</a></li>
113
+ <li><a href="http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz">rttool-1.0.3.tar.gz</a></li>
107
114
  </ul>
108
115
  <p>$B$=$l$+$i<!$N%3%^%s%I$G%$%s%9%H!<%k!#(B</p>
109
- <pre>cd rttool-1.0.2
116
+ <pre>cd rttool-1.0.3
110
117
  ruby setup.rb config
111
118
  ruby setup.rb setup
112
119
  ruby setup.rb install</pre>
@@ -122,25 +129,25 @@ ruby setup.rb install</pre>
122
129
  <li>$BB8:_$9$k$H$-$O!":9J,$rE,59@_Dj$9$k!#(B</li>
123
130
  </ul></li>
124
131
  </ol>
125
- <h2><a name="4" href="#4">4</a> <a name="label:12">RT$B$NJ8K!(B</a></h2><!-- RDLabel: "RT$B$NJ8K!(B" -->
132
+ <h2><a name="4" href="#4">4</a> <a name="label:13">RT$B$NJ8K!(B</a></h2><!-- RDLabel: "RT$B$NJ8K!(B" -->
126
133
 
127
134
  <ul>
128
135
  <li><p>RT$B$O(B3$B$D$N(BBlock$B$G9=@.$5$l$k(B</p>
129
136
  <dl>
130
- <dt><a name="label:13" id="label:13"></a>ConfigBlock</dt><!-- RDLabel: "ConfigBlock" -->
137
+ <dt><a name="label:14" id="label:14"></a>ConfigBlock</dt><!-- RDLabel: "ConfigBlock" -->
131
138
  <dd>
132
139
  <p>$B!VB0@-(B = $BCM!W$NAH$+$i$J$k!#(B
133
140
  $B0J2<$NNc$G$O(B caption $BB0@-$r@_Dj$7!"I=Bj$r$D$1$F$$$k!#(B
134
141
  $B$3$N(BBlock$B$O>JN,$G$-$k!#(B</p>
135
142
  </dd>
136
- <dt><a name="label:14" id="label:14"></a>HeaderBlock</dt><!-- RDLabel: "HeaderBlock" -->
143
+ <dt><a name="label:15" id="label:15"></a>HeaderBlock</dt><!-- RDLabel: "HeaderBlock" -->
137
144
  <dd>
138
145
  <p>HTML$B$G$$$&(BTHEAD$B$NItJ,!#(B
139
146
  $BI=$N%X%C%@$r@_Dj$9$k!#(B
140
147
  $B%X%C%@$OCf1{B7$($K$J$k!#(B
141
148
  $B$3$N(BBlock$B$b>JN,$G$-$k!#(B</p>
142
149
  </dd>
143
- <dt><a name="label:15" id="label:15"></a>BodyBlock</dt><!-- RDLabel: "BodyBlock" -->
150
+ <dt><a name="label:16" id="label:16"></a>BodyBlock</dt><!-- RDLabel: "BodyBlock" -->
144
151
  <dd>
145
152
  <p>HTML$B$G$$$&(BTBODY$B$NItJ,!#(B
146
153
  $B%G!<%?$r5-=R$9$k!#(B
@@ -164,35 +171,35 @@ ruby setup.rb install</pre>
164
171
  <li>colspan $BB0@-$NCM$rJQ$($k$3$H$GG$0U$NJ8;z$K$G$-$k!#(B</li>
165
172
  </ul></li>
166
173
  </ul>
167
- <h2><a name="5" href="#5">5</a> <a name="label:16">$BB0@-0lMw(B</a></h2><!-- RDLabel: "$BB0@-0lMw(B" -->
174
+ <h2><a name="5" href="#5">5</a> <a name="label:17">$BB0@-0lMw(B</a></h2><!-- RDLabel: "$BB0@-0lMw(B" -->
168
175
 
169
176
  <p>ConfigBlock$B$G$O<!$NB0@-$,@_Dj$G$-$k!#(B</p>
170
177
  <dl>
171
- <dt><a name="label:17" id="label:17"></a>caption</dt><!-- RDLabel: "caption" -->
178
+ <dt><a name="label:18" id="label:18"></a>caption</dt><!-- RDLabel: "caption" -->
172
179
  <dd>
173
180
  <p>$BI=$N%?%$%H%k$r@_Dj$9$k!#(B</p>
174
181
  </dd>
175
- <dt><a name="label:18" id="label:18"></a>delimiter</dt><!-- RDLabel: "delimiter" -->
182
+ <dt><a name="label:19" id="label:19"></a>delimiter</dt><!-- RDLabel: "delimiter" -->
176
183
  <dd>
177
184
  <p>$B%G!<%?$N6h@Z$r;XDj$9$k!#(B</p>
178
185
  </dd>
179
- <dt><a name="label:19" id="label:19"></a>rowspan</dt><!-- RDLabel: "rowspan" -->
186
+ <dt><a name="label:20" id="label:20"></a>rowspan</dt><!-- RDLabel: "rowspan" -->
180
187
  <dd>
181
188
  <p>$B:8$NNs$r?-$P$9;XDj!#!J%G%U%)%k%H$O(B<code>==</code>$B!K(B</p>
182
189
  </dd>
183
- <dt><a name="label:20" id="label:20"></a>colspan</dt><!-- RDLabel: "colspan" -->
190
+ <dt><a name="label:21" id="label:21"></a>colspan</dt><!-- RDLabel: "colspan" -->
184
191
  <dd>
185
192
  <p>$B>e$N9T$r?-$P$9@_Dj!#!J%G%U%)%k%H$O(B<code>||</code>$B!K(B</p>
186
193
  </dd>
187
- <dt><a name="label:21" id="label:21"></a>escape</dt><!-- RDLabel: "escape" -->
194
+ <dt><a name="label:22" id="label:22"></a>escape</dt><!-- RDLabel: "escape" -->
188
195
  <dd>
189
196
  <p>delimiter$B$r%G!<%?$K4^$a$kI,MW$,$"$k$H$-$K$3$NB0@-$G;XDj$5$l$?J8;z$rA0CV$9$k!#(B
190
197
  $B%G%U%)%k%H$G$OL58z$H$J$C$F$$$k!#(B</p>
191
198
  </dd>
192
199
  </dl>
193
- <h2><a name="6" href="#6">6</a> <a name="label:22">$BNc(B</a></h2><!-- RDLabel: "$BNc(B" -->
200
+ <h2><a name="6" href="#6">6</a> <a name="label:23">$BNc(B</a></h2><!-- RDLabel: "$BNc(B" -->
194
201
 
195
- <h3><a name="6.1" href="#6.1">6.1</a> <a name="label:23">$B0lHV4JC1$J(BRT</a></h3><!-- RDLabel: "$B0lHV4JC1$J(BRT" -->
202
+ <h3><a name="6.1" href="#6.1">6.1</a> <a name="label:24">$B0lHV4JC1$J(BRT</a></h3><!-- RDLabel: "$B0lHV4JC1$J(BRT" -->
196
203
 
197
204
  <p>$BCM$r%+%s%^$G6h@Z$k$N$,0lHV4JC1$J(BRT$B!#(B</p>
198
205
  <pre>$ cat examples/easiest.rt
@@ -228,7 +235,7 @@ $ rt2 -r rt/rt2html-lib examples/easiest.rt
228
235
  &lt;!-- teardown --&gt;
229
236
  &lt;/table&gt;
230
237
  &lt;!-- teardown end --&gt;</pre>
231
- <h3><a name="6.2" href="#6.2">6.2</a> <a name="label:24">$B%(%9%1!<%W(B</a></h3><!-- RDLabel: "$B%(%9%1!<%W(B" -->
238
+ <h3><a name="6.2" href="#6.2">6.2</a> <a name="label:25">$B%(%9%1!<%W(B</a></h3><!-- RDLabel: "$B%(%9%1!<%W(B" -->
232
239
 
233
240
  <p>RT$B$O(Bdelimiter$B$r<+M3$K;XDj$G$-$k$,!"(Bdelimiter$B$rCO$NJ8$K4^$a$kI,MW$,$"$k$H$-!"(B</p>
234
241
  <ul>
@@ -264,7 +271,7 @@ $ rt2 -r rt/rt2html-lib examples/escape.rt
264
271
  &lt;!-- teardown --&gt;
265
272
  &lt;/table&gt;
266
273
  &lt;!-- teardown end --&gt;</pre>
267
- <h3><a name="6.3" href="#6.3">6.3</a> <a name="label:25">$B$A$g$C$HJ#;($J(BRT</a></h3><!-- RDLabel: "$B$A$g$C$HJ#;($J(BRT" -->
274
+ <h3><a name="6.3" href="#6.3">6.3</a> <a name="label:26">$B$A$g$C$HJ#;($J(BRT</a></h3><!-- RDLabel: "$B$A$g$C$HJ#;($J(BRT" -->
268
275
 
269
276
  <pre>$ cat examples/test1.rt
270
277
  caption = Test Table
@@ -310,7 +317,7 @@ $ rt2 -r rt/rt2html-lib examples/test1.rt
310
317
  &lt;!-- teardown --&gt;
311
318
  &lt;/table&gt;
312
319
  &lt;!-- teardown end --&gt;</pre>
313
- <h3><a name="6.4" href="#6.4">6.4</a> <a name="label:26">RD$B$KKd$a9~$`(B</a></h3><!-- RDLabel: "RD$B$KKd$a9~$`(B" -->
320
+ <h3><a name="6.4" href="#6.4">6.4</a> <a name="label:27">RD$B$KKd$a9~$`(B</a></h3><!-- RDLabel: "RD$B$KKd$a9~$`(B" -->
314
321
 
315
322
  <p>$B$5$i$K!"(BRD$B$KKd$a9~$`$3$H$b$G$-$k$N$@!#(B
316
323
  RT$B$O(B<em>RD$B$G$O$J$$$N$G(BRD$B$N(Bfilter$B5!G=$r;H$&(B</em>$B$3$H$K$J$k!#(B
@@ -356,7 +363,7 @@ This RD contains a table. It is so-called RD/RT.
356
363
  $B(&(!(*(!(!(*(!(!(*(!(!(*(!(!(%(B
357
364
 
358
365
  It is simple.</pre>
359
- <h2><a name="7" href="#7">7</a> <a name="label:27">$B$J$<$K(BRT</a></h2><!-- RDLabel: "$B$J$<$K(BRT" -->
366
+ <h2><a name="7" href="#7">7</a> <a name="label:28">$B$J$<$K(BRT</a></h2><!-- RDLabel: "$B$J$<$K(BRT" -->
360
367
 
361
368
  <ul>
362
369
  <li><p>HTML$B$d(BLaTeX$B$NI=$N=q$-J}$,$A$g$$%$%i$D$/!#(B</p>
@@ -372,10 +379,10 @@ It is simple.</pre>
372
379
  <li>$B26$,(BRD$B$r0&$7$F$k$+$i!#(B</li>
373
380
  <li>$B<+J,$K9g$C$?I=:n@.%D!<%k$,$[$7$$!#(B</li>
374
381
  </ul>
375
- <h2><a name="8" href="#8">8</a> <a name="label:28">TODO</a></h2><!-- RDLabel: "TODO" -->
382
+ <h2><a name="8" href="#8">8</a> <a name="label:29">TODO</a></h2><!-- RDLabel: "TODO" -->
376
383
 
377
- <p>$BLs(B6$BG/!"$$$m$$$m$J$3$H$r9M$($F$$$?$,8=:_$N%7%s%W%k$J;EMM$N$^$^$,$$$$$HH=CG$7$?!#(B</p>
378
- <h2><a name="9" href="#9">9</a> <a name="label:29">$B%i%$%;%s%9(B</a></h2><!-- RDLabel: "$B%i%$%;%s%9(B" -->
384
+ <p>$BLs(B9$BG/!"$$$m$$$m$J$3$H$r9M$($F$$$?$,8=:_$N%7%s%W%k$J;EMM$N$^$^$,$$$$$HH=CG$7$?!#(B</p>
385
+ <h2><a name="9" href="#9">9</a> <a name="label:30">$B%i%$%;%s%9(B</a></h2><!-- RDLabel: "$B%i%$%;%s%9(B" -->
379
386
 
380
387
  <p>Ruby's$B$H$7$^$9!#(B</p>
381
388
 
@@ -5,6 +5,10 @@
5
5
 
6
6
  ##### [whats new]
7
7
  == ��������
8
+ === [2009/01/25] 1.0.3 released
9
+ * HTML���ϻ��Υ����������ȥ�����ץƥ����ȼ���������
10
+ * Ruby 1.9���
11
+
8
12
  === [2006/09/20] 1.0.2 released
9
13
  * ���ԥ����ɤ�DOS, MAC���Ȥ��ޤ�ư��ʤ��Х�������
10
14
 
@@ -49,17 +53,17 @@ parser
49
53
  == ���󥹥ȡ���
50
54
  �ʲ��Υ��ޥ�ɤ�¹ԡ�
51
55
 
52
- ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz").read.display' > rttool-1.0.2.tar.gz
53
- tar xzvf rttool-1.0.2.tar.gz
56
+ ruby -ropen-uri -e 'URI("http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz").read.display' > rttool-1.0.3.tar.gz
57
+ tar xzvf rttool-1.0.3.tar.gz
54
58
 
55
59
 
56
60
  ���Ԥ�����ϼ��Υ�󥯤������������ɡ�
57
61
 
58
- * ((<rttool-1.0.2.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/rttool-1.0.2.tar.gz>))
62
+ * ((<rttool-1.0.3.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz>))
59
63
 
60
64
  ���줫�鼡�Υ��ޥ�ɤǥ��󥹥ȡ��롣
61
65
 
62
- cd rttool-1.0.2
66
+ cd rttool-1.0.3
63
67
  ruby setup.rb config
64
68
  ruby setup.rb setup
65
69
  ruby setup.rb install
@@ -309,7 +313,7 @@ begin
309
313
  * ��ʬ�˹�ä�ɽ�����ġ��뤬�ۤ�����
310
314
 
311
315
  == TODO
312
- ��6ǯ�����������ʤ��Ȥ�ͤ��Ƥ��������ߤΥ���ץ�ʻ��ͤΤޤޤ�������Ƚ�Ǥ�����
316
+ ��9ǯ�����������ʤ��Ȥ�ͤ��Ƥ��������ߤΥ���ץ�ʻ��ͤΤޤޤ�������Ƚ�Ǥ�����
313
317
 
314
318
  == �饤����
315
319
  Ruby's�Ȥ��ޤ���
@@ -180,6 +180,8 @@ module Untar
180
180
  "unrar %s"
181
181
  when /\.sit$/i
182
182
  "ln -s %s tmp.sit; unstuff tmp.sit"
183
+ when /\.7z$/i
184
+ "7za e #{f}"
183
185
  else
184
186
  nil
185
187
  end
@@ -311,7 +313,7 @@ class AssertFile
311
313
 
312
314
  def self.transaction(*args, &block)
313
315
  if block_given?
314
- testcase = eval("self", block)
316
+ testcase = eval("self", block.binding)
315
317
  assert_files = args.map{|x| new(x) }
316
318
 
317
319
  if @@basedir
@@ -542,7 +544,7 @@ def system_to_string(*args)
542
544
  ret = nil
543
545
  open(tmpf,"w") do |f|
544
546
  IO.redirect(f) {
545
- system *args
547
+ system(*args)
546
548
  }
547
549
  end
548
550
  File.read(tmpf)
@@ -610,7 +612,7 @@ end
610
612
  #### ext
611
613
  class String
612
614
  # Returns a string which is replaced the filename's extension with NEWEXT.
613
- def ext(newext=nil)
615
+ def my_ext(newext=nil)
614
616
  if newext
615
617
  newext[0,1] != '.' and newext="."+newext
616
618
  sub(/\.[^\.]+?$/, newext)
@@ -670,7 +672,7 @@ class StructWithType < Struct
670
672
  end
671
673
  end
672
674
 
673
- super *args
675
+ super(*args)
674
676
  end
675
677
 
676
678
  def __convert__(k,v)
@@ -875,7 +877,7 @@ end
875
877
  # mswin32 ruby's `system' workaround.
876
878
  def system_safe(*x)
877
879
  begin
878
- system *x
880
+ system(*x)
879
881
  rescue
880
882
  end
881
883
  end
@@ -890,7 +892,7 @@ end
890
892
 
891
893
  class Proc
892
894
  def unproc(*x)
893
- call *x
895
+ call(*x)
894
896
  end
895
897
  end
896
898
 
@@ -917,7 +919,7 @@ class ConfigScript
917
919
 
918
920
  s_class.class_eval do
919
921
  define_method(k) {arg[k].unproc}
920
- define_method("#{k}=") {|v| arg[k]=v}
922
+ define_method("#{k}=") {|vv| arg[k]=vv}
921
923
  end
922
924
  end
923
925
  @hash = arg
@@ -977,6 +979,7 @@ module URLConv
977
979
  next
978
980
  end
979
981
  end
982
+ html
980
983
  end
981
984
  end
982
985
 
@@ -2,6 +2,19 @@ require 'rt/rt2html-lib'
2
2
  require 'test/unit'
3
3
 
4
4
  include RT
5
+ module Utils
6
+ def uncomment(str)
7
+ rep = "\001"
8
+ #if str =~ /\A<!--\s+.+?\s+-->\n(.+)<!--\s+.+?\s+-->\n\n\Z/p# POSIX
9
+ if str.gsub(/\n/, rep) =~ /\A<!--\s+.+?\s+-->#{rep}(.+)<!--\s+.+?\s+-->#{rep}#{rep}\Z/
10
+ #$1
11
+ $1.gsub(/#{rep}/, "\n")
12
+ else
13
+ assert_fail("not RTBlock format")
14
+ end
15
+ end
16
+ end
17
+
5
18
  class RT2HTMLVisitorTest < Test::Unit::TestCase
6
19
  def setup
7
20
  @x = RT2HTMLVisitor::new
@@ -15,17 +28,7 @@ class RT2HTMLVisitorTest < Test::Unit::TestCase
15
28
  y , 0.4 , 0.5, 0.3, 0.1
16
29
  END
17
30
  end
18
-
19
- def uncomment(str)
20
- rep = "\001"
21
- #if str =~ /\A<!--\s+.+?\s+-->\n(.+)<!--\s+.+?\s+-->\n\n\Z/p# POSIX
22
- if str.gsub(/\n/, rep) =~ /\A<!--\s+.+?\s+-->#{rep}(.+)<!--\s+.+?\s+-->#{rep}#{rep}\Z/
23
- #$1
24
- $1.gsub(/#{rep}/, "\n")
25
- else
26
- assert_fail("not RTBlock format")
27
- end
28
- end
31
+ include Utils
29
32
 
30
33
  def test_setup
31
34
  lines =
@@ -62,4 +65,40 @@ class RT2HTMLVisitorTest < Test::Unit::TestCase
62
65
 
63
66
  end
64
67
 
68
+ class RT2HTMLXSSTest < Test::Unit::TestCase
69
+ def setup
70
+ @x = RT2HTMLVisitor::new
71
+ @x.visit(RTParser::parse(<<-END))
72
+ caption = <b>XSS Test</b>
73
+
74
+ <b>Test</b>, ==
75
+
76
+ <b>1.0</b> , <b>a</b>
77
+ END
78
+ end
79
+ include Utils
80
+
81
+ def test_setup
82
+ lines =
83
+ %Q[<table border="1">\n] +
84
+ %Q[<caption>&lt;b&gt;XSS Test&lt;/b&gt;</caption>\n]
85
+ assert_equal(lines, uncomment(@x.setup))
86
+ end
87
+
88
+ def test_visit_Header
89
+ lines =
90
+ %Q[<thead>\n] +
91
+ %Q[<tr><th colspan="2">&lt;b&gt;Test&lt;/b&gt;</th></tr>\n] +
92
+ %Q[</thead>\n]
93
+ assert_equal(lines, uncomment(@x.visit_Header))
94
+ end
95
+
96
+ def test_visit_Body
97
+ lines =
98
+ %Q[<tbody>\n] +
99
+ %Q[<tr><td align="left">&lt;b&gt;1.0&lt;/b&gt;</td><td align="left">&lt;b&gt;a&lt;/b&gt;</td></tr>\n] +
100
+ %Q[</tbody>\n]
101
+ assert_equal(lines, uncomment(@x.visit_Body))
102
+ end
103
+ end
65
104
 
@@ -25,18 +25,10 @@ end
25
25
 
26
26
 
27
27
  module CellShortcut
28
- def c(x)
29
- RTCell::new(x,:center)
30
- end
31
-
32
- def l(x)
33
- RTCell::new(x, :left)
34
- end
35
-
36
- def r(x)
37
- RTCell::new(x, :right)
38
- end
39
- private :c, :l, :r
28
+ private
29
+ def c(x) RTCell::new(x,:center) end
30
+ def l(x) RTCell::new(x, :left) end
31
+ def r(x) RTCell::new(x, :right) end
40
32
  end
41
33
 
42
34
  class RTParserTest < Test::Unit::TestCase
@@ -127,17 +119,9 @@ class RTParseTest < Test::Unit::TestCase
127
119
  include CellShortcut
128
120
  module CRLF
129
121
  include NKF
130
- def to_unix(str)
131
- nkf("-Lu", str)
132
- end
133
-
134
- def to_dos(str)
135
- nkf("-Lw", str)
136
- end
137
-
138
- def to_mac(str)
139
- nkf("-Lm", str)
140
- end
122
+ def to_unix(str) nkf("-eLu", str) end
123
+ def to_dos(str) nkf("-eLw", str) end
124
+ def to_mac(str) nkf("-eLm", str) end
141
125
  end
142
126
 
143
127
  def setup
@@ -1,87 +1,54 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'pathname'
2
3
  require 'test/unit'
3
- require 'rttool-sub'
4
-
5
- module Chdir
6
- def pushd
7
- @pwd = Dir.pwd
8
- Dir.chdir File.dirname(File.expand_path(__FILE__))
9
- end
10
-
11
- def popd
12
- Dir.chdir @pwd
13
- end
14
- def setup
15
- pushd
16
- end
17
- end
18
-
19
4
  class TestRTtool < Test::Unit::TestCase
20
5
  =begin eev
21
6
  = How to make test files
22
7
   (eecd2)
23
- cd ../examples/; rt2 -r rt/rt2html-lib test1.rt > test1.html
24
- cd ../examples/; rt2 -r rt/rt2html-lib test2.rt > test2.html
25
- cd ../examples/; rt2 -r rt/rt2html-lib escape.rt > escape.html
26
- cd ../examples/; rd2 --with-part=RT:rt rttest.rd > rttest.html
8
+ cd ..; rt2 -r rt/rt2html-lib examples/test1.rt > examples/test1.html
9
+ cd ..; rt2 -r rt/rt2html-lib examples/test2.rt > examples/test2.html
10
+ cd ..; rt2 -r rt/rt2html-lib examples/escape.rt > examples/escape.html
11
+ cd ..; rd2 --with-part=RT:rt examples/rttest.rd > examples/rttest.html
27
12
  =end
28
- include Chdir
29
- def teardown
30
- rt2html
31
- popd
32
- end
33
-
34
- def rt2html
35
- @html = "#{@name}.html"
36
- @rt = "#{@name}.rt"
37
- AssertFile.basedir = "../examples"
38
- AssertFile.transaction(@html) do |html|
39
- system_safe "cd ../examples; ruby -I../lib ../bin/rt/rt2 -r rt/rt2html-lib #{@rt} > #{html}"
13
+ def rt2html(name)
14
+ Dir.chdir(Pathname.new(__FILE__).dirname.parent) do
15
+ @html = "examples/#{name}.html"
16
+ @rt = "examples/#{name}.rt"
17
+ assert_equal File.read(@html), `ruby -Itest -Ilib bin/rt/rt2 -r rt/rt2html-lib #{@rt}`
40
18
  end
41
19
  end
42
20
 
43
- #
44
21
  def test__test1
45
22
  # (find-filez "test1.rt test1.html" "../examples/")
46
- @name = "test1"
23
+ rt2html "test1"
47
24
  end
48
- #
49
25
 
50
26
  def test__test2
51
27
  # (find-filez "test2.rt test2.html" "../examples/")
52
- @name = "test2"
28
+ rt2html "test2"
53
29
  end
54
30
 
55
31
  def test__escape
56
32
  # (find-filez "escape.rt escape.html" "../examples/")
57
- @name = "escape"
33
+ rt2html "escape"
58
34
  end
59
35
 
60
36
  end
61
37
 
62
38
 
63
39
  class TestRDRT2 < Test::Unit::TestCase
64
-
65
- include Chdir
66
-
67
- def teardown
68
- rdrt2
69
- popd
70
- end
71
-
72
- def rdrt2
40
+ def rdrt2(name)
73
41
  ENV['RUBYLIB'] = "../lib"
74
- @html = "#{@name}.html"
75
- @rd = "#{@name}.rd"
76
- AssertFile.basedir = "../examples"
77
- AssertFile.transaction(@html) do |html|
78
- system_safe "cd ../examples; ruby ../bin/rt/rdrt2 #{@rd} > #{html}"
42
+ @html = "examples/#{name}.html"
43
+ @rd = "examples/#{name}.rd"
44
+ Dir.chdir(Pathname.new(__FILE__).dirname.parent) do
45
+ assert_equal File.read(@html), `ruby -Ilib bin/rt/rdrt2 #{@rd}`
79
46
  end
80
47
  end
81
48
 
82
49
  def test_rttest
83
50
  # (find-filez "rttest.rd rttest.html" "../examples/")
84
- @name = "rttest"
51
+ rdrt2 "rttest"
85
52
  end
86
53
 
87
54
 
metadata CHANGED
@@ -1,39 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: rttool
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.0.2.0
7
- date: 2007-02-21 00:00:00 +09:00
8
- summary: Simple table generator
9
- require_paths:
10
- - lib
11
- email: zn@mbf.nifty.com
12
- homepage: http://raa.ruby-lang.org/project/rttool/
13
- rubyforge_project: rwiki
14
- description:
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.0.3.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - rubikitch
31
8
  - Kazuhiro NISHIYAMA
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-01-28 00:00:00 +09:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description:
18
+ email: zn@mbf.nifty.com
19
+ executables:
20
+ - rdrt2
21
+ - rt2
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
32
26
  files:
33
27
  - ChangeLog
34
28
  - GPL
29
+ - bin/rdrt2
35
30
  - bin/rt/rdrt2
36
31
  - bin/rt/rt2
32
+ - bin/rt2
37
33
  - examples/easiest.html
38
34
  - examples/easiest.rt
39
35
  - examples/escape.html
@@ -58,18 +54,31 @@ files:
58
54
  - test/test-rt2html-lib.rb
59
55
  - test/test-rtparser.rb
60
56
  - test/test.rb
61
- test_files: []
62
-
57
+ has_rdoc: false
58
+ homepage: http://raa.ruby-lang.org/project/rttool/
59
+ post_install_message:
63
60
  rdoc_options: []
64
61
 
65
- extra_rdoc_files: []
66
-
67
- executables:
68
- - rt/rdrt2
69
- - rt/rt2
70
- extensions: []
71
-
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ version:
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ version:
72
76
  requirements: []
73
77
 
74
- dependencies: []
78
+ rubyforge_project: rwiki
79
+ rubygems_version: 1.0.1
80
+ signing_key:
81
+ specification_version: 2
82
+ summary: Simple table generator
83
+ test_files: []
75
84