mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-17 21:25:35 +00:00
Fill out full type information for dotnet
This commit is contained in:
parent
0d88911a53
commit
1cdc6c004c
@ -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):
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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 }}
|
||||
|
12
autoapi/templates/dotnet/constructor.rst
Normal file
12
autoapi/templates/dotnet/constructor.rst
Normal 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 }}
|
15
autoapi/templates/dotnet/delegate.rst
Normal file
15
autoapi/templates/dotnet/delegate.rst
Normal 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 }}
|
13
autoapi/templates/dotnet/enum.rst
Normal file
13
autoapi/templates/dotnet/enum.rst
Normal 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 }}
|
13
autoapi/templates/dotnet/interface.rst
Normal file
13
autoapi/templates/dotnet/interface.rst
Normal 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 }}
|
12
autoapi/templates/dotnet/method.rst
Normal file
12
autoapi/templates/dotnet/method.rst
Normal 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 }}
|
@ -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 %}
|
12
autoapi/templates/dotnet/property.rst
Normal file
12
autoapi/templates/dotnet/property.rst
Normal 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 }}
|
15
autoapi/templates/dotnet/struct.rst
Normal file
15
autoapi/templates/dotnet/struct.rst
Normal 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 }}
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user