diff --git a/autoapi/templates/go/base_member.rst b/autoapi/templates/go/base_member.rst new file mode 100644 index 0000000..98be031 --- /dev/null +++ b/autoapi/templates/go/base_member.rst @@ -0,0 +1,11 @@ +.. go:{{ obj.ref_type }}:: {{ obj.name }} + + {%- for param in obj.parameters %} + :param {{ param.name }}: {{ param.desc }} + {%- if param.type %} + :type {{ param.name }}: {{ param.type }} + {%- endif %} + {%- endfor %} + {%- if obj.returns %} + :rtype: {{ obj.returns.id }} + {%- endif %} diff --git a/autoapi/templates/go/const.rst b/autoapi/templates/go/const.rst new file mode 100644 index 0000000..0466355 --- /dev/null +++ b/autoapi/templates/go/const.rst @@ -0,0 +1 @@ +{% extends "go/base_member.rst" %} diff --git a/autoapi/templates/go/function.rst b/autoapi/templates/go/function.rst new file mode 100644 index 0000000..0466355 --- /dev/null +++ b/autoapi/templates/go/function.rst @@ -0,0 +1 @@ +{% extends "go/base_member.rst" %} diff --git a/autoapi/templates/go/method.rst b/autoapi/templates/go/method.rst new file mode 100644 index 0000000..0466355 --- /dev/null +++ b/autoapi/templates/go/method.rst @@ -0,0 +1 @@ +{% extends "go/base_member.rst" %} diff --git a/autoapi/templates/go/package.rst b/autoapi/templates/go/package.rst new file mode 100644 index 0000000..09cfd02 --- /dev/null +++ b/autoapi/templates/go/package.rst @@ -0,0 +1,25 @@ +.. go:package:: {{ obj.name }} + +{% block toc %} + {%- if obj.children %} + +.. toctree:: + :maxdepth: 4 + + {% for item in obj.children|sort %} + /autoapi/{{ item.id.split('.')|join('/') }}/index + {%- endfor %} + + {%- endif %} +{% endblock %} + +{% if obj.docstring %} +{{ obj.docstring }} +{% endif %} + +{% block content %} + {%- for obj_item in obj.item_map.get(item_type, []) %} +{% macro render() %}{{ obj_item.render() }}{% endmacro %} + {{ render()|indent(4) }} + {%- endfor %} +{% endblock %} diff --git a/autoapi/templates/go/type.rst b/autoapi/templates/go/type.rst new file mode 100644 index 0000000..0466355 --- /dev/null +++ b/autoapi/templates/go/type.rst @@ -0,0 +1 @@ +{% extends "go/base_member.rst" %} diff --git a/autoapi/templates/go/var.rst b/autoapi/templates/go/var.rst new file mode 100644 index 0000000..0466355 --- /dev/null +++ b/autoapi/templates/go/var.rst @@ -0,0 +1 @@ +{% extends "go/base_member.rst" %}