Skip to content

Commit 2c5c871

Browse files
committed
Explicitly use the domain for generated directives
Closes #292
1 parent 26b7d72 commit 2c5c871

File tree

10 files changed

+50
-18
lines changed

10 files changed

+50
-18
lines changed

CHANGELOG.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ Versions follow `Semantic Versioning <https://semver.org/>`_ (``<major>.<minor>.
66
v1.8.2 (TBC)
77
-------------------
88

9+
Features
10+
^^^^^^^^
11+
12+
* `#292 <https://github.com/readthedocs/sphinx-autoapi/issues/292>`:
13+
Explicitly use the domain for generated directives.
14+
915
Bug Fixes
1016
^^^^^^^^^
1117

1218
* Fixed error when parsing a class with no constructor.
19+
* `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`:
20+
Fixed failure to build out of source conf.py files.
21+
Configuration values using relative values are now relative to the source directory
22+
instead of relative to the conf.py file.
23+
* `#289 <https://github.com/readthedocs/sphinx-autoapi/issues/289>`: (Python)
24+
Fixed AttributeError using inheritance diagrams on a module with plain imports.
1325

1426

1527
v1.8.1 (2021-04-24)
@@ -115,12 +127,6 @@ Bug Fixes
115127
Fixed an unnecessary deprecation warning being raised when running
116128
sphinx-build from the same directory as conf.py.
117129
* (Python) Fixed properties documented by Autodoc directives geting documented as methods.
118-
* `#293 <https://github.com/readthedocs/sphinx-autoapi/issues/293>`:
119-
Fixed failure to build out of source conf.py files.
120-
Configuration values using relative values are now relative to the source directory
121-
instead of relative to the conf.py file.
122-
* `#289 <https://github.com/readthedocs/sphinx-autoapi/issues/289>`: (Python)
123-
Fixed AttributeError using inheritance diagrams on a module with plain imports.
124130

125131

126132
V1.5.1 (2020-10-01)

autoapi/templates/go/base_member.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% for param in obj.parameters %}
66
{% set ns.tmpstring = ns.tmpstring ~ argjoin() ~ param.name ~ ' ' ~ param.type %}
77
{% endfor %}
8-
.. {{ obj.ref_type }}:: {{ obj.name }}({{ ns.tmpstring }})
8+
.. go:{{ obj.ref_type }}:: {{ obj.name }}({{ ns.tmpstring }})
99
{% else %}
1010
.. go:{{ obj.ref_type }}:: {{ obj.name }}
1111
{% endif %}

autoapi/templates/javascript/function.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
{% if is_method %}
44
{# Slice self off #}
5-
.. method:: {{ obj.name.split('.')[-1] }}({{ args[1:]|join(',') }})
5+
.. js:method:: {{ obj.name.split('.')[-1] }}({{ args[1:]|join(',') }})
66
{% else %}
7-
.. function:: {{ obj.name.split('.')[-1] }}({{ args|join(',') }})
7+
.. js:function:: {{ obj.name.split('.')[-1] }}({{ args|join(',') }})
88
{% endif %}
99

1010
{% if obj.docstring %}

autoapi/templates/javascript/member.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{# Identention in this file is important #}
22

3-
.. {{ obj.type }}:: {{ obj.name }}
3+
.. js:{{ obj.type }}:: {{ obj.name }}
44

55
{{ obj.docstring|indent(3) }}
66

autoapi/templates/python/class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if obj.display %}
2-
.. {{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}
2+
.. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}
33
{% for (args, return_annotation) in obj.overloads %}
44
{{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %}
55
{% endfor %}

autoapi/templates/python/data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if obj.display %}
2-
.. {{ obj.type }}:: {{ obj.name }}
2+
.. py:{{ obj.type }}:: {{ obj.name }}
33
{%+ if obj.value is not none or obj.annotation is not none -%}
44
:annotation:
55
{%- if obj.annotation %} :{{ obj.annotation }}

autoapi/templates/python/function.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if obj.display %}
2-
.. function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
2+
.. py:function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
33
44
{% for (args, return_annotation) in obj.overloads %}
55
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}

autoapi/templates/python/method.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{%- if obj.display %}
22
{% if sphinx_version >= (2, 1) %}
3-
.. method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
3+
.. py:method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %}
44
55
{% for (args, return_annotation) in obj.overloads %}
66
{{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %}
@@ -15,7 +15,7 @@
1515

1616
{% endif %}
1717
{% else %}
18-
.. {{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }})
18+
.. py:{{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }})
1919
{% for (args, return_annotation) in obj.overloads %}
2020
{{ " " * (obj.method_type | length) }} {{ obj.short_name }}({{ args }})
2121
{% endfor %}

autoapi/templates/python/module.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
:orphan:
33

44
{% endif %}
5-
:mod:`{{ obj.name }}`
6-
======={{ "=" * obj.name|length }}
5+
:py:mod:`{{ obj.name }}`
6+
=========={{ "=" * obj.name|length }}
77

88
.. py:module:: {{ obj.name }}
99

tests/python/test_pyintegration.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,29 @@ def built(self, builder):
132132
)
133133

134134

135+
class TestSimpleModuleDifferentPrimaryDomain:
136+
@pytest.fixture(autouse=True, scope="class")
137+
def built(self, builder):
138+
builder(
139+
"pyexample",
140+
warningiserror=True,
141+
confoverrides={
142+
"autoapi_options": [
143+
"members",
144+
"undoc-members",
145+
"private-members",
146+
"special-members",
147+
"imported-members",
148+
],
149+
"primary_domain": "cpp",
150+
"suppress_warnings": ["app"],
151+
},
152+
)
153+
154+
def test_success(self):
155+
pass
156+
157+
135158
class TestSimpleStubModule:
136159
@pytest.fixture(autouse=True, scope="class")
137160
def built(self, builder):
@@ -725,6 +748,9 @@ class TestComplexPackageParallel:
725748
def built(self, builder):
726749
builder("pypackagecomplex", parallel=2)
727750

751+
def test_success(self):
752+
pass
753+
728754

729755
def test_caching(builder):
730756
mtimes = (0, 0)
@@ -825,7 +851,7 @@ def test_string_module_attributes(builder):
825851
example_file = example_handle.read()
826852

827853
code_snippet_contents = [
828-
".. data:: code_snippet",
854+
".. py:data:: code_snippet",
829855
" :annotation: = Multiline-String",
830856
"",
831857
" .. raw:: html",

0 commit comments

Comments
 (0)