- Publicity: Public Only All
acs-api-documentation-procs.tcl
Routines for generating API documentation.
- Location:
- packages/acs-api-browser/tcl/acs-api-documentation-procs.tcl
- Created:
- 21 Jun 2000
- Authors:
- Jon Salz <jsalz@mit.edu>
- Lars Pind <lars@arsdigita.com>
Procedures in this file
- api_add_calling_info_to_procdoc (private)
- api_add_to_proc_doc (public)
- api_apropos_functions (public)
- api_call_graph_snippet (private)
- api_called_proc_names (private)
- api_describe_function (public)
- api_get_body (public)
- api_library_documentation (public)
- api_proc_doc_url (private)
- api_proc_documentation (public)
- api_proc_format_switch (private)
- api_proc_link (public)
- api_proc_pretty_name (public)
- api_proc_pretty_param_details (private)
- api_proc_url (public)
- api_read_script_documentation (public)
- api_script_documentation (public)
- api_test_case_url (private)
- api_type_documentation (public, deprecated)
- apidoc::ad_keywords_score (private)
- apidoc::ad_sort_by_first_string_proc (private)
- apidoc::ad_sort_by_score_proc (private)
- apidoc::ad_sort_by_second_string_proc (private)
- apidoc::first_sentence (private)
- apidoc::format_author (public)
- apidoc::format_author_list (private)
- apidoc::format_changelog_change (private)
- apidoc::format_changelog_list (private)
- apidoc::format_common_elements (private)
- apidoc::format_see (public)
- apidoc::format_see_list (private)
- apidoc::get_doc_property (private)
- apidoc::get_doc_url (private)
- apidoc::get_object_property (public)
- apidoc::get_xql_snippet (private)
- apidoc::is_object (private)
- apidoc::length_braces (private)
- apidoc::length_exp (private)
- apidoc::length_proc (private)
- apidoc::length_regexp (private)
- apidoc::length_spaces (private)
- apidoc::length_string (private)
- apidoc::length_var (private)
- apidoc::pretty_token (private)
- apidoc::sanitize_path (private)
- apidoc::search_on_webindex (private)
- apidoc::set_public (private)
- apidoc::tcl_to_html (public)
- apidoc::tclcode_to_html (public)
- apidoc::xql_links_list (private)
Detailed information
api_add_calling_info_to_procdoc (private)
api_add_calling_info_to_procdoc [ proc_name ]
Add the calling information (what are the functions called by this proc_name) to the collected proc_doc information.
- Parameters:
- proc_name (optional, defaults to
"*"
)- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_add_to_proc_doc (public)
api_add_to_proc_doc -proc_name proc_name -property property \ -value value
Add a certain value to a property in the proc doc of the specified proc.
- Switches:
- -proc_name (required)
- name is fully qualified name without leading colons proc procs, XOTcl methods are a triple with the fully qualified class name, then proc|instproc and then the method name.
- -property (required)
- name of property such as "main" "testcase" "calledby" "deprecated_p" "script" "protection"
- -value (required)
- value of the property
- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_add_to_proc_doc
api_apropos_functions (public)
api_apropos_functions string
- Parameters:
- string (required)
- Returns:
- the functions in the system that contain string in their name and have been defined using ad_proc.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_apropos_functions
api_call_graph_snippet (private)
api_call_graph_snippet -proc_name proc_name [ -dpi dpi ] \ [ -format format ] [ -maxnodes maxnodes ] \ [ -textpointsize textpointsize ]
Return a source code for dot showing a local call graph snippet, showing direct callers and directly called functions
- Switches:
- -proc_name (required)
- -dpi (optional, defaults to
"72"
)- -format (optional, defaults to
"svg"
)- -maxnodes (optional, defaults to
"5"
)- -textpointsize (optional, defaults to
"12.0"
)- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_called_proc_names (private)
api_called_proc_names [ -body body ] -proc_name proc_name
Return list of procs called by the specified procname handle. Note that this function is based on "::apidoc::tcl_to_html", which is based on some heuristics and is not guaranteed to return always the correct results (it might contain false positives). Use this private function only, when heuristics are fine.
- Switches:
- -body (optional)
- -proc_name (required)
- name is fully qualified name without leading colons proc procs, XOTcl methods are a triple with the fully qualified class name, then proc|instproc and then the method name.
- Author:
- Gustaf Neumann
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- callgraph__bad_library_calls, callgraph__bad_page_calls
api_describe_function (public)
api_describe_function [ -format format ] proc
Describes the functions in the system that contain string and that have been defined using ad_proc. The description includes the documentation string, if any.
- Switches:
- -format (optional, defaults to
"text/plain"
)- Parameters:
- proc (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_describe_function
api_get_body (public)
api_get_body proc_name
This function returns the body of a Tcl proc or an XOTcl method.
- Parameters:
- proc_name (required)
- the name spec of the proc
- Returns:
- body of the specified proc
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_get_body
api_library_documentation (public)
api_library_documentation [ -format format ] path
Generates formatted documentation for a Tcl library file (just the header, describing what the library does).
- Switches:
- -format (optional, defaults to
"text/html"
)- Parameters:
- path (required)
- the path to the file, relative to the OpenACS path root.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_trivial_smoke_test
api_proc_doc_url (private)
api_proc_doc_url [ -proc_name proc_name ] [ -source_p source_p ] \ [ -version_id version_id ]
Return the procdoc url from procname and optionally from source_p and version_id
- Switches:
- -proc_name (optional)
- -source_p (optional)
- -version_id (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_proc_documentation (public)
api_proc_documentation [ -format format ] [ -script ] [ -source ] \ [ -xql ] [ -label label ] [ -first_line_tag first_line_tag ] \ [ -proc_type proc_type ] proc_name
Generates formatted documentation for a procedure.
- Switches:
- -format (optional)
- the type of documentation to generate. This parameter is deprecated and has no effect.
- -script (optional, boolean)
- include information about what script this proc lives in?
- -source (optional, boolean)
- include the source code for the script?
- -xql (optional, boolean)
- include the source code for the related xql files?
- -label (optional)
- the label printed for the proc in the header line
- -first_line_tag (optional, defaults to
"<h3>"
)- tag for the markup of the first line
- -proc_type (optional)
- Parameters:
- proc_name (required)
- the name of the procedure for which to generate documentation.
- Returns:
- the formatted documentation string.
- Error:
- if the procedure is not defined.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_proc_documentation
api_proc_format_switch (private)
api_proc_format_switch xotclArgs flags switch
- Parameters:
- xotclArgs (required)
- flags (required)
- switch (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_proc_link (public)
api_proc_link [ -source ] proc
- Switches:
- -source (optional, boolean, defaults to
"1"
)- Parameters:
- proc (required)
- Returns:
- full HTML link to the documentation for the proc.
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- 14 July 2000
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- documentation__check_deprecated_see
api_proc_pretty_name (public)
api_proc_pretty_name [ -link ] [ -include_debug_controls ] \ [ -hints_only ] [ -proc_type proc_type ] [ -label label ] proc
- Switches:
- -link (optional, boolean)
- provide a link to the documentation pages
- -include_debug_controls (optional, boolean)
- -hints_only (optional, boolean)
- -proc_type (optional)
- -label (optional)
- the label printed for the proc in the header line
- Parameters:
- proc (required)
- Returns:
- a pretty version of a proc name
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_proc_pretty_name
api_proc_pretty_param_details (private)
api_proc_pretty_param_details -flags flags \ [ -default_value default_value ]
- Switches:
- -flags (required)
- -default_value (optional)
- Returns:
- string with details about a parameter
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_proc_url (public)
api_proc_url [ -source ] proc
- Switches:
- -source (optional, boolean, defaults to
"1"
)- Parameters:
- proc (required)
- Returns:
- the URL of the page that documents the given proc.
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- 14 July 2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_proc_pretty_name
api_read_script_documentation (public)
api_read_script_documentation path
Reads the contract from a Tcl content page.
- Parameters:
- path (required)
- the path of the Tcl file to examine, relative to the OpenACS root directory.
- Returns:
- a list representation of the documentation element array, or an empty list if the file does not contain a
doc_page_contract
block.- Error:
- if the file does not exist.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_read_script_documentation
api_script_documentation (public)
api_script_documentation [ -format format ] path
Generates formatted documentation for a content page. Sources the file to obtain the comment or contract at the beginning.
- Switches:
- -format (optional, defaults to
"text/html"
)- the type of documentation to generate. Currently, only
text/html
is supported.- Parameters:
- path (required)
- the path of the Tcl file to examine, relative to the OpenACS root directory.
- Returns:
- the formatted documentation string.
- Error:
- if the file does not exist.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_api_script_documentation
api_test_case_url (private)
api_test_case_url testcase_pair
Return the testcase url from testcase_pair, consisting of testcase_id and package_key.
- Parameters:
- testcase_pair (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
api_type_documentation (public, deprecated)
api_type_documentation type
Deprecated. Invoking this procedure generates a warning.
Deprecated: this was part of a feature which used to react to the 'type' property set in ad_page_contract's documentation and generate an extra link in /api-doc/package-view, but currently no upstream script seems to specify this value and no code seems to create necessary 'doc_type_doc' nsv
- Parameters:
- type (required)
- Returns:
- HTML fragment of the API docs.
- See Also:
- /packages/acs-api-browser/www/type-view.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::ad_keywords_score (private)
apidoc::ad_keywords_score keywords string_to_search
- Parameters:
- keywords (required)
- string_to_search (required)
- Returns:
- Number of keywords found in string to search. No additional score for repeats.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::ad_sort_by_first_string_proc (private)
apidoc::ad_sort_by_first_string_proc l1 l2
basically a -1,0,1 result comparing the second element of the list inputs then the first. (both strings)
- Parameters:
- l1 (required)
- l2 (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::ad_sort_by_score_proc (private)
apidoc::ad_sort_by_score_proc l1 l2
basically a -1,0,1 result comparing the second element of the list inputs then the first. (second is int)
- Parameters:
- l1 (required)
- l2 (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::ad_sort_by_second_string_proc (private)
apidoc::ad_sort_by_second_string_proc l1 l2
basically a -1,0,1 result comparing the second element of the list inputs then the first (both strings)
- Parameters:
- l1 (required)
- l2 (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::first_sentence (private)
apidoc::first_sentence string
- Parameters:
- string (required)
- Returns:
- the first sentence of a string.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::format_author (public)
apidoc::format_author author_string
Extracts information about the author and formats it into an HTML string.
- Parameters:
- author_string (required)
- 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). - Returns:
- the formatted result
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_apidoc_format_author
apidoc::format_author_list (private)
apidoc::format_author_list authors
Generates an HTML-formatted list of authors (including
<dt>
and<dd>
tags).
- Parameters:
- authors (required)
- the list of author strings.
- Returns:
- the formatted list, or an empty string if there are no authors.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::format_changelog_change (private)
apidoc::format_changelog_change change
Formats the change log line: turns email addresses in parenthesis into links.
- Parameters:
- change (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::format_changelog_list (private)
apidoc::format_changelog_list changelog
Format the change log info
- Parameters:
- changelog (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::format_common_elements (private)
apidoc::format_common_elements doc_elements_var
- Parameters:
- doc_elements_var (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::format_see (public)
apidoc::format_see see
Takes the value in the argument "see" and possibly formats it into a link that will give the user more info about that resource
- Parameters:
- see (required)
- a string expected to contain the resource to format
- Returns:
- the html string representing the resource
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_apidoc_format_see
apidoc::format_see_list (private)
apidoc::format_see_list sees
Generate an HTML list of referenced procs and pages.
- Parameters:
- sees (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::get_doc_property (private)
apidoc::get_doc_property proc_name property [ default ]
Return a certain doc property value, if property exists
- Parameters:
- proc_name (required)
- property (required)
- default (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- callgraph__bad_library_calls, callgraph__bad_page_calls
apidoc::get_doc_url (private)
apidoc::get_doc_url [ -cmd cmd ] [ -index index ] [ -root root ] \ [ -host host ]
- Switches:
- -cmd (optional)
- -index (optional)
- -root (optional)
- -host (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::get_object_property (public)
apidoc::get_object_property o what [ args... ]
Return poperties of objects agnostic to the object system (i.e., XOTcl or NX).
- Parameters:
- o (required)
- what (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::get_xql_snippet (private)
apidoc::get_xql_snippet [ -proc_name proc_name ] \ [ -xql_file xql_file ]
- Switches:
- -proc_name (optional)
- -xql_file (optional)
- Returns:
- matching xql snippet for specified proc_name
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::is_object (private)
apidoc::is_object scope proc_name
Checks, whether the specified argument is an XOTcl object. Does not cause problems when xotcl is not loaded.
- Parameters:
- scope (required)
- proc_name (required)
- Returns:
- boolean value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_braces (private)
apidoc::length_braces data
- Parameters:
- data (required)
- Returns:
- length of subexpression, from open to close brace inclusive. Doesn't deal with unescaped braces in substrings.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_exp (private)
apidoc::length_exp data
- Parameters:
- data (required)
- Returns:
- length of a generic subexpression.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_proc (private)
apidoc::length_proc data
- Parameters:
- data (required)
- Returns:
- Length of a command name.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_regexp (private)
apidoc::length_regexp data
Calculate how much text we should ignore.
- Parameters:
- data (required)
- Returns:
- length in characters.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_spaces (private)
apidoc::length_spaces data
- Parameters:
- data (required)
- Returns:
- Number of spaces until next subexpression.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_string (private)
apidoc::length_string data
- Parameters:
- data (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::length_var (private)
apidoc::length_var data
- Parameters:
- data (required)
- Returns:
- Length of a variable name.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::pretty_token (private)
apidoc::pretty_token kind token
Encode the specified token in HTML
- Parameters:
- kind (required)
- token (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::sanitize_path (private)
apidoc::sanitize_path [ -prefix prefix ] path
Return a sanitized path. Cleans path from directory traversal attacks and checks, if someone tries to access content outside of the specified prefix.
- Switches:
- -prefix (optional, defaults to
"packages"
)- Parameters:
- path (required)
- Returns:
- sanitized path
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::search_on_webindex (private)
apidoc::search_on_webindex [ -page page ] [ -host host ] \ [ -root root ] [ -proc proc ]
Search for a matching link in the page and return the absolute link if found. Avoid in-page links (starting with "#")
- Switches:
- -page (optional)
- HTML page
- -host (optional)
- for completing URLs starting with no "/"
- -root (optional)
- for completing URLs starting with a "/"
- -proc (optional)
- name of proc as used in link label
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::set_public (private)
apidoc::set_public version_id [ public_p ]
Gets or sets the user's public/private preferences for a given package.
- Parameters:
- version_id (required)
- the version of the package
- public_p (optional)
- if empty, return the user's preferred setting or the default (1) if no preference found. If not empty, set the user's preference to public_p
- Returns:
- public_p
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apidoc::tcl_to_html (public)
apidoc::tcl_to_html proc_name
Given a proc name, 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.
Known Issues:
- This proc will mistakenly highlight switch strings that look like commands as commands, etc.
- There are many undocumented AOLserver commands including all of the commands added by modules.
- When a proc inside a string has explicitly quoted arguments, they are not formatted.
- regexp and regsub are hard to parse properly. E.g. If we use the start option, and we quote its argument, and we have an ugly regexp, then this code might highlight it incorrectly.
- Parameters:
- proc_name (required)
- procedure to format in HTML
- Author:
- Jamie Rasmussen <jrasmuss@mle.ie>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_apidoc_tclcode_to_html
apidoc::tclcode_to_html (public)
apidoc::tclcode_to_html [ -scope scope ] \ [ -proc_namespace 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.
- Switches:
- -scope (optional)
- -proc_namespace (optional)
- Parameters:
- script (required)
- script to be formatted in HTML
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_api_browser_apidoc_tclcode_to_html
apidoc::xql_links_list (private)
apidoc::xql_links_list [ -include_compiled include_compiled ] path
- Switches:
- -include_compiled (optional, defaults to
"0"
)- Parameters:
- path (required)
- path and filename from $::acs::rootdir
- Returns:
- list of xql files related to Tcl script file
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.