Index: openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl,v diff -u -r1.8.2.2 -r1.8.2.3 --- openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 22 May 2016 19:22:51 -0000 1.8.2.2 +++ openacs-4/packages/acs-api-browser/www/tcl-doc-search.tcl 2 Aug 2016 10:14:41 -0000 1.8.2.3 @@ -11,28 +11,27 @@ csrf { security::csrf::validate } } -set tcl_docs_root "http://tcl.tk/man/tcl[info tclversion]/TclCmd/" -set tcl_docs_url "${tcl_docs_root}contents.htm" -with_catch errmsg { - set tcl_docs_index_result [util_memoize [list util::http::get -url $tcl_docs_url]] - set tcl_docs_index_page [dict get $tcl_docs_index_result page] -} { - ad_return_error "Cannot Connect" "We're sorry, but we're having problems connecting to the server containing the Tcl documentation: $tcl_docs_url" - ad_script_abort -} +# +# Try Tcl command documentation +# -set tcl_proc [lindex $tcl_proc 0] -set len [string length $tcl_proc] +regexp {^(.*)/[^/]+} $::apidoc::tcl_api_html_index _ root +append root / -for { set i [expr { $len-1 }] } { $i >= 0 } { incr i -1 } { - set search_for [string range $tcl_proc 0 $i] - if { [regexp "\]+)\">$search_for" $tcl_docs_index_page match relative_url] } { - ad_returnredirect -allow_complete_url "$tcl_docs_root$relative_url" - ad_script_abort - } +set url [apidoc::get_doc_url \ + -cmd $tcl_proc \ + -index $::apidoc::tcl_api_html_index \ + -root $root \ + -host $root] + +if {$url ne ""} { + ns_log notice "api-doc/www/proc-view got URL <$url>" + ad_returnredirect -allow_complete_url $url + ad_script_abort } +set tcl_docs_url $::apidoc::tcl_api_html_index set title "Tcl API Procedure Search for: \"$tcl_proc\"" set context [list "Tcl API Search: $tcl_proc"]