Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.19.2.10 -r1.19.2.11 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 28 Mar 2003 13:49:00 -0000 1.19.2.10 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 7 Apr 2003 06:03:48 -0000 1.19.2.11 @@ -2822,14 +2822,22 @@ {-existing_urls {}} {-no_resolve:boolean} {-replacement "-"} - text + {-text ""} + {_text ""} } { Modify a string so that it is suited as a well formatted URL path element. - for example given "Foo Bar" and it will return "foo-bar". Also, - if given a list of existing urls it can catch duplicate or optionally - create an unambiguous url by appending -N. + Also, if given a list of existing urls it can catch duplicate or optionally + create an unambiguous url by appending a dash and a digit. +

+ + Examples:
+ util_text_to_url -text "Foo Bar" returns foo-bar
+ util_text_to_url -existing_urls {foo-bar some-other-item} -text "Foo Bar" returns foo-bar-2
+ + @param text the text to modify, e.g. "Foo Bar" + @param _text the text to modify, e.g. "Foo Bar" (Deprecated, use -text instead. Fails when the value starts with a dash.) @param existing_urls a list of URLs that already exist on the same level and would cause a conflict @@ -2838,8 +2846,16 @@ @param replacement the character that is used to replace illegal characters - @author Tillman Singer + @author Tilmann Singer } { + if { [empty_string_p $text] && [empty_string_p $_text] } { + error "You must specify either -text or _text." + } + + if { [empty_string_p $text] } { + set text $_text + } + set original_text $text set text [string trim [string tolower $original_text]]