| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title>"Html2Wml Documentation"</title> |
| 4 |
<link rel="stylesheet" href="style.css" type="text/css"> |
| 5 |
<link rev="made" href="mailto:[email protected]"> |
| 6 |
</head> |
| 7 |
|
| 8 |
<body> |
| 9 |
|
| 10 |
<a name="__index__"></a> |
| 11 |
|
| 12 |
|
| 13 |
<ul id="index"><b>Table of contents</b> |
| 14 |
|
| 15 |
<li><a href="#name">NAME</a></li> |
| 16 |
<li><a href="#synopsis">SYNOPSIS</a></li> |
| 17 |
<li><a href="#description">DESCRIPTION</a></li> |
| 18 |
<li><a href="#options">OPTIONS</a></li> |
| 19 |
<ul> |
| 20 |
|
| 21 |
<li><a href="#conversion options">Conversion Options</a></li> |
| 22 |
<li><a href="#links reconstruction options">Links Reconstruction Options</a></li> |
| 23 |
<li><a href="#splitting options">Splitting Options</a></li> |
| 24 |
<li><a href="#http authentication">HTTP Authentication</a></li> |
| 25 |
<li><a href="#proxy support">Proxy Support</a></li> |
| 26 |
<li><a href="#output options">Output Options</a></li> |
| 27 |
<li><a href="#debugging options">Debugging Options</a></li> |
| 28 |
</ul> |
| 29 |
|
| 30 |
<li><a href="#deck slicing">DECK SLICING</a></li> |
| 31 |
<ul> |
| 32 |
|
| 33 |
<li><a href="#slice by cards or by decks">Slice by cards or by decks</a></li> |
| 34 |
<li><a href="#note on size calculation">Note on size calculation</a></li> |
| 35 |
<li><a href="#why compiling the wml deck">Why compiling the WML deck?</a></li> |
| 36 |
</ul> |
| 37 |
|
| 38 |
<li><a href="#actions">ACTIONS</a></li> |
| 39 |
<ul> |
| 40 |
|
| 41 |
<li><a href="#syntax">Syntax</a></li> |
| 42 |
<li><a href="#available actions">Available actions</a></li> |
| 43 |
<li><a href="#generic parameters">Generic parameters</a></li> |
| 44 |
<li><a href="#examples">Examples</a></li> |
| 45 |
</ul> |
| 46 |
|
| 47 |
<li><a href="#links reconstruction">LINKS RECONSTRUCTION</a></li> |
| 48 |
<ul> |
| 49 |
|
| 50 |
<li><a href="#templates">Templates</a></li> |
| 51 |
<li><a href="#syntax">Syntax</a></li> |
| 52 |
<li><a href="#available parameters">Available parameters</a></li> |
| 53 |
<li><a href="#examples">Examples</a></li> |
| 54 |
</ul> |
| 55 |
|
| 56 |
<li><a href="#proxy support">PROXY SUPPORT</a></li> |
| 57 |
<li><a href="#caveats">CAVEATS</a></li> |
| 58 |
<li><a href="#links">LINKS</a></li> |
| 59 |
<ul> |
| 60 |
|
| 61 |
<li><a href="#download">Download</a></li> |
| 62 |
<li><a href="#resources">Resources</a></li> |
| 63 |
<li><a href="#programmers utilities">Programmers utilities</a></li> |
| 64 |
<li><a href="#wml browsers and wap emulators">WML browsers and Wap emulators</a></li> |
| 65 |
</ul> |
| 66 |
|
| 67 |
<li><a href="#acknowledgements">ACKNOWLEDGEMENTS</a></li> |
| 68 |
<li><a href="#author">AUTHOR</a></li> |
| 69 |
<li><a href="#copyright">COPYRIGHT</a></li> |
| 70 |
</ul> |
| 71 |
|
| 72 |
|
| 73 |
<HR> |
| 74 |
<p> |
| 75 |
<h1><a name="name">NAME</a></h1> |
| 76 |
<p>Html2Wml -- Program that can convert HTML pages to WML pages</p> |
| 77 |
<p> |
| 78 |
<hr> |
| 79 |
<h1><a name="synopsis">SYNOPSIS</a></h1> |
| 80 |
<p>Html2Wml can be used as either a shell command:</p> |
| 81 |
<pre> |
| 82 |
$ html2wml file.html</pre> |
| 83 |
<p>or as a CGI:</p> |
| 84 |
<pre> |
| 85 |
/cgi-bin/html2wml.cgi?url=/index.html</pre> |
| 86 |
<p>In both cases, the file can be either a local file or a URL.</p> |
| 87 |
<p> |
| 88 |
<hr> |
| 89 |
<h1><a name="description">DESCRIPTION</a></h1> |
| 90 |
<p>Html2Wml converts HTML pages to WML decks, suitable for being viewed on a |
| 91 |
Wap device. The program can be launched from a shell to statically convert |
| 92 |
a set of pages, or as a CGI to convert a particular (potentially dynamic) |
| 93 |
HTML resource.</p> |
| 94 |
<p>Althought the result is not guarantied to be valid WML, it should be the |
| 95 |
case for most pages. Good HTML pages will most probably produce valid |
| 96 |
WML decks. To check and correct your pages, you can use W3C's softwares: |
| 97 |
the <em>HTML Validator</em>, available online at <a href="http://validator.w3.org">http://validator.w3.org</a> |
| 98 |
and <em>HTML Tidy</em>, written by Dave Raggett.</p> |
| 99 |
<p>Html2Wml provides the following features:</p> |
| 100 |
<UL> |
| 101 |
<li> |
| 102 |
translation of the links |
| 103 |
<p></p> |
| 104 |
<li> |
| 105 |
limitation of the cards size by splitting the result into several cards |
| 106 |
<p></p> |
| 107 |
<li> |
| 108 |
inclusion of files (similar to the SSI) |
| 109 |
<p></p> |
| 110 |
<li> |
| 111 |
compilation of the result (using the WML Tools, see <a href="#links">LINKS</a>) |
| 112 |
<p></p> |
| 113 |
<li> |
| 114 |
a debug mode to check the result using validation functions |
| 115 |
<p></p></UL> |
| 116 |
<p> |
| 117 |
<hr> |
| 118 |
<h1><a name="options">OPTIONS</a></h1> |
| 119 |
<p>Please note that most of these options are also available when calling |
| 120 |
Html2Wml as a CGI. In this case, boolean options are given the value |
| 121 |
``1'' or ``0'', and other options simply receive the value they |
| 122 |
expect. For example, <code>--ascii</code> becomes <code>?ascii=1</code> or <code>?a=1</code>. See the |
| 123 |
file <em>t/form.html</em> for an example on how to call Html2Wml as a CGI.</p> |
| 124 |
<p> |
| 125 |
<h2><a name="conversion options">Conversion Options</a></h2> |
| 126 |
<DL> |
| 127 |
<dt><strong><a name="item_%2Da%2C_%2D%2Dascii">-a, --ascii</a></strong><br> |
| 128 |
<dd> |
| 129 |
When this option is on, named HTML entities and non-ASCII characters are |
| 130 |
converted to US-ASCII characters using the same 7 bit approximations as |
| 131 |
Lynx. For example, <code>&copy;</code> is translated to ``(c)'', and <code>&szlig;</code> is |
| 132 |
translated to ``ss''. This option is off by default. |
| 133 |
<p></p> |
| 134 |
<dt><strong><a name="item_%2D%2D%5Bno%5Dcollapse">--[no]collapse</a></strong><br> |
| 135 |
<dd> |
| 136 |
This option tells Html2Wml to collapse redundant whitespaces, |
| 137 |
tabulations, carriage returns, lines feeds and empty paragraphs. The aim |
| 138 |
is to reduce the size of the WML document as much as possible. Collapsing |
| 139 |
empty paragraphs is necessary for two reasons. First, this avoids empty |
| 140 |
screens (and on a device with only 4 lines of display, an empty screen can |
| 141 |
be quite ennoying). Second, Html2wml creates many empty paragraphs when |
| 142 |
converting, because of the way the syntax reconstructor is programmed. |
| 143 |
Deleting these empty paragraphs is necessary like cleaning the kitchen :-) |
| 144 |
<p>If this really bother you, you can desactivate this behaviour with the |
| 145 |
<strong>--nocollapse</strong> option.</p> |
| 146 |
<p></p> |
| 147 |
<dt><strong><a name="item_%2D%2Dignore%2Dimages">--ignore-images</a></strong><br> |
| 148 |
<dd> |
| 149 |
This option tells Html2Wml to completly ignore all image links. |
| 150 |
<p></p> |
| 151 |
<dt><strong><a name="item_%2D%2D%5Bno%5Dimg%2Dalt%2Dtext">--[no]img-alt-text</a></strong><br> |
| 152 |
<dd> |
| 153 |
This option tells Html2Wml to replace the image tags with their |
| 154 |
corresponding alternative text (as with a text mode web browser). |
| 155 |
This option is on by default. |
| 156 |
<p></p> |
| 157 |
<dt><strong><a name="item_%2D%2D%5Bno%5Dlinearize">--[no]linearize</a></strong><br> |
| 158 |
<dd> |
| 159 |
This option is on by default. This makes Html2Wml flattens the HTML |
| 160 |
tables (they are linearized), as Lynx does. I think this is better than |
| 161 |
trying to use the native WML tables. First, they have extremely limited |
| 162 |
features and possibilities compared to HTML tables. In particular, they |
| 163 |
can't be nested. In fact this is normal because Wap devices are not |
| 164 |
supposed to have a big CPU running at some zillions-hertz, and the |
| 165 |
calculations needed to render the tables are the most complicated and |
| 166 |
CPU-hogger part of HTML. |
| 167 |
<p>Second, as they can't be nested, and as typical HTML pages heavily use |
| 168 |
imbricated tables to create their layout, it's impossible to decide which |
| 169 |
one could be kept. So the best thing is to keep none of them.</p> |
| 170 |
<p><strong>[Note]</strong> Although you can desactivate this behaviour, and although |
| 171 |
there is internal support for tables, the unlinearized mode has not |
| 172 |
been heavily tested with nested tables, and it may produce unexpected |
| 173 |
results.</p> |
| 174 |
<p></p> |
| 175 |
<dt><strong><a name="item_%2Dn%2C_%2D%2Dnumeric%2Dnon%2Dascii">-n, --numeric-non-ascii</a></strong><br> |
| 176 |
<dd> |
| 177 |
This option tells Html2wml to convert all non-ASCII characters to |
| 178 |
numeric entities, i.e., ``é'' becomes <code>&#233;</code>, and ``ß'' |
| 179 |
becomes <code>&#223;</code>. By default, this option is off. |
| 180 |
<p></p> |
| 181 |
<dt><strong><a name="item_%2Dp%2C_%2D%2Dnopre">-p, --nopre</a></strong><br> |
| 182 |
<dd> |
| 183 |
This options tells Html2Wml not to use the <pre> |
| 184 |
tag. This option was added because the compiler from WML Tools 0.0.4 |
| 185 |
doesn't support this tag. |
| 186 |
<p></p></DL> |
| 187 |
<p> |
| 188 |
<h2><a name="links reconstruction options">Links Reconstruction Options</a></h2> |
| 189 |
<DL> |
| 190 |
<dt><strong><a name="item_%2D%2Dhreftmpl%3DTEMPLATE">--hreftmpl=<em>TEMPLATE</em></a></strong><br> |
| 191 |
<dd> |
| 192 |
This options sets the template that will be used to reconstruct the |
| 193 |
<code>href</code>-type links. See <a href="#links reconstruction">LINKS RECONSTRUCTION</a> for more information. |
| 194 |
<p></p> |
| 195 |
<dt><strong><a name="item_%2D%2Dsrctmpl%3DTEMPLATE">--srctmpl=<em>TEMPLATE</em></a></strong><br> |
| 196 |
<dd> |
| 197 |
This option sets the template that will be used to reconstruct the |
| 198 |
<code>src</code>-type links. See <a href="#links reconstruction">LINKS RECONSTRUCTION</a> for more information. |
| 199 |
<p></p></DL> |
| 200 |
<p> |
| 201 |
<h2><a name="splitting options">Splitting Options</a></h2> |
| 202 |
<DL> |
| 203 |
<dt><strong><a name="item_%2Ds%2C_%2D%2Dmax%2Dcard%2Dsize%3DSIZE">-s, --max-card-size=<em>SIZE</em></a></strong><br> |
| 204 |
<dd> |
| 205 |
This option allows you to limit the size (in bytes) of the generated |
| 206 |
cards. Default is 1,500 bytes, which should be small enought to be loaded |
| 207 |
on most Wap devices. See <a href="#deck slicing">DECK SLICING</a> for more information. |
| 208 |
<p></p> |
| 209 |
<dt><strong><a name="item_%2Dt%2C_%2D%2Dcard%2Dsplit%2Dthreshold%3DSIZE">-t, --card-split-threshold=<em>SIZE</em></a></strong><br> |
| 210 |
<dd> |
| 211 |
This option sets the threshold of the split event, which can occur |
| 212 |
when the size of the current card is between <code>max-card-size</code> - |
| 213 |
<code>card-split-threshold</code> and <code>max-card-size</code>. Default value is |
| 214 |
50. See <a href="#deck slicing">DECK SLICING</a> for more information. |
| 215 |
<p></p> |
| 216 |
<dt><strong><a name="item_%2D%2Dnext%2Dcard%2Dlabel%3DSTRING">--next-card-label=<em>STRING</em></a></strong><br> |
| 217 |
<dd> |
| 218 |
This options sets the label of the link that points to the next card. |
| 219 |
Default is ``[&gt;&gt;]'', which whill be rendered as ``[>>]''. |
| 220 |
<p></p> |
| 221 |
<dt><strong><a name="item_%2D%2Dprev%2Dcard%2Dlabel%3DSTRING">--prev-card-label=<em>STRING</em></a></strong><br> |
| 222 |
<dd> |
| 223 |
This options sets the label of the link that points to the previous card. |
| 224 |
Default is ``[&lt;&lt;]'', which whill be rendered as ``[<<]''. |
| 225 |
<p></p></DL> |
| 226 |
<p> |
| 227 |
<h2><a name="http authentication">HTTP Authentication</a></h2> |
| 228 |
<DL> |
| 229 |
<dt><strong><a name="item_%2DU%2C_%2D%2Dhttp%2Duser%3DUSERNAME">-U, --http-user=<em>USERNAME</em></a></strong><br> |
| 230 |
<dd> |
| 231 |
Use this option to set the username for an authenticated request. |
| 232 |
<p></p> |
| 233 |
<dt><strong><a name="item_%2DP%2C_%2D%2Dhttp%2Dpasswd%3DPASSWORD">-P, --http-passwd=<em>PASSWORD</em></a></strong><br> |
| 234 |
<dd> |
| 235 |
Use this option to set the password for an authenticated request. |
| 236 |
<p></p></DL> |
| 237 |
<p> |
| 238 |
<h2><a name="proxy support">Proxy Support</a></h2> |
| 239 |
<DL> |
| 240 |
<dt><strong><a name="item_%2D%5Bno%5DY%2C_%2D%2D%5Bno%5Dproxy">-[no]Y, --[no]proxy</a></strong><br> |
| 241 |
<dd> |
| 242 |
Use this option to activate proxy support. By default, proxy support |
| 243 |
is activated. See <a href="#proxy support">PROXY SUPPORT</a>. |
| 244 |
<p></p></DL> |
| 245 |
<p> |
| 246 |
<h2><a name="output options">Output Options</a></h2> |
| 247 |
<DL> |
| 248 |
<dt><strong><a name="item_%2Dk%2C_%2D%2Dcompile">-k, --compile</a></strong><br> |
| 249 |
<dd> |
| 250 |
Setting this option tells Html2Wml to use the compiler from WML Tools |
| 251 |
to compile the WML deck. If you want to create a real Wap site, you should |
| 252 |
seriously use this option in order to reduce the size of the WML decks. |
| 253 |
Remember that Wap devices have very little amount of memory. If this is |
| 254 |
not enought, use the splitting options. |
| 255 |
<p>Take a look in <em>wml_compilation/</em> for more information on how to use |
| 256 |
a WML compiler with Html2Wml.</p> |
| 257 |
<p></p> |
| 258 |
<dt><strong><a name="item_%2Do%2C_%2D%2Doutput">-o, --output</a></strong><br> |
| 259 |
<dd> |
| 260 |
Use this option (in shell mode) to specify an output file. |
| 261 |
By default, Html2Wml prints the result to standard output. |
| 262 |
<p></p></DL> |
| 263 |
<p> |
| 264 |
<h2><a name="debugging options">Debugging Options</a></h2> |
| 265 |
<DL> |
| 266 |
<dt><strong><a name="item_%2Dd%2C_%2D%2Ddebug%5B%3DLEVEL%5D">-d, --debug[=<em>LEVEL</em>]</a></strong><br> |
| 267 |
<dd> |
| 268 |
This option activates the debug mode. This prints the output result |
| 269 |
with line numbering and with the result of the XML check. If the WML |
| 270 |
compiler was called, the result is also printed in hexadecimal an ascii |
| 271 |
forms. When called as a CGI, all of this is printed as HTML, so that can |
| 272 |
use any web browser for that purpose. |
| 273 |
<p></p> |
| 274 |
<dt><strong><a name="item_%2D%2Dxmlcheck">--xmlcheck</a></strong><br> |
| 275 |
<dd> |
| 276 |
When this option is on, it send the WML output to XML::Parser to check |
| 277 |
its well-formedness. |
| 278 |
<p></p></DL> |
| 279 |
<p> |
| 280 |
<hr> |
| 281 |
<h1><a name="deck slicing">DECK SLICING</a></h1> |
| 282 |
<p>The <em>deck slicing</em> is a feature that Html2Wml provides in order to |
| 283 |
match the low memory capabilities of most Wap devices. Many can't handle |
| 284 |
cards larger than 2,000 bytes, therefore the cards must be sufficiently |
| 285 |
small to be viewed by all Wap devices. To achieve this, you should compile |
| 286 |
your WML deck, which reduce the size of the deck by 50%, but even then your |
| 287 |
cards may be too big. This is where Html2Wml comes with the deck slicing |
| 288 |
feature. This allows you to limit the size of the cards, currently only |
| 289 |
<em>before</em> the compilation stage.</p> |
| 290 |
<p> |
| 291 |
<h2><a name="slice by cards or by decks">Slice by cards or by decks</a></h2> |
| 292 |
<p>On some Wap phones, slicing the deck is not sufficient: the WML browser |
| 293 |
still tries to download the whole deck instead of just picking one |
| 294 |
card at a time. A solution is to slice the WML document by decks. |
| 295 |
See the figure below.</p> |
| 296 |
<pre> |
| 297 |
_____________ _____________ |
| 298 |
| deck | | deck #1 | |
| 299 |
| _________ | | _________ | |
| 300 |
| | card #1 | | | | card | | |
| 301 |
| |_________| | | |_________| | |
| 302 |
| _________ | |_____________| |
| 303 |
| | card #2 | | |
| 304 |
| |_________| | . . . |
| 305 |
| _________ | |
| 306 |
| | ... | | _____________ |
| 307 |
| |_________| | | deck #n | |
| 308 |
| _________ | | _________ | |
| 309 |
| | card #n | | | | card | | |
| 310 |
| |_________| | | |_________| | |
| 311 |
|_____________| |_____________| |
| 312 |
|
| 313 |
|
| 314 |
WML document WML document |
| 315 |
sliced by cards sliced by decks</pre> |
| 316 |
<p>What this means is that Html2Wml generates several WML documents. |
| 317 |
In CGI mode, only the appropriate deck is sent, selected by the id |
| 318 |
given in parameter. If no id was given, the first deck is sent.</p> |
| 319 |
<p> |
| 320 |
<h2><a name="note on size calculation">Note on size calculation</a></h2> |
| 321 |
<p>Currently, Html2Wml estimates the size of the card on the fly, by |
| 322 |
summing the length of the strings that compose the WML output, texts and |
| 323 |
tags. I say ``estimates'' and not ``calculates'' because computing the exact |
| 324 |
size would require many more calculations than the way it is done now. |
| 325 |
One may objects that there are only additions, which is correct, but knowing |
| 326 |
the <em>exact</em> size is not necessary. Indeed, if you compile the WML, most of |
| 327 |
the strings of the tags will be removed, but not all.</p> |
| 328 |
<p>For example, take an image tag: |
| 329 |
<code><img src="images/dog.jpg" alt="Photo of a dog"></code>. |
| 330 |
When compiled, the string <code>"img"</code> will be replaced by a one byte value. |
| 331 |
Same thing for the strings <code>"src"</code> and <code>"alt"</code>, and the spaces, double |
| 332 |
quotes and equal signs will be stripped. Only the text between double quote |
| 333 |
will be preserved... but not in every cases. |
| 334 |
Indeed, in order to go a step further, the compiler can also encode |
| 335 |
parts of the arguments as binary. For example, the string <code>"http://www."</code> |
| 336 |
can be encoded as a single byte (<code>8F</code> in this case). Or, if the attribute |
| 337 |
is <code>href</code>, the string <code>href="http://</code> can become the byte <code>4B</code>.</p> |
| 338 |
<p>As you see, it doesn't matter to know exactly the size of the textual |
| 339 |
form of the WML, as it will always be far superior to the size of the |
| 340 |
compiled form. That's why I don't count all the characters that may be |
| 341 |
actually written.</p> |
| 342 |
<p>Also, it's because I'm quite lazy ;-)</p> |
| 343 |
<p> |
| 344 |
<h2><a name="why compiling the wml deck">Why compiling the WML deck?</a></h2> |
| 345 |
<p>If you intent to create real WML pages, you should really |
| 346 |
consider to always compile them. If you're not convinced, here is an |
| 347 |
illustration.</p> |
| 348 |
<p>Take the following WML code snipet:</p> |
| 349 |
<pre> |
| 350 |
<a href='<a href="http://www.yahoo.com/">http://www.yahoo.com/</a>'>Yahoo!</a></pre> |
| 351 |
<p>It's the basic and classical way to code an hyperlink. It takes 42 bytes |
| 352 |
to code this, because it is presented in a human-readable form.</p> |
| 353 |
<p>The WAP Forum has defined a compact binary representation of WML in its |
| 354 |
specification, which is called ``compiled WML''. It's a binary format, |
| 355 |
therefore you, a mere human, can't read that, but your computer can. And |
| 356 |
it's much faster for it to read a binary format than to read a textual |
| 357 |
format.</p> |
| 358 |
<p>The previous example would be, once compiled (and printed here as |
| 359 |
hexadecimal):</p> |
| 360 |
<pre> |
| 361 |
1C 4A 8F 03 y a h o o 00 85 01 03 Y a h o o ! 00 01</pre> |
| 362 |
<p>This only takes 21 bytes. Half the size of the human-readable form. |
| 363 |
For a Wap device, this means both less to download, and easier things |
| 364 |
to read. Therefore the processing of the document can be achieved in |
| 365 |
a short time compared to the tectual version of the same document.</p> |
| 366 |
<p>There is a last argument, and not the less important: many Wap devices |
| 367 |
only read binary WML.</p> |
| 368 |
<p> |
| 369 |
<hr> |
| 370 |
<h1><a name="actions">ACTIONS</a></h1> |
| 371 |
<p>Actions are a feature similar to (but with far less functionalities!) the |
| 372 |
SSI (Server Side Includes) available on good servers like Apache. In order |
| 373 |
not to interfere with the real SSI, but to keep the syntax easy to learn, |
| 374 |
it differs in very few points.</p> |
| 375 |
<p> |
| 376 |
<h2><a name="syntax">Syntax</a></h2> |
| 377 |
<p>Basically, the syntax to execute an action is:</p> |
| 378 |
<pre> |
| 379 |
<!-- [action param1="value" param2='value'] --></pre> |
| 380 |
<p>Note that the angle brackets are part of the syntax. Except for that |
| 381 |
point, Actions syntax is very similar to SSI syntax.</p> |
| 382 |
<p> |
| 383 |
<h2><a name="available actions">Available actions</a></h2> |
| 384 |
<p>Only few actions are currently available, but more can be implemented |
| 385 |
on request.</p> |
| 386 |
<DL> |
| 387 |
<dt><strong><a name="item_include">include</a></strong><br> |
| 388 |
<dd> |
| 389 |
<DL> |
| 390 |
<dt><strong><a name="item_Description">Description</a></strong><br> |
| 391 |
<dd> |
| 392 |
Includes a file in the document at the current point. Please note |
| 393 |
that Html2Wml doesn't check nor parse the file, and if the file |
| 394 |
cannot be found, will silently die (this is the same behavior as SSI). |
| 395 |
<p></p> |
| 396 |
<dt><strong><a name="item_Parameters">Parameters</a></strong><br> |
| 397 |
<dd> |
| 398 |
<code>virtual=url</code> -- The file is get by http. |
| 399 |
<p><code>file=path</code> -- The file is read from the local disk.</p> |
| 400 |
<p></p></DL> |
| 401 |
<dt><strong><a name="item_fsize">fsize</a></strong><br> |
| 402 |
<dd> |
| 403 |
<DL> |
| 404 |
<dt><strong>Description</strong><br> |
| 405 |
<dd> |
| 406 |
Returns the size of a file at the current point of the document. |
| 407 |
<p></p> |
| 408 |
<dt><strong>Parameters</strong><br> |
| 409 |
<dd> |
| 410 |
<code>virtual=url</code> -- The file is get by http. |
| 411 |
<p><code>file=path</code> -- The file is read from the local disk.</p> |
| 412 |
<p></p> |
| 413 |
<dt><strong><a name="item_Notes">Notes</a></strong><br> |
| 414 |
<dd> |
| 415 |
If you use the file parameter, an absolute path is recommend. |
| 416 |
<p></p></DL> |
| 417 |
<dt><strong><a name="item_skip">skip</a></strong><br> |
| 418 |
<dd> |
| 419 |
<DL> |
| 420 |
<dt><strong>Description</strong><br> |
| 421 |
<dd> |
| 422 |
Skips everything until the first <code>end_skip</code> action. |
| 423 |
<p></p></DL> |
| 424 |
</DL> |
| 425 |
<p> |
| 426 |
<h2><a name="generic parameters">Generic parameters</a></h2> |
| 427 |
<p>The following parameters can be used for any action.</p> |
| 428 |
<DL> |
| 429 |
<dt><strong><a name="item_for%3Doutput_format">for=<em>output format</em></a></strong><br> |
| 430 |
<dd> |
| 431 |
This paramater restricts the action for the given output format. |
| 432 |
Currently, the only available format is ``<code>wml</code>'' (when using <code>html2chtml</code> |
| 433 |
the format is ``<code>chtml</code>''). |
| 434 |
<p></p></DL> |
| 435 |
<p> |
| 436 |
<h2><a name="examples">Examples</a></h2> |
| 437 |
<p>If you want to share a navigation bar between several WML pages, you can |
| 438 |
<a href="#item_include"><code>include</code></a> it this way:</p> |
| 439 |
<pre> |
| 440 |
<!-- [include virtual="nav.wml"] --></pre> |
| 441 |
<p>Of course, you have to write this navigation bar first :-)</p> |
| 442 |
<p>If you want to use your current HTML pages for creating your WML pages, |
| 443 |
but that they contains complex tables, or unecessary navigation tables, |
| 444 |
etc, you can simply <a href="#item_skip"><code>skip</code></a> the complex parts and keep the rest.</p> |
| 445 |
<pre> |
| 446 |
<body> |
| 447 |
<!--[skip for="wml"]--> |
| 448 |
unecessary parts for the WML pages |
| 449 |
<!--[end_skip]--> |
| 450 |
useful parts for the WML pages |
| 451 |
</body></pre> |
| 452 |
<p> |
| 453 |
<hr> |
| 454 |
<h1><a name="links reconstruction">LINKS RECONSTRUCTION</a></h1> |
| 455 |
<p>The links reconstruction engine is IMHO the most important part of |
| 456 |
Html2Wml, because it's this engine that allows you to reconstruct the |
| 457 |
links of the HTML document being converted. It has two modes, depending |
| 458 |
upon whether Html2Wml was launched from the shell or as a CGI.</p> |
| 459 |
<p>When used as a CGI, this engine will reconstructs the links of the HTML |
| 460 |
document so that all the urls will be passed to Html2Wml in order to |
| 461 |
convert the pointed files (pages or images). This is completly automatic |
| 462 |
and can't be customized for now (but I don't think it would be really |
| 463 |
useful).</p> |
| 464 |
<p>When used from the shell, this engine reconstructs the links with the |
| 465 |
given templates. Note that absolute URLs will be left untouched. The |
| 466 |
templates can be customized using the following syntax.</p> |
| 467 |
<p> |
| 468 |
<h2><a name="templates">Templates</a></h2> |
| 469 |
<DL> |
| 470 |
<dt><strong><a name="item_HREF_Template">HREF Template</a></strong><br> |
| 471 |
<dd> |
| 472 |
This template controls the reconstruction of the <code>href</code> attribute of |
| 473 |
the <code>A</code> tag. Its value can be changed using the <strong>--hreftmpl</strong> option. |
| 474 |
Default value is |
| 475 |
<code>"{FILEPATH}{FILENAME}{$FILETYPE =~ s/s?html?/wml/o; $FILETYPE}"</code>. |
| 476 |
<p></p> |
| 477 |
<dt><strong><a name="item_Image_Source_Template">Image Source Template</a></strong><br> |
| 478 |
<dd> |
| 479 |
This template controls the reconstruction of the <code>src</code> attribute of |
| 480 |
the <code>IMG</code> tag. Its value can be changed using the <strong>--srctmpl</strong> option. |
| 481 |
Default value is |
| 482 |
<code>"{FILEPATH}{FILENAME}{$FILETYPE =~ s/gif|png|jpe?g/wbmp/o; $FILETYPE}"</code> |
| 483 |
<p></p></DL> |
| 484 |
<p> |
| 485 |
<h2><a name="syntax">Syntax</a></h2> |
| 486 |
<p>The template is a string that contains the new URL. More precisely, it's |
| 487 |
a Text::Template template. Parameters can be interpolated as a constant |
| 488 |
or as a variable. The template is embraced between curcly bracets, and can |
| 489 |
contain any valid Perl code.</p> |
| 490 |
<p>The simplest form of a template is <code>{PARAM}</code> which just returns the |
| 491 |
value of PARAM. If you want to do something more complex, you can use |
| 492 |
the corresponding variable; for example <code>{"foo $PARAM bar"}</code>, or |
| 493 |
<code>{join "_", split " ", PARAM}</code>.</p> |
| 494 |
<p>You may read <a href="/Text/Template.html">the Text::Template manpage</a> for more information on what is possible |
| 495 |
within a template.</p> |
| 496 |
<p>If the original URL contained a query part or a fragment part, then they |
| 497 |
will be appended to the result of the template.</p> |
| 498 |
<p> |
| 499 |
<h2><a name="available parameters">Available parameters</a></h2> |
| 500 |
<DL> |
| 501 |
<dt><strong><a name="item_URL">URL</a></strong><br> |
| 502 |
<dd> |
| 503 |
This parameter contains the original URL from the <code>href</code> or <code>src</code> |
| 504 |
attribute. |
| 505 |
<p></p> |
| 506 |
<dt><strong><a name="item_FILENAME">FILENAME</a></strong><br> |
| 507 |
<dd> |
| 508 |
This parameter contains the base name of the file. |
| 509 |
<p></p> |
| 510 |
<dt><strong><a name="item_FILEPATH">FILEPATH</a></strong><br> |
| 511 |
<dd> |
| 512 |
This parameter contains the leading path of the file. |
| 513 |
<p></p> |
| 514 |
<dt><strong><a name="item_FILETYPE">FILETYPE</a></strong><br> |
| 515 |
<dd> |
| 516 |
This parameter contains the suffix of the file. |
| 517 |
<p></p></DL> |
| 518 |
<p>This can be resumed this way:</p> |
| 519 |
<pre> |
| 520 |
URL = <a href="http://www.server.net/path/to/my/page.html">http://www.server.net/path/to/my/page.html</a> |
| 521 |
------------^^^^ ---- |
| 522 |
| | \ |
| 523 |
| | \ |
| 524 |
FILEPATH FILENAME FILETYPE</pre> |
| 525 |
<p>Note that <a href="#item_FILETYPE"><code>FILETYPE</code></a> contains all the extensions of the file, so if its name |
| 526 |
is <em>index.html.fr</em> for example, <a href="#item_FILETYPE"><code>FILETYPE</code></a> contains ``<code>.html.fr</code>''.</p> |
| 527 |
<p> |
| 528 |
<h2><a name="examples">Examples</a></h2> |
| 529 |
<p>To add a path option:</p> |
| 530 |
<pre> |
| 531 |
{URL}$wap</pre> |
| 532 |
<p>Using Apache, you can then add a Rewrite directive so that URL ending with |
| 533 |
<code>$wap</code> will be redirected to Html2Wml:</p> |
| 534 |
<pre> |
| 535 |
RewriteRule ^(/.*)\$wap$ /cgi-bin/html2wml.cgi?url=$1</pre> |
| 536 |
<p>To change the extension of an image:</p> |
| 537 |
<pre> |
| 538 |
{FILEPATH}{FILENAME}.wbmp</pre> |
| 539 |
<p> |
| 540 |
<hr> |
| 541 |
<h1><a name="proxy support">PROXY SUPPORT</a></h1> |
| 542 |
<p>Html2Wml uses LWP built-in proxy support. It is activated by default, and |
| 543 |
loads the proxy settings from the environment variables, using the same |
| 544 |
variables as many others programs. Each protocol (http, ftp, etc) can be |
| 545 |
mapped to use a proxy server by setting a variable of the form <code>PROTOCOL_proxy</code>. |
| 546 |
Example: use <code>http_proxy</code> to define the proxy for http access, <code>ftp_proxy</code> |
| 547 |
for ftp access. In the shell, this is only a matter of defining the variable.</p> |
| 548 |
<p>For Bourne shell:</p> |
| 549 |
<pre> |
| 550 |
$ export http_proxy="<a href="http://proxy.domain.com:8080/"">http://proxy.domain.com:8080/"</a>;</pre> |
| 551 |
<p>For C-shell:</p> |
| 552 |
<pre> |
| 553 |
% setenv http_proxy "<a href="http://proxy.domain.com:8080/"">http://proxy.domain.com:8080/"</a>;</pre> |
| 554 |
<p>Under Apache, you can add this directive to your configuration file:</p> |
| 555 |
<pre> |
| 556 |
SetEnv http_proxy "<a href="http://proxy.domain.com:8080"">http://proxy.domain.com:8080"</a>;</pre> |
| 557 |
<p>but this has the default that another CGI, or another program, can use |
| 558 |
this to access external ressources. A better way is to edit Html2Wml and |
| 559 |
fill the option <code>proxy-server</code> with the appropriate value.</p> |
| 560 |
<p> |
| 561 |
<hr> |
| 562 |
<h1><a name="caveats">CAVEATS</a></h1> |
| 563 |
<p>Html2Wml tries to make correct WML documents, but the well-formedness and the |
| 564 |
validity of the document are not guarantied.</p> |
| 565 |
<p>Inverted tags (like ``<b>bold <i>italic</b></i>'') |
| 566 |
may produce unexpected results. But only bad softwares do bad stuff like this.</p> |
| 567 |
<p> |
| 568 |
<hr> |
| 569 |
<h1><a name="links">LINKS</a></h1> |
| 570 |
<p> |
| 571 |
<h2><a name="download">Download</a></h2> |
| 572 |
<DL> |
| 573 |
<dt><strong><a name="item_Html2Wml">Html2Wml</a></strong><br> |
| 574 |
<dd> |
| 575 |
This is the web site of the Html2Wml project, hosted by SourceForge.net. |
| 576 |
All the stable releases can be downloaded from this site. |
| 577 |
<p>[ <a href="http://www.html2wml.org/">http://www.html2wml.org/</a> ]</p> |
| 578 |
<p></p> |
| 579 |
<dt><strong><a name="item_Nutialand">Nutialand</a></strong><br> |
| 580 |
<dd> |
| 581 |
This is the web site of the author, where you can find the archives of |
| 582 |
all the releases of Html2Wml. |
| 583 |
<p>[ <a href="http://www.maddingue.org/softwares/">http://www.maddingue.org/softwares/</a> ]</p> |
| 584 |
<p></p></DL> |
| 585 |
<p> |
| 586 |
<h2><a name="resources">Resources</a></h2> |
| 587 |
<DL> |
| 588 |
<dt><strong><a name="item_The_WAP_Forum">The WAP Forum</a></strong><br> |
| 589 |
<dd> |
| 590 |
This is the official site of the WAP Forum. You can find some technical |
| 591 |
information, as the specifications of all the technologies associated with |
| 592 |
the WAP. |
| 593 |
<p>[ <a href="http://www.wapforum.org/">http://www.wapforum.org/</a> ]</p> |
| 594 |
<p></p> |
| 595 |
<dt><strong><a name="item_WAP%2Ecom">WAP.com</a></strong><br> |
| 596 |
<dd> |
| 597 |
This site has some useful information and links. In particular, it has |
| 598 |
a quite well done FAQ. |
| 599 |
<p>[ <a href="http://www.wap.com/">http://www.wap.com/</a> ]</p> |
| 600 |
<p></p> |
| 601 |
<dt><strong><a name="item_The_World_Wide_Web_Consortium">The World Wide Web Consortium</a></strong><br> |
| 602 |
<dd> |
| 603 |
Altough not directly related to the Wap stuff, you may find useful |
| 604 |
to read the specifications of the XML (WML is an XML application), and the |
| 605 |
specifications of the different stylesheet languages (CSS and XSL), which |
| 606 |
include support for low-resolution devices. |
| 607 |
<p>[ <a href="http://www.w3.org/">http://www.w3.org/</a> ]</p> |
| 608 |
<p></p> |
| 609 |
<dt><strong><a name="item_TuxMobil">TuxMobil</a></strong><br> |
| 610 |
<dd> |
| 611 |
This web site is dedicated to Mobile UniX systems. It leads you to a lot |
| 612 |
of useful hands-on information about installing and running Linux and BSD on |
| 613 |
laptops, PDAs and other mobile computer devices. |
| 614 |
<p>[ <a href="http://www.tuxmobil.org/">http://www.tuxmobil.org/</a> ]</p> |
| 615 |
<p></p></DL> |
| 616 |
<p> |
| 617 |
<h2><a name="programmers utilities">Programmers utilities</a></h2> |
| 618 |
<DL> |
| 619 |
<dt><strong><a name="item_HTML_Tidy">HTML Tidy</a></strong><br> |
| 620 |
<dd> |
| 621 |
This is a very handful utility which corrects your HTML files |
| 622 |
so that they conform to W3C standards. |
| 623 |
<p>[ <a href="http://www.w3.org/People/Raggett/tidy">http://www.w3.org/People/Raggett/tidy</a> ]</p> |
| 624 |
<p></p> |
| 625 |
<dt><strong><a name="item_Kannel">Kannel</a></strong><br> |
| 626 |
<dd> |
| 627 |
Kannel is an open source Wap and SMS gateway. |
| 628 |
A WML compiler is included in the distribution. |
| 629 |
<p>[ <a href="http://www.kannel.org/">http://www.kannel.org/</a> ]</p> |
| 630 |
<p></p> |
| 631 |
<dt><strong><a name="item_WML_Tools">WML Tools</a></strong><br> |
| 632 |
<dd> |
| 633 |
This is a collection of utilities for WML programmers. This include |
| 634 |
a compiler, a decompiler, a viewer and a WBMP converter. |
| 635 |
<p>[ <a href="http://pwot.co.uk/wml/">http://pwot.co.uk/wml/</a> ]</p> |
| 636 |
<p></p></DL> |
| 637 |
<p> |
| 638 |
<h2><a name="wml browsers and wap emulators">WML browsers and Wap emulators</a></h2> |
| 639 |
<DL> |
| 640 |
<dt><strong><a name="item_Opera">Opera</a></strong><br> |
| 641 |
<dd> |
| 642 |
Opera is originaly a Web browser, but the version 5 has a good support |
| 643 |
for XML and WML. Opera is available for free for several systems. |
| 644 |
<p>[ <a href="http://www.opera.com/">http://www.opera.com/</a> ]</p> |
| 645 |
<p></p> |
| 646 |
<dt><strong><a name="item_wApua">wApua</a></strong><br> |
| 647 |
<dd> |
| 648 |
wApua is an open source WML browser written in Perl/Tk. |
| •649 |
It's easy to install and to use. Its support for WML is incomplete, |
| 650 |
but sufficient for testing purpose. |
| 651 |
<p>[ <a href="http://fsinfo.cs.uni-sb.de/~abe/wApua/">http://fsinfo.cs.uni-sb.de/~abe/wApua/</a> ]</p> |
| 652 |
<p></p> |
| 653 |
<dt><strong><a name="item_Tofoa">Tofoa</a></strong><br> |
| 654 |
<dd> |
| 655 |
Tofoa is an open source Wap emulator written in Python. |
| 656 |
Its installation is quite difficult, and its incomplete WML support |
| 657 |
makes it produce strange results, even with valid WML documents. |
| 658 |
<p>[ <a href="http://tofoa.free-system.com/">http://tofoa.free-system.com/</a> ]</p> |
| 659 |
<p></p> |
| 660 |
<dt><strong><a name="item_EzWAP">EzWAP</a></strong><br> |
| 661 |
<dd> |
| 662 |
EzWAP, from EZOS, is a commercial WML browser freely available for |
| 663 |
Windows 9x, NT, 2000 and CE. Compared to others Windows WML browsers, |
| 664 |
it requires very few resources, and is quite stable. Its support for |
| 665 |
the WML specs seems quite complete. A very good software. |
| 666 |
<p>[ <a href="http://www.ezos.com/">http://www.ezos.com/</a> ]</p> |
| 667 |
<p></p> |
| 668 |
<dt><strong><a name="item_Deck%2DIt">Deck-It</a></strong><br> |
| 669 |
<dd> |
| 670 |
Deck-It is a commercial Wap phone emulator, available for Windows and |
| 671 |
Linux/Intel only. It's a very good piece of software which really |
| 672 |
show how WML pages are rendered on a Wap phone, but one of its |
| 673 |
major default is that it cannot read local files. |
| 674 |
<p>[ <a href="http://www.pyweb.com/tools/">http://www.pyweb.com/tools/</a> ]</p> |
| 675 |
<p></p> |
| 676 |
<dt><strong><a name="item_Klondike_WAP_Browser">Klondike WAP Browser</a></strong><br> |
| 677 |
<dd> |
| 678 |
Klondike WAP Browser is a commercial WAP browser available for Windows |
| 679 |
and PocketPC. |
| 680 |
<p>[ <a href="http://www.apachesoftware.com/">http://www.apachesoftware.com/</a> ]</p> |
| 681 |
<p></p> |
| 682 |
<dt><strong><a name="item_WinWAP">WinWAP</a></strong><br> |
| 683 |
<dd> |
| 684 |
WinWAP is a commercial Wap browser, freely available for Windows. |
| 685 |
<p>[ <a href="http://www.winwap.org/">http://www.winwap.org/</a> ]</p> |
| 686 |
<p></p> |
| 687 |
<dt><strong><a name="item_WAPman">WAPman</a></strong><br> |
| 688 |
<dd> |
| 689 |
WAPman from EdgeMatrix, is a commercial WAP browser available for |
| 690 |
Windows and PalmOS. |
| 691 |
<p>[ <a href="http://www.edgematrix.com/edge/control/MainContentBean?page=downloads">http://www.edgematrix.com/edge/control/MainContentBean?page=downloads</a> ]</p> |
| 692 |
<p></p> |
| 693 |
<dt><strong><a name="item_Wireless_Companion">Wireless Companion</a></strong><br> |
| 694 |
<dd> |
| 695 |
Wireless Companion, from YourWap.com, is a WAP emulator available |
| 696 |
for Windows. |
| 697 |
<p>[ <a href="http://www.yourwap.com/">http://www.yourwap.com/</a> ]</p> |
| 698 |
<p></p> |
| 699 |
<dt><strong><a name="item_Mobilizer">Mobilizer</a></strong><br> |
| 700 |
<dd> |
| 701 |
Mobilizer is a Wap emulator available for Windows and Unix. |
| 702 |
<p>[ <a href="http://mobilizer.sourceforge.net/">http://mobilizer.sourceforge.net/</a> ]</p> |
| 703 |
<p></p> |
| 704 |
<dt><strong><a name="item_QWmlBrowser">QWmlBrowser</a></strong><br> |
| 705 |
<dd> |
| 706 |
QWmlBrowser (formerly known as WML BRowser) is an open source |
| 707 |
WML browser, written using the Qt toolkit. |
| 708 |
<p>[ <a href="http://www.wmlbrowser.org/">http://www.wmlbrowser.org/</a> ]</p> |
| 709 |
<p></p> |
| 710 |
<dt><strong><a name="item_Wapsody">Wapsody</a></strong><br> |
| 711 |
<dd> |
| 712 |
Wapsody, developed by IBM, is a freely available simulation |
| 713 |
environment that implements the WAP specification. It also |
| 714 |
features a WML browser which can be run stand-alone. |
| 715 |
As Wapsody is written in Java/Swing, it should work on any |
| 716 |
system. |
| 717 |
<p>[ <a href="http://alphaworks.ibm.com/aw.nsf/techmain/wapsody">http://alphaworks.ibm.com/aw.nsf/techmain/wapsody</a> ]</p> |
| 718 |
<p></p> |
| 719 |
<dt><strong><a name="item_WAPreview">WAPreview</a></strong><br> |
| 720 |
<dd> |
| 721 |
WAPreview is a Wap emulator written in Java. As it uses an HTML |
| 722 |
based UI and needs a local web proxy, it runs quite slowly. |
| 723 |
<p>[ <a href="http://wapreview.sourceforge.net">http://wapreview.sourceforge.net</a> ]</p> |
| 724 |
<p></p> |
| 725 |
<dt><strong><a name="item_PicoWap">PicoWap</a></strong><br> |
| 726 |
<dd> |
| 727 |
PicoWap is a small WML browser made by three French students. |
| 728 |
<p>[ <a href="http://membres.lycos.fr/picowap/">http://membres.lycos.fr/picowap/</a> ]</p> |
| 729 |
<p></p></DL> |
| 730 |
<p> |
| 731 |
<hr> |
| 732 |
<h1><a name="acknowledgements">ACKNOWLEDGEMENTS</a></h1> |
| 733 |
<p>Werner Heuser, for his numerous ideas, advices and his help for the debugging</p> |
| 734 |
<p>Igor Khristophorov, for his numerous suggestions and patches</p> |
| 735 |
<p>And all the people that send me bug reports: Daniele Frijia, Axel Jerabek, Ouyang</p> |
| 736 |
<p> |
| 737 |
<hr> |
| 738 |
<h1><a name="author">AUTHOR</a></h1> |
| 739 |
<p>Sébastien Aperghis-Tramoni <<a href="mailto:[email protected]<gt>">[email protected]<gt></a></p> |
| 740 |
<p> |
| 741 |
<hr> |
| 742 |
<h1><a name="copyright">COPYRIGHT</a></h1> |
| 743 |
<p>Copyright (C)2000, 2001, 2002 Sébastien Aperghis-Tramoni</p> |
| 744 |
<p>This program is free software. You can redistribute it and/or modify it |
| 745 |
under the terms of the GNU General Public License, version 2 or later.</p> |
| 746 |
|
| 747 |
</body> |
| 748 |
|
| 749 |
</html> |