diff --git a/autoapi/base.py b/autoapi/base.py index 32d3858..b7a9e02 100644 --- a/autoapi/base.py +++ b/autoapi/base.py @@ -27,7 +27,11 @@ class AutoAPIBase(object): ) def get_context_data(self): - return self.__dict__ + context = {} + # TODO deprecate this, it doesn't handle things like class variables + context.update(self.__dict__) + context['object'] = self + return context class UnknownType(AutoAPIBase): diff --git a/autoapi/domains/dotnet.py b/autoapi/domains/dotnet.py index 2716422..2f67ec4 100644 --- a/autoapi/domains/dotnet.py +++ b/autoapi/domains/dotnet.py @@ -230,63 +230,63 @@ class DotNetBase(AutoAPIBase): class DotNetNamespace(DotNetBase): type = 'namespace' - reftype = 'ns' + ref_type = 'ns' class DotNetMethod(DotNetBase): type = 'method' - reftype = 'meth' + ref_type = 'meth' class DotNetProperty(DotNetBase): type = 'property' - reftype = 'prop' + ref_type = 'prop' class DotNetEnum(DotNetBase): type = 'enum' - reftype = 'enum' + ref_type = 'enum' class DotNetStruct(DotNetBase): type = 'struct' - reftype = 'struct' + ref_type = 'struct' class DotNetConstructor(DotNetBase): type = 'constructor' - reftype = 'ctor' + ref_type = 'ctor' class DotNetInterface(DotNetBase): type = 'interface' - reftype = 'iface' + ref_type = 'iface' class DotNetDelegate(DotNetBase): type = 'delegate' - reftype = 'del' + ref_type = 'del' class DotNetClass(DotNetBase): type = 'class' - reftype = 'cls' + ref_type = 'cls' class DotNetField(DotNetBase): type = 'field' - reftype = 'field' + ref_type = 'field' class DotNetEvent(DotNetBase): type = 'event' - reftype = 'event' + ref_type = 'event' class DotNetVirtualNamespace(AutoAPIBase): language = 'dotnet' type = 'namespace' - reftype = 'ns' + ref_type = 'ns' def __init__(self, name, objs): self.name = self.short_name = name diff --git a/autoapi/templates/dotnet/base_detail.rst b/autoapi/templates/dotnet/base_detail.rst index 78b4c97..9f4582e 100644 --- a/autoapi/templates/dotnet/base_detail.rst +++ b/autoapi/templates/dotnet/base_detail.rst @@ -1,9 +1,9 @@ {% block title %} -{{ short_name }} {{ type.title()}} -{{ "=" * (short_name|length + type|length + 1) }} +{{ short_name }} {{ object.type.title()}} +{{ "=" * (short_name|length + object.type|length + 1) }} -.. dn:{{ type.lower().replace('struct', 'structure').replace('enum', 'enumeration') }}:: {{ name }} +.. dn:{{ object.type }}:: {{ name }} {% endblock %} diff --git a/autoapi/templates/dotnet/base_embed.rst b/autoapi/templates/dotnet/base_embed.rst index d9307c6..24c3468 100644 --- a/autoapi/templates/dotnet/base_embed.rst +++ b/autoapi/templates/dotnet/base_embed.rst @@ -1,4 +1,4 @@ -.. dn:{{ type.lower() }}:: {{ name }} +.. dn:{{ object.type }}:: {{ name }} {% if summary %} diff --git a/autoapi/templates/dotnet/base_list.rst b/autoapi/templates/dotnet/base_list.rst index 9e2203d..d699f20 100644 --- a/autoapi/templates/dotnet/base_list.rst +++ b/autoapi/templates/dotnet/base_list.rst @@ -1,9 +1,9 @@ {% block title %} -{{ short_name }} {{ type.title()}} -{{ "=" * (short_name|length + type|length + 1) }} +{{ short_name }} {{ object.type.title()}} +{{ "=" * (short_name|length + object.type|length + 1) }} -.. dn:{{ type.lower() }}:: {{ name }} +.. dn:{{ object.type }}:: {{ name }} {% endblock %} @@ -34,7 +34,7 @@ - Description {%- for item in children %} {% macro render() %}{{ item.summary }}{% endmacro %} - * - :dn:{{ item.reftype }}:`{{ item.id }}` + * - :dn:{{ item.ref_type }}:`{{ item.id }}` - {{ render()|indent(7) }} {% endfor %}