typesrenderer

Source   Edit  

Procs

proc renderOutType(n: PNode; toNormalize = false): string {.
    ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc renderParamNames(n: PNode; toNormalize = false): seq[string] {.
    ...raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}
Returns parameter names of routine n. Source   Edit  
proc renderParamTypes(found: var seq[string]; n: PNode; toNormalize = false) {.
    ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}

Recursive helper, adds to found any types, or keeps diving the AST.

The normal doc generator doesn't include .typ information, so the function won't render types for parameters with default values. The doc generator does include the information.

Source   Edit  
proc renderParamTypes(n: PNode; sep = defaultParamSeparator; toNormalize = false): string {.
    ...raises: [Exception, KeyError, ValueError], tags: [RootEffect], forbids: [].}

Returns the types contained in n joined by sep.

This proc expects to be passed as n the parameters of any callable. The string output is meant for the HTML renderer. If there are no parameters, the empty string is returned. The parameters will be joined by sep but other characters may appear too, like [] or |.

Source   Edit  
proc renderPlainSymbolName(n: PNode): string {....raises: [], tags: [], forbids: [].}

Returns the first non '*' nkIdent node from the tree.

Use this on documentation name nodes to extract the raw symbol name, without decorations, parameters, or anything. That can be used as the base for the HTML hyperlinks.

Source   Edit