Index: openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl,v diff -u -r1.72.2.11 -r1.72.2.12 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 10 Sep 2019 12:57:29 -0000 1.72.2.11 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 10 Sep 2019 13:24:06 -0000 1.72.2.12 @@ -1277,7 +1277,12 @@ Extracts information about the author and formats it into an HTML string. - @param author_string author information to format + @param author_string author information to format. 3 kind of + formats are expected: email (a mailto link to the email + is generated), whitespace-separated couple " ()" (a + mailto link for email and the name are generated) and + free-form (the same input string is returned). + @return the formatted result } { if { [regexp {^[^ \n\r\t]+$} $author_string] Index: openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl,v diff -u -r1.4.2.8 -r1.4.2.9 --- openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl 10 Sep 2019 12:23:49 -0000 1.4.2.8 +++ openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl 10 Sep 2019 13:24:06 -0000 1.4.2.9 @@ -279,7 +279,30 @@ [ad_looks_like_html_p [api_script_documentation -format [ad_generate_random_string] $tmpfile]] } +aa_register_case \ + -cats { api smoke } \ + -procs { + apidoc::format_author + } \ + acs_api_browser_apidoc_format_author { + Check apidoc::format_author + } { + set input1 "test@email.com" + aa_true "Mailto link is generated for '$input1'" \ + [regexp [subst -nocommands {^$}] [apidoc::format_author $input1]] + set name "John Doe" + set email "company@domain.com" + set input2 "$name ($email)" + aa_true "Mailto link with name is generated for '$input2'" \ + [regexp [subst -nocommands {$name.*}] [apidoc::format_author $input2]] + + set input3 [ad_generate_random_string] + aa_true "Same string is returned for '$input3'" \ + {[apidoc::format_author $input3] eq $input3} + } + + # Local variables: # mode: tcl # tcl-indent-level: 4