sphinx-java-autodoc 0.4.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/PKG-INFO +1 -1
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/schema.md +5 -2
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/usage.rst +2 -1
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/pyproject.toml +1 -1
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/domain.py +23 -6
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/extractor.py +1 -1
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_integration.py +25 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/visual_check.py +13 -2
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/.gitignore +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/CONTRIBUTING.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/LICENSE +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/README.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/SECURITY.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/adr/0001-jdk-doclet-xml-sphinx-domain.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/agents/domain.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/agents/issue-tracker.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/alternatives.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/build-integration.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/compatibility.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/conf.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/design.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/comments.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/declarations.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/directives.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/index.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/inheritance.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/links.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/gallery/warnings.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/getting-started.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/guide.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/index.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/javadoc-support.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/performance.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/showcase.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/docs/troubleshooting.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/README.md +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/build-consumer/BuildInfo.java.in +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/build-consumer/src/demo/Consumer.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/dependency/src/vendor/Token.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/gradle/build.gradle +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/gradle/settings.gradle +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/maven/pom.xml +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/docs/conf.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/docs/guide.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/docs/index.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/docs/reference.rst +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Label.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Mode.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Point.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Shape.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Transformer.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Widget.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/package-info.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/__init__.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/__main__.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/java/SphinxDoclet.java +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/javadoc.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/model.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/pages.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/render.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/static/java-autodoc.css +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/benchmark.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/build_tools_check.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_boundaries.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_conformance.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_generic_throws.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_javadoc.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_navigation.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_options.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_signatures.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_snippets.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_sourcepath.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_tables.py +0 -0
- {sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/tests/test_value.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sphinx-java-autodoc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Compiler-backed Java API documentation in native Sphinx nodes
|
|
5
5
|
Project-URL: Documentation, https://r4sky0.github.io/sphinx-java-autodoc/
|
|
6
6
|
Project-URL: Repository, https://github.com/r4sky0/sphinx-java-autodoc
|
|
@@ -71,8 +71,11 @@ Identity examples: `example.Outer.Inner`, `example.Outer#FIELD`,
|
|
|
71
71
|
Parameters in canonical IDs are fully qualified erased types; varargs use `[]`.
|
|
72
72
|
External Javadoc fragments instead preserve declared type variables and use `...`
|
|
73
73
|
for varargs, as verified against the standard doclet. Return types and
|
|
74
|
-
parameter names do not affect IDs. HTML anchors are `java
|
|
75
|
-
|
|
74
|
+
parameter names do not affect IDs. HTML anchors are `java:` plus the ID, with `#`
|
|
75
|
+
replaced by `-` and `<init>` by `new`, as in `java:example.Outer-find(java.lang.String,int[])`
|
|
76
|
+
and `java:example.Outer-new()`. They are deterministic, reversible and collision-free:
|
|
77
|
+
docutils never generates `:` in IDs, Java names never contain `-`, and the keyword
|
|
78
|
+
`new` cannot name a method.
|
|
76
79
|
|
|
77
80
|
Declarations and diagnostics are sorted; no build timestamp or source path is
|
|
78
81
|
stored. Renderers derive a declaration's file from its package and top-level type
|
|
@@ -154,7 +154,8 @@ source root, such as ``com/example/Widget.java``) and ``line``:
|
|
|
154
154
|
f"{info['source']}#L{info['line']}"
|
|
155
155
|
)
|
|
156
156
|
|
|
157
|
-
``line`` is empty for compiler-generated members, such as an enum's
|
|
157
|
+
``line`` is empty for packages and for compiler-generated members, such as an enum's
|
|
158
|
+
``values()``.
|
|
158
159
|
With several source roots, choose the root in ``linkcode_resolve``, for example by
|
|
159
160
|
checking which root contains ``source``.
|
|
160
161
|
|
|
@@ -29,7 +29,9 @@ LOGGER = logging.getLogger(__name__)
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def anchor(symbol: str) -> str:
|
|
32
|
-
|
|
32
|
+
# Docutils IDs never contain ":", Java names never contain "-", and the keyword
|
|
33
|
+
# "new" cannot name a method, so these readable anchors cannot collide.
|
|
34
|
+
return "java:" + symbol.replace("#<init>(", "#new(").replace("#", "-")
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
def role_for(element):
|
|
@@ -304,13 +306,28 @@ class AutoPackage(JavaDirective):
|
|
|
304
306
|
self.missing("package", package, "package")
|
|
305
307
|
return []
|
|
306
308
|
domain = self.env.get_domain("java")
|
|
307
|
-
target =
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
target = anchor(package)
|
|
310
|
+
# Javadoc's package pages open with this declaration; as an object description,
|
|
311
|
+
# the package's notes and fields look like those of its types in every theme.
|
|
312
|
+
desc = addnodes.desc(
|
|
313
|
+
"",
|
|
314
|
+
domain="java",
|
|
315
|
+
objtype="package",
|
|
316
|
+
desctype="package",
|
|
317
|
+
classes=["java", "package"],
|
|
318
|
+
)
|
|
319
|
+
sig = addnodes.desc_signature("", "", ids=[target], fullname=package)
|
|
320
|
+
sig += addnodes.desc_sig_keyword("package", "package")
|
|
321
|
+
sig += addnodes.desc_sig_space()
|
|
322
|
+
sig += addnodes.desc_name(package, package)
|
|
323
|
+
self.state.document.note_explicit_target(sig)
|
|
324
|
+
desc += sig
|
|
325
|
+
desc += addnodes.desc_content("", *documentation(element, self.get_location()))
|
|
326
|
+
domain.data["objects"][package] = (self.env.docname, target, "package")
|
|
310
327
|
index = addnodes.index(
|
|
311
|
-
entries=[("single", f"{package} (Java package)",
|
|
328
|
+
entries=[("single", f"{package} (Java package)", target, "", None)]
|
|
312
329
|
)
|
|
313
|
-
return [index,
|
|
330
|
+
return [index, desc]
|
|
314
331
|
|
|
315
332
|
|
|
316
333
|
class AutoSummary(JavaDirective):
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/src/sphinx_java_autodoc/extractor.py
RENAMED
|
@@ -16,7 +16,7 @@ from sphinx.errors import ExtensionError
|
|
|
16
16
|
|
|
17
17
|
from .model import Model, read_model
|
|
18
18
|
|
|
19
|
-
VERSION = "0.
|
|
19
|
+
VERSION = "0.5.0" # x-release-please-version
|
|
20
20
|
DOCLET = Path(__file__).parent / "java" / "SphinxDoclet.java"
|
|
21
21
|
PACKAGE = re.compile(r"[^\W\d]\w*(?:\.[^\W\d]\w*)*")
|
|
22
22
|
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
import re
|
|
5
6
|
import shutil
|
|
6
7
|
import subprocess
|
|
7
8
|
import sys
|
|
@@ -142,6 +143,30 @@ def test_semantic_extraction(model):
|
|
|
142
143
|
)
|
|
143
144
|
|
|
144
145
|
|
|
146
|
+
def test_package_page_declares_the_package(site):
|
|
147
|
+
_, out = site
|
|
148
|
+
package = (out / "api/package-demo.html").read_text()
|
|
149
|
+
# Like Javadoc, the package page declares the package; its notes sit in the description.
|
|
150
|
+
declaration = re.search(r'<dl class="java package">(.*?)</dl>', package, re.S)[1]
|
|
151
|
+
assert f'id="{anchor("demo")}"' in declaration and "Example API." in declaration
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def test_anchors_are_readable_and_unique(site):
|
|
155
|
+
_, out = site
|
|
156
|
+
assert anchor("demo.Widget#convert(int)") == "java:demo.Widget-convert(int)"
|
|
157
|
+
assert anchor("demo.Widget#<init>(java.lang.String)") == (
|
|
158
|
+
"java:demo.Widget-new(java.lang.String)"
|
|
159
|
+
)
|
|
160
|
+
widget = (out / "api/type-demo.Widget.html").read_text()
|
|
161
|
+
assert 'id="java:demo.Widget-new(java.lang.String)"' in widget
|
|
162
|
+
# The package's anchor must not clash with the section ID docutils derives from its title.
|
|
163
|
+
package = (out / "api/package-demo.html").read_text()
|
|
164
|
+
assert 'id="java:demo"' in package and 'id="demo"' in package
|
|
165
|
+
for page in (out / "api").glob("*.html"):
|
|
166
|
+
ids = re.findall(r'\sid="([^"]+)"', page.read_text())
|
|
167
|
+
assert len(ids) == len(set(ids)), page.name
|
|
168
|
+
|
|
169
|
+
|
|
145
170
|
def test_html_links_structure_inventory_search(site):
|
|
146
171
|
docs, out = site
|
|
147
172
|
html = (out / "api/type-demo.Widget.html").read_text()
|
|
@@ -63,14 +63,25 @@ def main():
|
|
|
63
63
|
theme_width,
|
|
64
64
|
page.evaluate("document.documentElement.scrollWidth"),
|
|
65
65
|
)
|
|
66
|
+
# Anchors contain ":" and "(", which theme scripts must accept.
|
|
66
67
|
page.goto(
|
|
67
|
-
base
|
|
68
|
+
base
|
|
69
|
+
+ "/api/type-demo.Widget.html#java:demo.Widget-convert(int)",
|
|
70
|
+
wait_until="networkidle",
|
|
71
|
+
)
|
|
72
|
+
# Some themes scroll smoothly; wait until the target is in view.
|
|
73
|
+
page.wait_for_function(
|
|
74
|
+
"""() => {
|
|
75
|
+
const id = decodeURIComponent(location.hash.slice(1));
|
|
76
|
+
const top = document.getElementById(id).getBoundingClientRect().top;
|
|
77
|
+
return top > -1 && top < innerHeight;
|
|
78
|
+
}"""
|
|
68
79
|
)
|
|
69
80
|
assert page.locator("dl.java").count() >= 8
|
|
70
81
|
assert page.locator("h2", has_text="Constructors").count() == 1
|
|
71
82
|
assert page.locator("pre").count() > 0
|
|
72
83
|
assert page.locator("dl.java ul li ol li").count() == 2
|
|
73
|
-
assert page.locator('a[href^="#java
|
|
84
|
+
assert page.locator('a[href^="#java:"]').count() > 0
|
|
74
85
|
lines = page.locator("dl.java .line-block > .line")
|
|
75
86
|
assert lines.all_text_contents() == [
|
|
76
87
|
"First line",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/build-consumer/BuildInfo.java.in
RENAMED
|
File without changes
|
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/dependency/src/vendor/Token.java
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/docs/reference.rst
RENAMED
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Label.java
RENAMED
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Mode.java
RENAMED
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Point.java
RENAMED
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Shape.java
RENAMED
|
File without changes
|
|
File without changes
|
{sphinx_java_autodoc-0.4.0 → sphinx_java_autodoc-0.5.0}/examples/standalone/src/demo/Widget.java
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|