Push template type call to class variable

This commit is contained in:
Anthony Johnson 2015-04-14 16:24:57 -07:00
parent 4b13bebc8e
commit c4c16d6bf4
5 changed files with 25 additions and 21 deletions

View File

@ -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):

View File

@ -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

View File

@ -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 %}

View File

@ -1,4 +1,4 @@
.. dn:{{ type.lower() }}:: {{ name }}
.. dn:{{ object.type }}:: {{ name }}
{% if summary %}

View File

@ -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 %}