Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Docs generation for v2.0.0 #1582

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ repos:

# Format Python
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.12.1
hooks:
- id: black

# Sort imports
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
additional_dependencies: ["toml"]

# Lint Python
- repo: https://gitlab.com/PyCQA/flake8
rev: 4.0.1
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
17 changes: 17 additions & 0 deletions docs/sources/_extensions/autoapi_kivymd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
import autoapi
import sphinx
import unidecode
from autoapi.directives import NestedParse
from autoapi.extension import LOGGER
from autoapi.extension import setup as autoapi_setup
from autoapi.mappers.python.mapper import PythonSphinxMapper
from autoapi.mappers.python.objects import PythonPythonMapper
from docutils import nodes
from sphinx.util.console import bold, darkgreen
from sphinx.util.nodes import nested_parse_with_titles
from sphinx.util.osutil import ensuredir


Expand Down Expand Up @@ -128,7 +131,21 @@ def extension_build_finished(app, exception):
break


def patched_nested_parse_run(self):
node = nodes.container()
node.document = self.state.document
nested_parse_with_titles(self.state, self.content, node)
try:
title_node = node[0][0]
if isinstance(title_node, nodes.title):
title_node.children.pop(0)
except IndexError:
pass
return node.children


def setup(app):
NestedParse.run = patched_nested_parse_run
PythonPythonMapper.pathname = property(PythonPythonMapper_pathname)
PythonPythonMapper.include_dir = PythonPythonMapper_include_dir
PythonSphinxMapper.output_rst = PythonSphinxMapper_output_rst
Expand Down
Loading