Skip to content

Commit 3d316c1

Browse files
author
Onimock
committed
Update: read docs parameters
1 parent 482a0eb commit 3d316c1

File tree

4 files changed

+32
-40
lines changed

4 files changed

+32
-40
lines changed

docs/source/conf.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import os
22
import sys
3+
import tomlkit
34

45
sys.path.insert(0, os.path.abspath("../../src"))
56

7+
8+
def get_version():
9+
pyproject_path = os.path.abspath("../../pyproject.toml")
10+
try:
11+
with open(pyproject_path, "r", encoding="utf-8") as f:
12+
data = tomlkit.parse(f.read())
13+
version = data.get("project", {}).get("version", "0.0.0")
14+
return version
15+
except (FileNotFoundError, KeyError):
16+
return "0.0.0"
17+
18+
619
# Configuration file for the Sphinx documentation builder.
720
#
821
# For the full list of built-in configuration values, see the documentation:
@@ -11,25 +24,28 @@
1124
# -- Project information -----------------------------------------------------
1225
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1326

27+
full_version = get_version()
28+
version = ".".join(full_version.split(".")[:2])
29+
release = full_version
30+
1431
project = "QSS Parser"
1532
copyright = "2025, OniMock"
1633
author = "OniMock"
17-
release = "0.1.3"
1834

1935
# -- General configuration ---------------------------------------------------
2036
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2137

2238
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon"]
2339

2440
templates_path = ["_templates"]
25-
exclude_patterns = []
26-
41+
exclude_patterns = ["modules.rst"]
2742

2843
# -- Options for HTML output -------------------------------------------------
2944
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3045

3146
html_theme = "sphinx_rtd_theme"
32-
html_static_path = ["_static"]
47+
html_static_path = [""]
48+
autodoc_member_order = "groupwise"
3349

3450

3551
def skip(app, what, name, obj, skip, options):
@@ -38,8 +54,12 @@ def skip(app, what, name, obj, skip, options):
3854
return skip
3955

4056

41-
def setup(app):
42-
app.connect("autodoc-skip-member", skip)
57+
def process_docstring(app, what, name, obj, options, lines):
58+
# Strip the 'qss_parser.qss_parser.' prefix from docstrings
59+
for i in range(len(lines)):
60+
lines[i] = lines[i].replace("qss_parser.qss_parser.", "")
4361

4462

45-
autodoc_member_order = "groupwise"
63+
def setup(app):
64+
app.connect("autodoc-skip-member", skip)
65+
app.connect("autodoc-process-docstring", process_docstring)

docs/source/index.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
.. QSS Parser documentation master file, created by
2-
sphinx-quickstart.
3-
41
Welcome to QSS Parser's Documentation!
52
======================================
63

74
The QSS Parser is a Python library for parsing Qt Style Sheets (QSS) and applying styles to PySide6/PyQt6 widgets.
85

9-
Contents
10-
--------
11-
126
.. toctree::
137
:maxdepth: 2
148
:caption: Contents:
159

16-
modules
10+
qss_parser
1711

18-
Indices and tables
12+
Indices and Tables
1913
------------------
2014

2115
* :ref:`genindex`

docs/source/modules.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/qss_parser.rst

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
qss\_parser package
2-
===================
3-
4-
Submodules
5-
----------
6-
7-
qss\_parser.qss\_parser module
8-
------------------------------
1+
qss_parser.qss_parser module
2+
============================
93

104
.. automodule:: qss_parser.qss_parser
115
:members:
12-
:undoc-members:
13-
:show-inheritance:
14-
15-
Module contents
16-
---------------
17-
18-
.. automodule:: qss_parser
19-
:members:
20-
:undoc-members:
21-
:show-inheritance:
6+
:show-inheritance:

0 commit comments

Comments
 (0)