Feedback form. You need to set the hosts.feedback_email field
[cocanwiki.git] / scripts / cocanwiki.ml
index 837028a..ae07362 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki.ml,v 1.7 2004/09/17 15:24:54 rich Exp $
+ * $Id: cocanwiki.ml,v 1.8 2004/09/20 15:34:36 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@ open Cgi
 open Printf
 
 open Cocanwiki_ok
+open Cocanwiki_strings
 
 module Pool = DbiPool (Dbi_postgres)
 
@@ -188,3 +189,15 @@ let register_script ?(restrict = []) ?(anonymous = true) run =
           ~title:"Access denied"
           q "You do not have permission to access this part of the site."
     )
+
+(* Convert a section name into something valid for use in <a name="...">
+ * XXX This breaks horribly for non-7-bit strings.
+ * XXX This is stuck here because we don't have a good place for it, and
+ * because it needs to be fixed for i18n compliance.
+ *)
+let linkname_of_sectionname str =
+  let str = String.copy str in
+  for i = 0 to String.length str - 1 do
+    if not (isalnum str.[i]) then str.[i] <- '_'
+  done;
+  str