Fix Go documentation generation (#172)
* Correction of the "parameters" accessibility problem in the Go mapper The "parameters" attributes of the GoPythonMapper class instance was not accessible from the "output_rst" function used to create the .rst file. Thanks to this correction, the parameters are now accessible. * Enhance the template used to genertae the .rst file from the .go source file This modification allows to create a .rst file compatible with the last version of Sphinx. Without this correction, the creation of documentation was not possible. A "make html" command lead to an "AssertionError" Exception.pull/174/head
parent
be324b10bf
commit
fa3b0b3f70
@ -1,26 +1,32 @@
|
|||||||
.. go:{{ obj.ref_type }}:: {{ obj.name }}
|
|
||||||
{% if obj.type == 'func' %}
|
{% if obj.type == 'func' %}
|
||||||
|
{# Creating the parameters line #}
|
||||||
|
{% set ns = namespace(tmpstring='') %}
|
||||||
{% set argjoin = joiner(', ') %}
|
{% set argjoin = joiner(', ') %}
|
||||||
({% for param in obj.parameters %}
|
{% for param in obj.parameters %}
|
||||||
{{ argjoin() }}{{ param.name }} {{ param.type }}
|
{% set ns.tmpstring = ns.tmpstring ~ argjoin() ~ param.name ~ ' ' ~ param.type %}
|
||||||
{% endfor %})
|
{% endfor %}
|
||||||
|
.. {{ obj.ref_type }}:: {{ obj.name }}({{ ns.tmpstring }})
|
||||||
|
{% else %}
|
||||||
|
.. go:{{ obj.ref_type }}:: {{ obj.name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% macro render() %}{{ obj.docstring }}{% endmacro %}
|
{% macro render() %}{{ obj.docstring }}{% endmacro %}
|
||||||
{{ render()|indent(4) }}
|
{{ render()|indent(4) }}
|
||||||
|
|
||||||
{# Don't define parameter description here, that can be done in the block
|
{# Don't define parameter description here, that can be done in the block
|
||||||
above #}
|
above #}
|
||||||
{% for param in obj.parameters %}
|
{% for param in obj.parameters %}
|
||||||
:type {{ param.name }}: {{ param.type }}
|
:param {{ param.name }}:
|
||||||
{% endfor %}
|
:type {{ param.name }}: {{ param.type }}
|
||||||
{% if obj.returns %}
|
{% endfor %}
|
||||||
:rtype: {{ obj.returns.type }}
|
{% if obj.returns %}
|
||||||
{% endif %}
|
:rtype: {{ obj.returns.type }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if obj.children %}
|
{% if obj.children %}
|
||||||
{% for child in obj.children|sort %}
|
{% for child in obj.children|sort %}
|
||||||
{% macro render_child() %}{{ child.render() }}{% endmacro %}
|
{% macro render_child() %}{{ child.render() }}{% endmacro %}
|
||||||
{{ render_child()|indent(4) }}
|
{{ render_child()|indent(4) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue