Skip to content

Commit

Permalink
docs: document code with doxygen, breathe, and sphinx_csharp
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Dec 16, 2023
1 parent 172e61d commit 5597755
Show file tree
Hide file tree
Showing 8 changed files with 2,831 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "third-party/sphinx-csharp"]
path = third-party/sphinx-csharp
url = https://github.com/rogerbarton/sphinx-csharp.git
branch = master
11 changes: 9 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ version: 2

# Set the version of Python
build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
apt_packages:
- graphviz # required to build diagrams
jobs:
post_build:
- rstcheck -r . # lint rst files
# - rstfmt --check --diff -w 120 . # check rst formatting

# submodules required to install sphinx-csharp
submodules:
include: all
recursive: true

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
Expand Down
2,777 changes: 2,777 additions & 0 deletions docs/Doxyfile

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
breathe==4.35.0
furo==2023.9.10
m2r2==0.3.3.post2
rstcheck[sphinx]==6.2.0
rstfmt==0.0.14
Sphinx==7.2.6
sphinx-copybutton==0.5.2

# install submodules
./third-party/sphinx-csharp
8 changes: 8 additions & 0 deletions docs/source/code/ThemerrManager.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ThemerrManager
==============

.. doxygennamespace:: Jellyfin.Plugin.Themerr
:members:
:protected-members:
:private-members:
:undoc-members:
22 changes: 22 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# standard imports
from datetime import datetime
import os
import subprocess


# -- Path setup --------------------------------------------------------------
Expand Down Expand Up @@ -35,11 +36,13 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'breathe', # c# support for sphinx with doxygen, and sphinx-csharp
'm2r2', # enable markdown files
'sphinx.ext.autosectionlabel',
'sphinx.ext.todo', # enable to-do sections
'sphinx.ext.viewcode', # add links to view source code
'sphinx_copybutton', # add a copy button to code blocks
'sphinx_csharp', # c# directives
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -83,4 +86,23 @@

# extension config options
autosectionlabel_prefix_document = True # Make sure the target is unique
breathe_default_project = 'Jellyfin.Plugin.Themerr'
breathe_projects = {
"Jellyfin.Plugin.Themerr": "../build/doxyxml"
}
sphinx_csharp_test_links = True
todo_include_todos = True

# disable epub mimetype warnings
# https://github.com/readthedocs/readthedocs.org/blob/eadf6ac6dc6abc760a91e1cb147cc3c5f37d1ea8/docs/conf.py#L235-L236
suppress_warnings = ["epub.unknown_project_files"]

# get doxygen version
doxy_proc = subprocess.run('doxygen --version', shell=True, cwd=source_dir, capture_output=True)
doxy_version = doxy_proc.stdout.decode('utf-8').strip()
print('doxygen version: ' + doxy_version)

# run doxygen
doxy_proc = subprocess.run('doxygen Doxyfile', shell=True, cwd=source_dir)
if doxy_proc.returncode != 0:
raise RuntimeError('doxygen failed with return code ' + str(doxy_proc.returncode))
6 changes: 6 additions & 0 deletions docs/source/toc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
contributing/database
contributing/build
contributing/testing

.. toctree::
:maxdepth: 2
:caption: Source Code

code/ThemerrManager
1 change: 1 addition & 0 deletions third-party/sphinx-csharp
Submodule sphinx-csharp added at 1e4cf5

0 comments on commit 5597755

Please sign in to comment.