Support for users, roles, restrictions.
[cocanwiki.git] / scripts / preview.ml
1 (* COCANWIKI scripts.
2  * Written by Richard W.M. Jones <rich@merjis.com>.
3  * Copyright (C) 2004 Merjis Ltd.
4  * $Id: preview.ml,v 1.2 2004/09/07 13:40:10 rich Exp $
5  *
6  * In case you were wondering, this script is called from the Javascript
7  * to update the preview <div>.  See /_js/editor.js for details.
8  *)
9
10 open Apache
11 open Registry
12 open Cgi
13 open Printf
14
15 open Cocanwiki
16
17 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
18   let content = q#param "content" in
19   let xhtml = Wikilib.xhtml_of_content dbh hostid content in
20
21   q#header ~content_type:"text/html; charset=utf-8" ();
22   print_string r xhtml
23
24 let () =
25   register_script run