Filters for generating docs. All filters in this module will be available in the template’s global namespace as ln.html.

nunavut.lang.html.filter_extent(instance: pydsdl._expression._any.Any) → int[source]
nunavut.lang.html.filter_max_bit_length(instance: pydsdl._expression._any.Any) → int[source]
nunavut.lang.html.filter_tag_id(instance: pydsdl._expression._any.Any) → str[source]
nunavut.lang.html.filter_url_from_type(instance: pydsdl._expression._any.Any) → str[source]
nunavut.lang.html.filter_make_unique(_: Any, base_token: str) → str[source]

Filter that takes a base token and forms a name that is very likely to be unique within the template the filter is invoked.


The exact tokens generated may change between major or minor versions of this library. The only guarantee provided is that the tokens will be stable for the same version of this library given the same input.

Also note that name uniqueness is only likely within a given template. Between templates there is no guarantee of uniqueness and, since this library does not lex generated source, there is no guarantee that the generated name does not conflict with a name generated by another means.

# Given
template  = '{{ "foo" | make_unique }},{{ "Foo" | make_unique }},'
template += '{{ "fOO" | make_unique }}'

# then
rendered = 'foo0,foo1,fOO0'
# Given
template = '{{ "coffee > tea" | make_unique }}'

# then
rendered = 'coffee > tea0'
Parameters:base_token (str) – A token to include in the base name.
Returns:A name that is likely to be unique within the file generated by the current template.
nunavut.lang.html.filter_namespace_doc(ns: nunavut.Namespace) → str[source]
nunavut.lang.html.filter_display_type(instance: pydsdl._expression._any.Any) → str[source]
nunavut.lang.html.filter_natural_sort_namespace(instance: List[pydsdl._expression._any.Any]) → List[pydsdl._expression._any.Any][source]

Namespaces come in plain lists; sort by name only.

nunavut.lang.html.filter_natural_sort_type(instance: pydsdl._expression._any.Any) → List[pydsdl._expression._any.Any][source]

Types come in tuples (type, path). Sort by type name.