2015-04-22 23:08:49 +00:00
|
|
|
Templates
|
|
|
|
---------
|
|
|
|
|
|
|
|
A lot of the power from AutoAPI comes from templates.
|
|
|
|
We are basically building a mapping from Code to Docs,
|
|
|
|
and templates let you highly customize the display of said docs.
|
|
|
|
|
|
|
|
Structure
|
|
|
|
~~~~~~~~~
|
|
|
|
|
2017-05-04 04:01:50 +00:00
|
|
|
Every type of data structure gets its own template.
|
2015-04-22 23:08:49 +00:00
|
|
|
It uses the form :samp:`{language}/{type}.rst` to find the template to render.
|
|
|
|
The full search path is:
|
|
|
|
|
|
|
|
* :samp:`{language}/{type}.rst`
|
2015-04-22 23:19:51 +00:00
|
|
|
* :samp:`{language}/unknown.rst`
|
|
|
|
* :samp:`base/unknown.rst`
|
2015-04-22 23:08:49 +00:00
|
|
|
|
|
|
|
So for a .Net Class, this would resolve to:
|
|
|
|
|
|
|
|
* :samp:`{dotnet}/{class}.rst`
|
2015-04-22 23:19:51 +00:00
|
|
|
* :samp:`{dotnet}/unknown.rst`
|
|
|
|
* :samp:`base/unknown.rst`
|
2015-04-22 23:08:49 +00:00
|
|
|
|
2015-04-22 23:10:53 +00:00
|
|
|
We provide :samp:`base/member.rst` as an incredibly basic output of every object::
|
|
|
|
|
|
|
|
.. {language}:{type}:: {name}
|
2015-04-22 23:08:49 +00:00
|
|
|
|
|
|
|
Context
|
|
|
|
~~~~~~~
|
|
|
|
|
|
|
|
Every template will be given a set context. It will contain:
|
|
|
|
|
2015-05-29 22:48:58 +00:00
|
|
|
* `obj`: A Python object derived from
|
2015-04-22 23:08:49 +00:00
|
|
|
|
|
|
|
This object has a number of standard attributes you can reliably access:
|
|
|
|
|
|
|
|
* **id** - A unique identifier
|
|
|
|
* **type** - The objects type, lowercase
|
|
|
|
* **name** - A user displayable name
|
|
|
|
* **item_map** - A dict with keys containing the types this object has as children, and values of those objects.
|