Skip to content
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
Added the readthedocs.yaml from v3, also update conf.py to match with…
… the latest version
  • Loading branch information
RobertoRoos committed Nov 19, 2021
commit 51d3d8b4f7c952e9079ec4438bae6e1adbf1fe4e
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/manual/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: requirements.txt
46 changes: 0 additions & 46 deletions docs/manual/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,6 @@
'Zoltán Vörös', 'manual'),
]

# sphinx-autoapi
extensions.append('autoapi.extension')
autoapi_type = 'python'
autoapi_keep_files = True
autoapi_dirs = ["ulab"]
autoapi_add_toctree_entry = False
autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members']
autoapi_template_dir = '../autoapi/templates'
autoapi_python_class_content = "both"
autoapi_python_use_implicit_namespaces = True
autoapi_root = "."


# Read the docs theme
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd:
Expand All @@ -123,36 +110,3 @@
html_theme_path = ['.']
else:
html_theme_path = ['.']


class UlabTransform(SphinxTransform):
default_priority = 870

def _convert_first_paragraph_into_title(self):
title = self.document.next_node(nodes.title)
paragraph = self.document.next_node(nodes.paragraph)
if not title or not paragraph:
return
if isinstance(paragraph[0], nodes.paragraph):
paragraph = paragraph[0]
if all(isinstance(child, nodes.Text) for child in paragraph.children):
for child in paragraph.children:
title.append(nodes.Text(" \u2013 "))
title.append(child)
paragraph.parent.remove(paragraph)

def _enable_linking_to_nonclass_targets(self):
for desc in self.document.traverse(addnodes.desc):
for xref in desc.traverse(addnodes.pending_xref):
if xref.attributes.get("reftype") == "class":
xref.attributes.pop("refspecific", None)

def apply(self, **kwargs):
docname = self.env.docname
if docname.startswith("ulab/"):
self._convert_first_paragraph_into_title()
self._enable_linking_to_nonclass_targets()


def setup(app):
app.add_transform(UlabTransform)