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.26 -r1.27 --- openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 29 Sep 2008 08:42:06 -0000 1.26 +++ openacs-4/packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl 7 Feb 2009 20:32:54 -0000 1.27 @@ -859,6 +859,28 @@ } { + if {[info command ::xotcl::api] ne ""} { + set scope [::xotcl::api scope_from_proc_index $proc_name] + } else { + set scope "" + } + + set proc_namespace "" + regexp {^(::)?(.*)::[^:]+$} $proc_name match colons proc_namespace + + return [api_tclcode_to_html -scope $scope -proc_namespace $proc_namespace [api_get_body $proc_name]] +} + +ad_proc -private api_tclcode_to_html {{-scope ""} {-proc_namespace ""} script} { + + Given a script, this proc formats it as HTML, including highlighting syntax in + various colors and creating hyperlinks to other proc definitions.
+ The inspiration for this proc was the tcl2html script created by Jeff Hobbs. + + @param script script to be formated in HTML + +} { + # Returns length of a variable name proc length_var {data} { if {[regexp -indices {^\$\{[^\}]+\}} $data found]} { @@ -970,15 +992,13 @@ {gets puts socket tell format scan} \ ] - if {"" ne [info command ::xotcl::api] } { + if {[info command ::xotcl::api] ne ""} { set XOTCL_KEYWORDS [list self my next] # only command names are highlighted, otherwise we could add xotcl method # names by [lsort -unique [concat [list self my next] .. # [::xotcl::Object info methods] [::xotcl::Class info methods] ]] - set scope [::xotcl::api scope_from_proc_index $proc_name] } else { set XOTCL_KEYWORDS {} - set scope "" } # Returns a list of the commands from all namespaces. @@ -991,16 +1011,8 @@ } set COMMANDS [list_all_procs] + set data [string map [list & "&" < "<" > ">"] \n$script] - set proc_namespace "" - regexp {^(::)?(.*)::[^:]+$} $proc_name match colons proc_namespace - - set data \n[api_get_body $proc_name] - - regsub -all {&} $data {\&} data - regsub -all {<} $data {\<} data - regsub -all {>} $data {\>} data - set in_comment 0 set in_quotes 0 set proc_ok 1 @@ -1151,6 +1163,7 @@ } + #################### # # Linking to api-documentation Index: openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 17 May 2003 09:38:28 -0000 1.5 +++ openacs-4/packages/acs-api-browser/www/tcl-proc-view.tcl 7 Feb 2009 20:32:54 -0000 1.6 @@ -9,18 +9,35 @@ tcl_proc:onevalue } -set tcl_api_root "http://www.aolserver.com/docs/devel/tcl/api/" +# old aolserver documentation +#set tcl_api_host "http://www.aolserver.com/" +#set tcl_api_index "docs/devel/tcl/api/" +# wiki on dev.aolserver; might be the place in the future +#set tcl_api_host "http://dev.aolserver.com/" +#set tcl_api_index "wiki/Tcl_API" + +# wiki on panpotic +set tcl_api_host "http://panoptic.com/" +set tcl_api_index "wiki/aolserver/Tcl_API" + +set tcl_api_root ${tcl_api_host}${tcl_api_index} set tcl_api_index_page [util_memoize "ns_httpget $tcl_api_root"] +ns_log notice index=$tcl_api_root set tcl_proc [lindex $tcl_proc 0] set len [string length $tcl_proc] 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_api_index_page match relative_url] } { - ad_returnredirect "$tcl_api_root$relative_url" + if { [regexp "\"'\]+)\[\"'\]\[^>\]*>$search_for" $tcl_api_index_page match relative_url] } { + if {[string match "/*" $relative_url]} { + set url ${tcl_api_host}$relative_url + } else { + set url ${tcl_api_root}$relative_url + } + ad_returnredirect -allow_complete_url $url ad_script_abort } }