-
Notifications
You must be signed in to change notification settings - Fork 2
Template API Helper Functions
- Capitalize Function
- Create Anchor to Type Function
- Create Link to Type Function
- Create Partial Function
- Display Sidebar Function
- Get ID From Function
- Get Parameter Type Function
- Is Generic Type Function
The following subsections are functions that can be used in template files to help with things such as creating hypertext links to external and internal types.
capitalize as (function): Capitalizes the given string, turning hello-world to Hello World.
function capitalize(val) { ... }-
Parameter:
valas (string): The value used to capitalize. - Returns: Returns the capitalized string.
createAnchorToType as (function): Creates an anchor tag to the type (includes using the type name).
function createAnchorToType(typeInfo, options) { ... }
function createAnchorToType(typeInfo) { ... }-
Parameter:
typeInfoas (QuickTypeInfo): The quick look into the type to look into. -
Parameter:
optionsas (any): Extra options to apply to the returning anchor type. The following options are used:-
classesas (string): The list of classes to apply to the returning tag, seperated by spaces. -
useFullNameas (boolean): Set to true if the content of the anchor will use the full name instead of just the shortened name.
-
- Returns: Returns an anchor tag to the type with a link.
createLinkToType as (function): Creates a internal or external link to the given type.
function createLinkToType(typePath) { ... }-
Parameter:
typePathas (string): The type path to create a link from. - Returns: Returns an http(s) link to where the type is found.
createPartial as (function): Creates a partial using the type and location to the template file.
function createPartial(type, url, context) { ... }-
Parameter:
typeas (string): The type to create from (type, field, property, event, method). -
Parameter:
urlas (string): The location of the template file to use. -
Parameter:
contextas (any): The context used to pass over to the next template. - Returns: Returns the compiled template code.
displaySidebar as (function): Generates the html code for the sidebar tree view. This will only be available for navigation templates.
function displaySidebar(treeview, treeviewClass, nestedViewClass) { ... }
function displaySidebar(treeview, treeviewClass) { ... }
function displaySidebar(treeview) { ... }-
Parameter:
treeviewas (Sideview or SidebarView[]): The sidebar tree view to traverse through and generate with. -
Parameter:
treeviewClassas (string): The class name for the top view of the list items. Defaults to "treeview". -
Parameter:
nestedviewClassas (string): The class name for the nested view of the list items. Defaults to "nested". - Returns: Returns the html code for the sidebar tree view.
getIdFrom as (function): Gets the id from the given details.
function getIdFrom(details) { ... }-
Parameter:
detailsas (FieldInfo or PropertyInfo or EventInfo or MethodInfo): The details to look into. - Returns: Returns the id used for anchoring and referencing.
getParameterType as (function): Gets the parameter type from the given name.
function getParameterType(parameters, name) { ... }-
Parameter:
parametersas (ParameterInfo[]): The list of parameters to look into. -
Parameter:
nameas (string): The name of the parameter to look into. - Returns: Returns the type info of the parameter.
isGenericType as (function): Finds if the given parameter's type is a generic type.
function isGenericType(parameter, xmlDocs) { ... }-
Parameter:
parameteras (ParameterNameDescription): The parameter to look into. -
Parameter:
xmlDocsas (XmlDocItems): The xml docs to look into. - Returns: Returns true if the parameter's type is generic.