Explicitly use the domain for generated directives

Closes #292
pull/300/head
Ashley Whetter 3 years ago
parent 26b7d729a2
commit 2c5c87157a

@ -6,10 +6,22 @@ Versions follow `Semantic Versioning <https://semver.org/>`_ (``<major>.<minor>.
v1.8.2 (TBC)
-------------------
Features
^^^^^^^^
* `#292 <https://github.com/readthedocs/sphinx-autoapi/issues/292>`:
Explicitly use the domain for generated directives.
Bug Fixes
^^^^^^^^^
* Fixed error when parsing a class with no constructor.
* `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`:
Fixed failure to build out of source conf.py files.
Configuration values using relative values are now relative to the source directory
instead of relative to the conf.py file.
* `#289 <https://github.com/readthedocs/sphinx-autoapi/issues/289>`: (Python)
Fixed AttributeError using inheritance diagrams on a module with plain imports.
v1.8.1 (2021-04-24)
@ -115,12 +127,6 @@ Bug Fixes
Fixed an unnecessary deprecation warning being raised when running
sphinx-build from the same directory as conf.py.
* (Python) Fixed properties documented by Autodoc directives geting documented as methods.
* `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`:
Fixed failure to build out of source conf.py files.
Configuration values using relative values are now relative to the source directory
instead of relative to the conf.py file.
* `#289 <https://github.com/readthedocs/sphinx-autoapi/issues/289>`: (Python)
Fixed AttributeError using inheritance diagrams on a module with plain imports.
V1.5.1 (2020-10-01)

@ -5,7 +5,7 @@
{% for param in obj.parameters %}
{% set ns.tmpstring = ns.tmpstring ~ argjoin() ~ param.name ~ ' ' ~ param.type %}
{% endfor %}
.. {{ obj.ref_type }}:: {{ obj.name }}({{ ns.tmpstring }})
.. go:{{ obj.ref_type }}:: {{ obj.name }}({{ ns.tmpstring }})
{% else %}
.. go:{{ obj.ref_type }}:: {{ obj.name }}
{% endif %}

@ -2,9 +2,9 @@
{% if is_method %}
{# Slice self off #}
.. method:: {{ obj.name.split('.')[-1] }}({{ args[1:]|join(',') }})
.. js:method:: {{ obj.name.split('.')[-1] }}({{ args[1:]|join(',') }})
{% else %}
.. function:: {{ obj.name.split('.')[-1] }}({{ args|join(',') }})
.. js:function:: {{ obj.name.split('.')[-1] }}({{ args|join(',') }})
{% endif %}
{% if obj.docstring %}

@ -1,6 +1,6 @@
{# Identention in this file is important #}
.. {{ obj.type }}:: {{ obj.name }}
.. js:{{ obj.type }}:: {{ obj.name }}
{{ obj.docstring|indent(3) }}

@ -1,5 +1,5 @@
{% if obj.display %}
.. {{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}
.. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}
{% for (args, return_annotation) in obj.overloads %}
{{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %}
{% endfor %}

@ -1,5 +1,5 @@
{% if obj.display %}
.. {{ obj.type }}:: {{ obj.name }}
.. py:{{ obj.type }}:: {{ obj.name }}
{%+ if obj.value is not none or obj.annotation is not none -%}
:annotation:
{%- if obj.annotation %} :{{ obj.annotation }}

@ -1,5 +1,5 @@
{% if obj.display %}
.. function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
.. py:function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
{% for (args, return_annotation) in obj.overloads %}
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}

@ -1,6 +1,6 @@
{%- if obj.display %}
{% if sphinx_version >= (2, 1) %}
.. method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
.. py:method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
{% for (args, return_annotation) in obj.overloads %}
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}
@ -15,7 +15,7 @@
{% endif %}
{% else %}
.. {{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }})
.. py:{{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }})
{% for (args, return_annotation) in obj.overloads %}
{{ " " * (obj.method_type | length) }} {{ obj.short_name }}({{ args }})
{% endfor %}

@ -2,8 +2,8 @@
:orphan:
{% endif %}
:mod:`{{ obj.name }}`
======={{ "=" * obj.name|length }}
:py:mod:`{{ obj.name }}`
=========={{ "=" * obj.name|length }}
.. py:module:: {{ obj.name }}

@ -132,6 +132,29 @@ class TestMovedConfPy(TestSimpleModule):
)
class TestSimpleModuleDifferentPrimaryDomain:
@pytest.fixture(autouse=True, scope="class")
def built(self, builder):
builder(
"pyexample",
warningiserror=True,
confoverrides={
"autoapi_options": [
"members",
"undoc-members",
"private-members",
"special-members",
"imported-members",
],
"primary_domain": "cpp",
"suppress_warnings": ["app"],
},
)
def test_success(self):
pass
class TestSimpleStubModule:
@pytest.fixture(autouse=True, scope="class")
def built(self, builder):
@ -725,6 +748,9 @@ class TestComplexPackageParallel:
def built(self, builder):
builder("pypackagecomplex", parallel=2)
def test_success(self):
pass
def test_caching(builder):
mtimes = (0, 0)
@ -825,7 +851,7 @@ def test_string_module_attributes(builder):
example_file = example_handle.read()
code_snippet_contents = [
".. data:: code_snippet",
".. py:data:: code_snippet",
" :annotation: = Multiline-String",
"",
" .. raw:: html",

Loading…
Cancel
Save