Fill out full type information for dotnet

go-templates
Eric Holscher 10 years ago
parent 0d88911a53
commit 1cdc6c004c

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

@ -28,10 +28,33 @@ class DotNetNamespace(DotNetBase):
type = 'namespace' type = 'namespace'
header = '=' header = '='
def render(self, **kwargs): class DotNetMethod(DotNetBase):
ret = super(DotNetNamespace, self).render(**kwargs) type = 'method'
# import ipdb; ipdb.set_trace() header = '-'
return ret
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): class DotNetClass(object):

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

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

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

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

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

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

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

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

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

@ -1,5 +1,9 @@
from .base import UnknownType 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 from .python import PythonModule, PythonClass, PythonFunction
@ -19,4 +23,18 @@ def classify(obj, obj_type):
return DotNetClass(obj) return DotNetClass(obj)
if obj['type'] == 'Namespace': if obj['type'] == 'Namespace':
return DotNetNamespace(obj) 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) return UnknownType(obj)

Loading…
Cancel
Save