* http://cs.unibo.it/helm/.
*)
-(* TODO quando si prova ad applicare uno stylesheet che non e' stato caricato
-viene lasciata passare una eccezione Not_found *)
-
open Printf;;
open Uwobo_common;;
let syslogger = new Uwobo_logger.sysLogger ~level:debug_level () in
syslogger#enable;
let styles = new Uwobo_styles.styles in
-let usage_string = "Help message: not yet written!!" in (* TODO *)
+let usage_string =
+ sprintf
+"
+<html>
+ <head>
+ <title>UWOBO's help message</title>
+ </head>
+ <body>
+ <p>
+ Usage: <kbd>http://hostname:uwoboport/</kbd><em>command</em>
+ </p>
+ <p>
+ Available commands:
+ </p>
+ <p>
+ <b><kbd>help</kbd></b><br />
+ display this help message
+ </p>
+ <p>
+ <b><kbd>add?bind=key,uri[&bind=key,stylesheet[&...]]</kbd></b><br />
+ load a new stylesheet, specified by <em>uri</em>, and bind it to key
+ <em>key</em>
+ </p>
+ <p>
+ <b><kbd>remove?[?keys=key1,key2,...]</kbd></b><br />
+ unload stylesheets specified by <em>key1, key2, ...</em> or all
+ stylesheets if no key was given
+ </p>
+ <p>
+ <b><kbd>reload?[?keys=key1,key2,...]</kbd></b><br />
+ reload stylesheets specified by <em>key1, key2, ...</em> or all
+ stylesheets if no key was given
+ </p>
+ <p>
+ <b><kbd>list</kbd></b><br />
+ return a list of loaded stylesheets
+ </p>
+ <p>
+ <b><kbd>apply?xmluri=uri&keys=key1,key2,...[¶m.name=value[¶m.name=value[&...]]][¶m.key.name=value[¶m.key.name=value[&...]]][&name[=value][&prop.name[=value][&...]]]</kbd></b><br />
+ apply a chain of stylesheets, specified by <em>key1, key2, ...</em>, to an
+ input document, specified by <em>uri</em>.<br />
+ Additional parameters can be set for each stylesheet application: global
+ parameters (i.e. parameters passed to all stylesheets) are set using
+ <em>param.name=value</em> syntax, per stylesheet parameters are set using
+ <em>param.key.name=value</em> where <em>key</em> is the key of a loaded
+ stylesheet.<br />
+ Properties of the final chain output can be set too: valueless properties
+ can be set using <em>prop.name</em> syntax, others can be set using
+ <em>prop.name=value</em> syntax.<br />
+ Current supported properties are: %s.
+ </p>
+ </body>
+</html>
+"
+ (String.concat ", " Uwobo_common.supported_properties)
+in
(* thread action *)
let callback req outchan =