Fill out full type information for dotnet

This commit is contained in:
Eric Holscher 2015-04-07 23:42:06 -07:00
parent 0d88911a53
commit 1cdc6c004c
12 changed files with 149 additions and 26 deletions

View File

@ -17,7 +17,7 @@ class AutoAPIBase(object):
'{language}/{type}.rst'.format(language=self.language, type=self.type)
)
ctx.update(**self.obj)
return template.render(ctx)
return template.render(**ctx)
class UnknownType(AutoAPIBase):

View File

@ -28,10 +28,33 @@ class DotNetNamespace(DotNetBase):
type = 'namespace'
header = '='
def render(self, **kwargs):
ret = super(DotNetNamespace, self).render(**kwargs)
# import ipdb; ipdb.set_trace()
return ret
class DotNetMethod(DotNetBase):
type = 'method'
header = '-'
class DotNetProperty(DotNetBase):
type = 'property'
header = '-'
class DotNetEnum(DotNetBase):
type = 'enum'
header = '-'
class DotNetStruct(DotNetBase):
type = 'struct'
header = '-'
class DotNetConstructor(DotNetBase):
type = 'constructor'
header = '-'
class DotNetInterface(DotNetBase):
type = 'interface'
header = '-'
class DotNetDelegate(DotNetBase):
type = 'delegate'
header = '-'
class DotNetClass(object):

View File

@ -1,4 +1,11 @@
{# Identention in this file is important #}
(Generic Type -- {{ type }})
.. {{ type.lower() }}:: {{ name }}
{% if summary %}
{{ summary }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,12 @@
.. dn:{{ type.lower() }}:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,15 @@
{{ name.CSharp }}
{{ underline }}
.. dn:delegate:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,13 @@
{{ name.CSharp }}
{{ underline }}
.. dn:enumeration:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,13 @@
{{ name.CSharp }}
{{ underline }}
.. dn:{{ type.lower() }}:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,12 @@
.. dn:{{ type.lower() }}:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -1,17 +0,0 @@
{# Identention in this file is important #}
{% if methods %}
.. rubric:: Methods
{% for item in methods %}
.. method:: {{ item.qualifiedName.CSharp }}
.. code-block:: csharp
{{ item.syntax.content.CSharp }}
{%- endfor %}
{% endif %}

View File

@ -0,0 +1,12 @@
.. dn:{{ type.lower() }}:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -0,0 +1,15 @@
{{ name.CSharp }}
{{ underline }}
.. dn:structure:: {{ qualifiedName.CSharp }}
{% if summary %}
{% macro render() %}{{ summary }}{% endmacro %}
{{ render()|indent(4) }}
{% endif %}
.. code-block:: csharp
{{ syntax.content.CSharp }}

View File

@ -1,5 +1,9 @@
from .base import UnknownType
from .dotnet import DotNetNamespace, DotNetClass
from .dotnet import (
DotNetNamespace, DotNetClass, DotNetMethod, DotNetProperty,
DotNetEnum, DotNetConstructor, DotNetStruct, DotNetInterface,
DotNetDelegate
)
from .python import PythonModule, PythonClass, PythonFunction
@ -19,4 +23,18 @@ def classify(obj, obj_type):
return DotNetClass(obj)
if obj['type'] == 'Namespace':
return DotNetNamespace(obj)
if obj['type'] == 'Property':
return DotNetProperty(obj)
if obj['type'] == 'Method':
return DotNetMethod(obj)
if obj['type'] == 'Enum':
return DotNetEnum(obj)
if obj['type'] == 'Constructor':
return DotNetConstructor(obj)
if obj['type'] == 'Struct':
return DotNetStruct(obj)
if obj['type'] == 'Interface':
return DotNetInterface(obj)
if obj['type'] == 'Delegate':
return DotNetDelegate(obj)
return UnknownType(obj)