X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fcocanwiki.ml;h=ae073620c15a3b257d0405f61d45def21ca5ed6a;hb=35f3941cfe3d70d720604da0b2c8850ef704a92d;hp=837028a58273af55b322705b726521c720196a47;hpb=5def59b20559a1d352d0d9c3304d9b09c2523b41;p=cocanwiki.git diff --git a/scripts/cocanwiki.ml b/scripts/cocanwiki.ml index 837028a..ae07362 100644 --- a/scripts/cocanwiki.ml +++ b/scripts/cocanwiki.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 + * 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