sphinx-javadoc-xml 0.3.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.
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 (2025-xx-xx)
4
+
5
+ - Full support for interfaces as top-level type definitions
6
+ - Type parameters with bounds (`<T extends Expression>`)
7
+ - Bounded wildcards (`? extends X`, `? super Y`)
8
+ - Exception declarations (`throws`)
9
+ - Enum constant comments, tags, and annotations
10
+ - Cross-linking to OpenJDK Javadoc for standard library types
11
+ - Internal cross-references between defined types
12
+ - New `javadoc-package` directive for package summaries
13
+ - New `:jdk-url:` option to configure JDK Javadoc base URL
14
+ - New `javadoc_jdk_url` config value in `conf.py`
15
+ - Proper PyPI packaging with classifiers and metadata
16
+ - Interface sections styled with green header
17
+
18
+ ## 0.1.0 (2025-xx-xx)
19
+
20
+ - Initial release
21
+ - Parse XML doclet output into structured data model
22
+ - `javadoc-api` and `javadoc-class` directives
23
+ - JavaDoc-inspired CSS with summary tables and detail blocks
24
+ - `:public-only:` and `:package:` filter options
25
+ - Package name stripping from type references
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Andreas Reichel / Manticore Projects
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ recursive-include sphinx_javadoc_xml/static *.css
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-javadoc-xml
3
+ Version: 0.3.0
4
+ Summary: Sphinx extension to render Java API docs from XML doclet output, with OpenJDK cross-links
5
+ Author-email: Andreas Reichel <andreas@manticore-projects.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/manticore-projects/sphinx-javadoc-xml
8
+ Project-URL: Documentation, https://manticore-projects.com/sphinx-javadoc-xml/
9
+ Project-URL: Repository, https://github.com/manticore-projects/sphinx-javadoc-xml
10
+ Project-URL: Issues, https://github.com/manticore-projects/sphinx-javadoc-xml/issues
11
+ Project-URL: Changelog, https://github.com/manticore-projects/sphinx-javadoc-xml/blob/main/CHANGELOG.md
12
+ Keywords: sphinx,javadoc,java,api,documentation,xml,doclet
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Framework :: Sphinx
15
+ Classifier: Framework :: Sphinx :: Extension
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3.14
26
+ Classifier: Topic :: Documentation
27
+ Classifier: Topic :: Documentation :: Sphinx
28
+ Classifier: Topic :: Software Development :: Documentation
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: sphinx>=5.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest; extra == "dev"
35
+ Requires-Dist: sphinx-rtd-theme; extra == "dev"
36
+ Requires-Dist: furo; extra == "dev"
37
+ Requires-Dist: build; extra == "dev"
38
+ Requires-Dist: twine; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # sphinx-javadoc-xml
42
+
43
+ [![PyPI](https://img.shields.io/pypi/v/sphinx-javadoc-xml)](https://pypi.org/project/sphinx-javadoc-xml/)
44
+ [![Python](https://img.shields.io/pypi/pyversions/sphinx-javadoc-xml)](https://pypi.org/project/sphinx-javadoc-xml/)
45
+ [![License](https://img.shields.io/pypi/l/sphinx-javadoc-xml)](LICENSE)
46
+
47
+ A Sphinx extension that renders Java API documentation from an XML doclet output
48
+ in a **JavaDoc-inspired style** — fully integrated with your Sphinx theme, with
49
+ cross-links to [OpenJDK Javadoc](https://docs.oracle.com/en/java/javase/21/docs/api/)
50
+ and between all defined types.
51
+
52
+ ## Features
53
+
54
+ - **Full XML doclet support**: classes, interfaces, enums, methods, fields,
55
+ constructors, annotations, type parameters, bounded wildcards, exceptions
56
+ - **OpenJDK cross-links**: `java.util.List` becomes a clickable link to the
57
+ Oracle JDK 21 docs (configurable URL)
58
+ - **Internal cross-references**: all types defined in your API link to each other
59
+ - **Package name stripping**: types within the same package show short names
60
+ - **Three directives**: full API, single class, or package summary
61
+ - **Theme-compatible CSS**: works with Furo, Read the Docs, Alabaster, and others
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install sphinx-javadoc-xml
67
+ ```
68
+
69
+ ## Quick Start
70
+
71
+ ### 1. Enable in `conf.py`
72
+
73
+ ```python
74
+ extensions = [
75
+ "sphinx_javadoc_xml",
76
+ ]
77
+
78
+ # Optional configuration
79
+ javadoc_jdk_url = "https://docs.oracle.com/en/java/javase/21/docs/api"
80
+ javadoc_load_fonts = True # Load Roboto fonts from Google Fonts CDN
81
+ javadoc_load_bulma = False # Load Bulma CSS from CDN (for non-Bulma themes)
82
+ ```
83
+
84
+ ### With manticore-sphinx-theme
85
+
86
+ When using `manticore-sphinx-theme`, the extension automatically inherits the
87
+ Manticore color scheme (`--bst-*` CSS variables), Roboto fonts, and Bulma CSS
88
+ from the theme — no extra configuration needed:
89
+
90
+ ```python
91
+ html_theme = "manticore_sphinx_theme"
92
+ extensions = ["sphinx_javadoc_xml"]
93
+ # Fonts and Bulma are auto-detected and skipped (already provided by theme)
94
+ ```
95
+
96
+ ### With other themes
97
+
98
+ The extension ships with the Manticore color scheme as defaults and loads
99
+ Google Fonts (Roboto family) automatically. Optionally enable Bulma for
100
+ enhanced table rendering:
101
+
102
+ ```python
103
+ html_theme = "furo" # or alabaster, sphinx_rtd_theme, etc.
104
+ extensions = ["sphinx_javadoc_xml"]
105
+ javadoc_load_bulma = True # Optional: pull Bulma from CDN
106
+ ```
107
+
108
+ ### 2. Place your XML file
109
+
110
+ ```
111
+ docs/
112
+ ├── _static/
113
+ │ └── api.xml
114
+ ├── conf.py
115
+ └── api.rst
116
+ ```
117
+
118
+ ### 3. Use the directives
119
+
120
+ **Full package API:**
121
+
122
+ ```rst
123
+ .. javadoc-api:: _static/api.xml
124
+ :package: net.sf.jsqlparser.expression
125
+ :public-only:
126
+ ```
127
+
128
+ **Single class:**
129
+
130
+ ```rst
131
+ .. javadoc-class:: _static/api.xml
132
+ :class: net.sf.jsqlparser.expression.Function
133
+ :public-only:
134
+ ```
135
+
136
+ **Package summary only (no type details):**
137
+
138
+ ```rst
139
+ .. javadoc-package:: _static/api.xml
140
+ :package: net.sf.jsqlparser.statement.select
141
+ :public-only:
142
+ ```
143
+
144
+ ## Directives Reference
145
+
146
+ ### `.. javadoc-api:: <path>`
147
+
148
+ | Option | Description |
149
+ |----------------|--------------------------------------------------|
150
+ | `:package:` | Filter to a specific package name |
151
+ | `:public-only:`| Hide private and package-private members |
152
+ | `:jdk-url:` | Override JDK Javadoc base URL for this directive |
153
+
154
+ ### `.. javadoc-class:: <path>`
155
+
156
+ | Option | Description |
157
+ |----------------|--------------------------------------------------|
158
+ | `:class:` | **Required.** Qualified or simple class name |
159
+ | `:public-only:`| Hide private and package-private members |
160
+ | `:jdk-url:` | Override JDK Javadoc base URL for this directive |
161
+
162
+ ### `.. javadoc-package:: <path>`
163
+
164
+ | Option | Description |
165
+ |----------------|--------------------------------------------------|
166
+ | `:package:` | **Required.** Package name to render |
167
+ | `:public-only:`| Hide private and package-private members |
168
+
169
+ ## Configuration (`conf.py`)
170
+
171
+ | Option | Default | Description |
172
+ |----------------------|------------------------------------------------------|-----------------------------------------------------------------------------|
173
+ | `javadoc_jdk_url` | `https://docs.oracle.com/en/java/javase/21/docs/api` | Base URL for JDK Javadoc cross-links |
174
+ | `javadoc_load_fonts` | `True` | Load Google Fonts (Roboto family); auto-disabled under manticore-sphinx-theme |
175
+ | `javadoc_load_bulma` | `False` | Load Bulma CSS from CDN; auto-disabled under manticore-sphinx-theme |
176
+
177
+ ## Cross-Linking
178
+
179
+ The extension automatically creates hyperlinks:
180
+
181
+ - **JDK types** → Oracle Javadoc (e.g., `java.util.List` → [docs.oracle.com/...](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html))
182
+ - **Internal types** → anchor links within the same page or document
183
+ - External links open in a new tab and show a small ↗ indicator
184
+
185
+ ## Theme Compatibility
186
+
187
+ The CSS uses CSS custom properties (`--jdx-*`) that automatically inherit
188
+ from manticore-sphinx-theme's `--bst-*` variables when available:
189
+
190
+ | Theme | Integration |
191
+ |--------------------------|---------------------------------------------------------|
192
+ | **manticore-sphinx-theme** | Native — inherits colors, fonts, Bulma; zero config |
193
+ | **Furo** | Full — uses Manticore defaults, optional Bulma |
194
+ | **sphinx_rtd_theme** | Full — Manticore colors with RTD layout |
195
+ | **Alabaster** | Full — clean integration |
196
+ | **sphinx_book_theme** | Full — Jupyter Book style with Manticore colors |
197
+
198
+ All CSS selectors are prefixed with `javadoc-` so they never conflict with
199
+ theme styles.
200
+
201
+ The extension expects the XML structure produced by the
202
+ [xml-doclet](https://github.com/MarkusBernwordt/xml-doclet) or a compatible
203
+ custom doclet. See the [CHANGELOG](CHANGELOG.md) for supported elements.
204
+
205
+ ## XML Format
206
+
207
+ The extension expects the XML structure produced by the
208
+ [xml-doclet](https://github.com/MarkusBernwordt/xml-doclet) or a compatible
209
+ custom doclet. See the [CHANGELOG](CHANGELOG.md) for supported elements.
210
+
211
+ ## Publishing to PyPI
212
+
213
+ ```bash
214
+ # Build
215
+ python -m build
216
+
217
+ # Upload to TestPyPI first
218
+ twine upload --repository testpypi dist/*
219
+
220
+ # Upload to PyPI
221
+ twine upload dist/*
222
+ ```
223
+
224
+ Or use GitHub Actions with [OIDC trusted publishing](https://docs.pypi.org/trusted-publishers/).
225
+
226
+ ## License
227
+
228
+ [MIT](LICENSE)
@@ -0,0 +1,188 @@
1
+ # sphinx-javadoc-xml
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/sphinx-javadoc-xml)](https://pypi.org/project/sphinx-javadoc-xml/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/sphinx-javadoc-xml)](https://pypi.org/project/sphinx-javadoc-xml/)
5
+ [![License](https://img.shields.io/pypi/l/sphinx-javadoc-xml)](LICENSE)
6
+
7
+ A Sphinx extension that renders Java API documentation from an XML doclet output
8
+ in a **JavaDoc-inspired style** — fully integrated with your Sphinx theme, with
9
+ cross-links to [OpenJDK Javadoc](https://docs.oracle.com/en/java/javase/21/docs/api/)
10
+ and between all defined types.
11
+
12
+ ## Features
13
+
14
+ - **Full XML doclet support**: classes, interfaces, enums, methods, fields,
15
+ constructors, annotations, type parameters, bounded wildcards, exceptions
16
+ - **OpenJDK cross-links**: `java.util.List` becomes a clickable link to the
17
+ Oracle JDK 21 docs (configurable URL)
18
+ - **Internal cross-references**: all types defined in your API link to each other
19
+ - **Package name stripping**: types within the same package show short names
20
+ - **Three directives**: full API, single class, or package summary
21
+ - **Theme-compatible CSS**: works with Furo, Read the Docs, Alabaster, and others
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ pip install sphinx-javadoc-xml
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Enable in `conf.py`
32
+
33
+ ```python
34
+ extensions = [
35
+ "sphinx_javadoc_xml",
36
+ ]
37
+
38
+ # Optional configuration
39
+ javadoc_jdk_url = "https://docs.oracle.com/en/java/javase/21/docs/api"
40
+ javadoc_load_fonts = True # Load Roboto fonts from Google Fonts CDN
41
+ javadoc_load_bulma = False # Load Bulma CSS from CDN (for non-Bulma themes)
42
+ ```
43
+
44
+ ### With manticore-sphinx-theme
45
+
46
+ When using `manticore-sphinx-theme`, the extension automatically inherits the
47
+ Manticore color scheme (`--bst-*` CSS variables), Roboto fonts, and Bulma CSS
48
+ from the theme — no extra configuration needed:
49
+
50
+ ```python
51
+ html_theme = "manticore_sphinx_theme"
52
+ extensions = ["sphinx_javadoc_xml"]
53
+ # Fonts and Bulma are auto-detected and skipped (already provided by theme)
54
+ ```
55
+
56
+ ### With other themes
57
+
58
+ The extension ships with the Manticore color scheme as defaults and loads
59
+ Google Fonts (Roboto family) automatically. Optionally enable Bulma for
60
+ enhanced table rendering:
61
+
62
+ ```python
63
+ html_theme = "furo" # or alabaster, sphinx_rtd_theme, etc.
64
+ extensions = ["sphinx_javadoc_xml"]
65
+ javadoc_load_bulma = True # Optional: pull Bulma from CDN
66
+ ```
67
+
68
+ ### 2. Place your XML file
69
+
70
+ ```
71
+ docs/
72
+ ├── _static/
73
+ │ └── api.xml
74
+ ├── conf.py
75
+ └── api.rst
76
+ ```
77
+
78
+ ### 3. Use the directives
79
+
80
+ **Full package API:**
81
+
82
+ ```rst
83
+ .. javadoc-api:: _static/api.xml
84
+ :package: net.sf.jsqlparser.expression
85
+ :public-only:
86
+ ```
87
+
88
+ **Single class:**
89
+
90
+ ```rst
91
+ .. javadoc-class:: _static/api.xml
92
+ :class: net.sf.jsqlparser.expression.Function
93
+ :public-only:
94
+ ```
95
+
96
+ **Package summary only (no type details):**
97
+
98
+ ```rst
99
+ .. javadoc-package:: _static/api.xml
100
+ :package: net.sf.jsqlparser.statement.select
101
+ :public-only:
102
+ ```
103
+
104
+ ## Directives Reference
105
+
106
+ ### `.. javadoc-api:: <path>`
107
+
108
+ | Option | Description |
109
+ |----------------|--------------------------------------------------|
110
+ | `:package:` | Filter to a specific package name |
111
+ | `:public-only:`| Hide private and package-private members |
112
+ | `:jdk-url:` | Override JDK Javadoc base URL for this directive |
113
+
114
+ ### `.. javadoc-class:: <path>`
115
+
116
+ | Option | Description |
117
+ |----------------|--------------------------------------------------|
118
+ | `:class:` | **Required.** Qualified or simple class name |
119
+ | `:public-only:`| Hide private and package-private members |
120
+ | `:jdk-url:` | Override JDK Javadoc base URL for this directive |
121
+
122
+ ### `.. javadoc-package:: <path>`
123
+
124
+ | Option | Description |
125
+ |----------------|--------------------------------------------------|
126
+ | `:package:` | **Required.** Package name to render |
127
+ | `:public-only:`| Hide private and package-private members |
128
+
129
+ ## Configuration (`conf.py`)
130
+
131
+ | Option | Default | Description |
132
+ |----------------------|------------------------------------------------------|-----------------------------------------------------------------------------|
133
+ | `javadoc_jdk_url` | `https://docs.oracle.com/en/java/javase/21/docs/api` | Base URL for JDK Javadoc cross-links |
134
+ | `javadoc_load_fonts` | `True` | Load Google Fonts (Roboto family); auto-disabled under manticore-sphinx-theme |
135
+ | `javadoc_load_bulma` | `False` | Load Bulma CSS from CDN; auto-disabled under manticore-sphinx-theme |
136
+
137
+ ## Cross-Linking
138
+
139
+ The extension automatically creates hyperlinks:
140
+
141
+ - **JDK types** → Oracle Javadoc (e.g., `java.util.List` → [docs.oracle.com/...](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html))
142
+ - **Internal types** → anchor links within the same page or document
143
+ - External links open in a new tab and show a small ↗ indicator
144
+
145
+ ## Theme Compatibility
146
+
147
+ The CSS uses CSS custom properties (`--jdx-*`) that automatically inherit
148
+ from manticore-sphinx-theme's `--bst-*` variables when available:
149
+
150
+ | Theme | Integration |
151
+ |--------------------------|---------------------------------------------------------|
152
+ | **manticore-sphinx-theme** | Native — inherits colors, fonts, Bulma; zero config |
153
+ | **Furo** | Full — uses Manticore defaults, optional Bulma |
154
+ | **sphinx_rtd_theme** | Full — Manticore colors with RTD layout |
155
+ | **Alabaster** | Full — clean integration |
156
+ | **sphinx_book_theme** | Full — Jupyter Book style with Manticore colors |
157
+
158
+ All CSS selectors are prefixed with `javadoc-` so they never conflict with
159
+ theme styles.
160
+
161
+ The extension expects the XML structure produced by the
162
+ [xml-doclet](https://github.com/MarkusBernwordt/xml-doclet) or a compatible
163
+ custom doclet. See the [CHANGELOG](CHANGELOG.md) for supported elements.
164
+
165
+ ## XML Format
166
+
167
+ The extension expects the XML structure produced by the
168
+ [xml-doclet](https://github.com/MarkusBernwordt/xml-doclet) or a compatible
169
+ custom doclet. See the [CHANGELOG](CHANGELOG.md) for supported elements.
170
+
171
+ ## Publishing to PyPI
172
+
173
+ ```bash
174
+ # Build
175
+ python -m build
176
+
177
+ # Upload to TestPyPI first
178
+ twine upload --repository testpypi dist/*
179
+
180
+ # Upload to PyPI
181
+ twine upload dist/*
182
+ ```
183
+
184
+ Or use GitHub Actions with [OIDC trusted publishing](https://docs.pypi.org/trusted-publishers/).
185
+
186
+ ## License
187
+
188
+ [MIT](LICENSE)
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sphinx-javadoc-xml"
7
+ version = "0.3.0"
8
+ description = "Sphinx extension to render Java API docs from XML doclet output, with OpenJDK cross-links"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Andreas Reichel", email = "andreas@manticore-projects.com"},
14
+ ]
15
+ keywords = [
16
+ "sphinx",
17
+ "javadoc",
18
+ "java",
19
+ "api",
20
+ "documentation",
21
+ "xml",
22
+ "doclet",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Framework :: Sphinx",
27
+ "Framework :: Sphinx :: Extension",
28
+ "Intended Audience :: Developers",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Programming Language :: Python :: 3.14",
38
+ "Topic :: Documentation",
39
+ "Topic :: Documentation :: Sphinx",
40
+ "Topic :: Software Development :: Documentation",
41
+ ]
42
+ dependencies = [
43
+ "sphinx>=5.0",
44
+ ]
45
+
46
+ [project.optional-dependencies]
47
+ dev = [
48
+ "pytest",
49
+ "sphinx-rtd-theme",
50
+ "furo",
51
+ "build",
52
+ "twine",
53
+ ]
54
+
55
+ [project.urls]
56
+ Homepage = "https://github.com/manticore-projects/sphinx-javadoc-xml"
57
+ Documentation = "https://manticore-projects.com/sphinx-javadoc-xml/"
58
+ Repository = "https://github.com/manticore-projects/sphinx-javadoc-xml"
59
+ Issues = "https://github.com/manticore-projects/sphinx-javadoc-xml/issues"
60
+ Changelog = "https://github.com/manticore-projects/sphinx-javadoc-xml/blob/main/CHANGELOG.md"
61
+
62
+ [tool.setuptools.packages.find]
63
+ include = ["sphinx_javadoc_xml"]
64
+
65
+ [tool.setuptools.package-data]
66
+ sphinx_javadoc_xml = ["static/*.css", "py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,94 @@
1
+ """
2
+ sphinx-javadoc-xml
3
+ ==================
4
+
5
+ A Sphinx extension that renders Java API documentation from an XML doclet
6
+ output in a JavaDoc-inspired style, with cross-links to OpenJDK Javadoc
7
+ and internal type references.
8
+
9
+ Directives
10
+ ----------
11
+
12
+ ``.. javadoc-api:: path/to/api.xml``
13
+ Renders the full API (all packages, types, members).
14
+ Options: ``:package:``, ``:public-only:``, ``:jdk-url:``
15
+
16
+ ``.. javadoc-class:: path/to/api.xml``
17
+ Renders a single type.
18
+ Options: ``:class:``, ``:public-only:``, ``:jdk-url:``
19
+
20
+ ``.. javadoc-package:: path/to/api.xml``
21
+ Renders a package summary table only.
22
+ Options: ``:package:``, ``:public-only:``
23
+ """
24
+
25
+ from __future__ import annotations
26
+
27
+ import logging
28
+ from pathlib import Path
29
+ from typing import Any, Dict
30
+
31
+ from sphinx.application import Sphinx
32
+
33
+ from .directives import JavadocApiDirective, JavadocClassDirective, JavadocPackageDirective
34
+
35
+ __version__ = "0.3.0"
36
+
37
+ logger = logging.getLogger(__name__)
38
+
39
+ # Google Fonts for Roboto family (Manticore branding)
40
+ _GOOGLE_FONTS_URL = (
41
+ "https://fonts.googleapis.com/css2?"
42
+ "family=Roboto:wght@400;500;700"
43
+ "&family=Roboto+Slab:wght@400;500"
44
+ "&family=Roboto+Mono:wght@400;600"
45
+ "&display=swap"
46
+ )
47
+
48
+ _BULMA_CDN_URL = (
49
+ "https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
50
+ )
51
+
52
+
53
+ def _on_builder_inited(app: Sphinx) -> None:
54
+ """Register static files and optional CDN resources."""
55
+ logger.info("sphinx-javadoc-xml v%s loaded", __version__)
56
+
57
+ # Static dir for javadoc.css
58
+ static_dir = str(Path(__file__).parent / "static")
59
+ app.config.html_static_path.append(static_dir)
60
+
61
+ # Detect if running under manticore-sphinx-theme (which provides
62
+ # Roboto fonts and Bulma already)
63
+ theme = getattr(app.config, "html_theme", "")
64
+ is_manticore = theme in ("manticore_sphinx_theme", "manticore-sphinx-theme")
65
+
66
+ # Load Google Fonts unless the theme already provides them
67
+ if not is_manticore and app.config.javadoc_load_fonts:
68
+ app.add_css_file(_GOOGLE_FONTS_URL)
69
+
70
+ # Load Bulma CSS if requested and not already provided by theme
71
+ if not is_manticore and app.config.javadoc_load_bulma:
72
+ app.add_css_file(_BULMA_CDN_URL)
73
+
74
+
75
+ def setup(app: Sphinx) -> Dict[str, Any]:
76
+ app.add_directive("javadoc-api", JavadocApiDirective)
77
+ app.add_directive("javadoc-class", JavadocClassDirective)
78
+ app.add_directive("javadoc-package", JavadocPackageDirective)
79
+
80
+ # Configuration values
81
+ app.add_config_value("javadoc_jdk_url",
82
+ "https://docs.oracle.com/en/java/javase/21/docs/api",
83
+ "html")
84
+ app.add_config_value("javadoc_load_fonts", True, "html")
85
+ app.add_config_value("javadoc_load_bulma", False, "html")
86
+
87
+ app.connect("builder-inited", _on_builder_inited)
88
+ app.add_css_file("javadoc.css")
89
+
90
+ return {
91
+ "version": __version__,
92
+ "parallel_read_safe": True,
93
+ "parallel_write_safe": True,
94
+ }