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 -N -r1.72.2.8 -r1.72.2.9 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 20 Jun 2019 09:59:22 -0000 1.72.2.8 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 6 Sep 2019 21:53:14 -0000 1.72.2.9 @@ -353,7 +353,7 @@ } ad_proc -public api_proc_documentation { - {-format text/html} + -format -script:boolean -source:boolean -xql:boolean @@ -365,8 +365,8 @@ Generates formatted documentation for a procedure. - @param format the type of documentation to generate. Currently, only - text/html and text/plain are supported. + @param format the type of documentation to generate. This + parameter is deprecated and has no effect. @param script include information about what script this proc lives in? @param xql include the source code for the related xql files? @param source include the source code for the script? @@ -383,8 +383,8 @@ ad_log warning "api_proc_documentation: received invalid proc_name <$proc_name>, try to sanitize" regsub -all {::::} $proc_name :: proc_name } - if { $format ne "text/html" && $format ne "text/plain" } { - return -code error "Only text/html and text/plain documentation are currently supported" + if {[info exists format]} { + ad_log warning "-format flag is deprecated and has no effect" } array set doc_elements { flags "" 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 -N -r1.4.2.4 -r1.4.2.5 --- openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl 5 Sep 2019 16:11:09 -0000 1.4.2.4 +++ openacs-4/packages/acs-api-browser/tcl/test/acs-api-browser-procs.tcl 6 Sep 2019 21:53:14 -0000 1.4.2.5 @@ -152,6 +152,45 @@ } } +aa_register_case \ + -cats { api smoke } \ + -procs { + api_proc_documentation + } \ + acs_api_browser_api_proc_documentation { + Check api_proc_documentation + } { + set proc api_proc_documentation + + aa_true "Specifiying an invalid proc throws an error" [catch { + api_proc_documentation [ad_generate_random_string] + }] + + set doc [api_proc_documentation $proc] + aa_true "Format is HTML" [ad_looks_like_html_p $doc] + + set doc [api_proc_documentation -format text/plain $proc] + aa_true "Format is HTML also when specifying deprecated -format flag" [ad_looks_like_html_p $doc] + + set proc_url [dict get [nsv_get api_proc_doc $proc] script] + set doc [api_proc_documentation -script $proc] + aa_true "Specifying the script flag returns the proc file" [string match *$proc_url* $doc] + + set doc [api_proc_documentation -xql $proc] + aa_true "Specifying the xql flag returns the something about xql" [string match -nocase *xql* $doc] + + set doc [api_proc_documentation -first_line_tag

$proc] + aa_true "Specifying the first line tag prints it out around the first line" [regexp {^

.*

.*$} $doc] + + set label [ad_generate_random_string] + set doc [api_proc_documentation -first_line_tag

-label $label $proc] + aa_true "Specifying the label prints it out in the first line" [regexp [subst -nocommands {^

.*$label.*

.*$}] $doc] + + set proc_type [ad_generate_random_string] + set doc [api_proc_documentation -first_line_tag

-proc_type $proc_type $proc] + aa_true "Specifying the proc type it out in the first line" [regexp [subst -nocommands {^

.*$proc_type.*

.*$}] $doc] + } + # Local variables: # mode: tcl # tcl-indent-level: 4