1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
=begin
= RTtool
##### [whats new]
== What's new
=== [2009/01/25] 1.0.3 released
* HTML XSS bug fix.
* RTtool works with Ruby 1.9 now.
=== [2006/09/20] 1.0.2 released
* Bugfix about linefeed.
=== [2005/10/28] 1.0.1 released
* RTtool does not use .rd2rc anymore.
=== [2005/10/26] 1.0.0 released
* Escape.
* English document.
* Removed Ruby-1.8 warning.
##### [/whats new]
##### [abstract]
== Abstract
RT is a simple and human-readable table format.
RTtool is a converter from RT into various formats.
RT can be incorporated into RD.
At this time, RTtool can convert RT into HTML and plain text.
To convert into plain text, you need ((<w3m|URL:http://w3m.sourceforge.net/>)).
##### [/abstract]
== Environment
##### [install]
== Install
Please execute the following commands.
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
tar xzvf rttool-1.0.3.tar.gz
When you failed, please download it from the next link.
* ((<rttool-1.0.3.tar.gz|URL:http://www.rubyist.net/~rubikitch/archive/rttool-1.0.3.tar.gz>))
Then, install it.
cd rttool-1.0.3
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
##### [/install]
== RT Syntax
* RT consists of three Blocks.
:ConfigBlock
ConfigBlock consist of groups of "attribute = value".
The following examples has (({caption})) attribute.
ConfigBlock can be omitted.
:HeaderBlock
A part of THEAD by HTML.
HeaderBlock sets a header of the table.
A header is located at the center.
HeaderBlock can be omitted.
:BodyBlock
A part of TBODY by HTML.
BodyBlock sets data of the table.
A number is located at the right and others are located at left.
* The default delimiter on HeaderBlock and BodyBlock is a comma or a Tab.
* It is not necessary to be always harmonious with an upper line.
* Arbitrary character can be a delimiter by changing (({delimiter})) attribute.
* (({==})) stretches the left column. (colspan)
* (({||})) stretches the upper row. (rowspan)
== Attributes
In ConfigBlock, these attributes can be set.
:caption
The caption of the table.
:delimiter
The delimiter of the table.
:rowspan
A string which stretches the left column. (defalut: (({==})))
:colspan
A string which stretches the upper row. (default: (({||})))
:escape
An escape character.
This attribute is disabled by default.
== Examples
=== The Easiest RT
$ cat examples/easiest.rt
1, 2, 3
4, 5, 6
7, 8, 9
$ rt2 examples/easiest.rt
1 2 3
4 5 6
7 8 9
$ rt2 -r rt/rt2html-lib examples/easiest.rt
<!-- setup -->
<table border="1">
<!-- setup end -->
<!-- Header -->
<!-- Header end -->
<!-- Body -->
<tbody>
<tr><td align="right">1</td><td align="right">2</td><td align="right">3</td></tr>
<tr><td align="right">4</td><td align="right">5</td><td align="right">6</td></tr>
<tr><td align="right">7</td><td align="right">8</td><td align="right">9</td></tr>
</tbody>
<!-- Body end -->
<!-- teardown -->
</table>
<!-- teardown end -->
=== Use the Escape Attribute
$ cat examples/escape.rt
delimiter = ;
escape = \
\z ; \;1 ; 2
$ rt2 examples/escape.rt
\z;1 2
$ rt2 -r rt/rt2html-lib examples/escape.rt
<!-- setup -->
<table border="1">
<!-- setup end -->
<!-- Header -->
<!-- Header end -->
<!-- Body -->
<tbody>
<tr><td align="left">\z</td><td align="left">;1</td><td align="right">2</td></tr>
</tbody>
<!-- Body end -->
<!-- teardown -->
</table>
<!-- teardown end -->
=== More Complex RT
$ cat examples/test1.rt
caption = Test Table
, Human, == , Dog , ==
|| , M , F ,M,F
x , 1.0 , 2.0, 1.1, 1.2
y , 0.4 , 0.5, 0.3, 0.1
$ rt2 examples/test1.rt
Test Table
Human Dog
M F M F
x 1.0 2.0 1.1 1.2
y 0.4 0.5 0.3 0.1
$ rt2 -r rt/rt2html-lib examples/test1.rt
<!-- setup -->
<table border="1">
<caption>Test Table</caption>
<!-- setup end -->
<!-- Header -->
<thead>
<tr><th rowspan="2"></th><th colspan="2">Human</th><th colspan="2">Dog</th></tr>
<tr><th>M</th><th>F</th><th>M</th><th>F</th></tr>
</thead>
<!-- Header end -->
<!-- Body -->
<tbody>
<tr><td align="left">x</td><td align="right">1.0</td><td align="right">2.0</td><td align="right">1.1</td><td align="right">1.2</td></tr>
<tr><td align="left">y</td><td align="right">0.4</td><td align="right">0.5</td><td align="right">0.3</td><td align="right">0.1</td></tr>
</tbody>
<!-- Body end -->
<!-- teardown -->
</table>
<!-- teardown end -->
=== RT Included by RD (RD/RT)
$ cat examples/rttest.rd
=begin
= Sample RD/RT
This RD contains a table.
It is so-called RD/RT.
=end
=begin RT
caption = Test Table
, Human, == , Dog , ==
|| , M , F ,M,F
x , 1.0 , 2.0, 1.1, 1.2
y , 0.4 , 0.5, 0.3, 0.1
=end
=begin
It is simple.
=end
$ rdrt2 examples/rttest.rd | w3m -dump -T text/html
= Sample RD/RT
This RD contains a table. It is so-called RD/RT.
Test Table
Human Dog
M F M F
x 1.0 2.0 1.1 1.2
y 0.4 0.5 0.3 0.1
It is simple.
== License
Ruby's
=end
|