-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update readthedocs.yaml readthedocs.yaml test update docs 2 update docs 3 changes to docs update docs/conf.py docs test update conf.py fix Makefile update year
- Loading branch information
Showing
15 changed files
with
96 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
import re | ||
import sys | ||
import os | ||
|
||
os.system('python3 -m pip install -r docs/requirements.txt') | ||
|
||
from sphinx.ext.apidoc import main | ||
|
||
if __name__ == '__main__': | ||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | ||
localDir = sys.argv[3] | ||
main() | ||
|
||
# because you cannot change how autodoc works, I wrote a custom stripper for the API docs that gets called before the docs are built. | ||
# This is a bit of a hack, but it works. | ||
|
||
for filename in os.listdir(localDir): | ||
if ".libs." in filename\ | ||
or "MIDIAnimator.rst" == filename\ | ||
or "modules.rst" == filename: | ||
os.remove(os.path.join(localDir, filename)) | ||
|
||
# now open the files up and edit them | ||
# the first line of the file will be the title of the module. We want to replace " package" with nothing, and "MIDIAnimator." with nothing. Still keep the old name (With the " package" replacement), as we want to check this against other lines | ||
# if the first two characters are "..", don't do anything (as this is an RST module), write the line and continue | ||
# if the line contains "Submodules" and the next line after that contains a dash, do not write either of those lines | ||
# if any line contains the first line of the file as described above + ".", replace it with nothing | ||
|
||
for filename in os.listdir(localDir): | ||
if ".libs." in filename\ | ||
or "MIDIAnimator.rst" == filename\ | ||
or "modules.rst" == filename: | ||
continue | ||
with open(os.path.join(localDir, filename), 'r') as f: | ||
lines = f.readlines() | ||
|
||
contains = False | ||
title = "" | ||
with open(os.path.join(localDir, filename), 'w') as f: | ||
for i, line in enumerate(lines): | ||
if i == 0: | ||
title = line.replace(" package", "") | ||
f.write(title.replace("MIDIAnimator.", "")) | ||
title = title.strip() | ||
continue | ||
if line.startswith(".."): | ||
f.write(line) | ||
continue | ||
if "Submodules" in line: | ||
if lines[lines.index(line) + 1].startswith("-"): | ||
contains = True | ||
continue | ||
|
||
if contains: | ||
contains = False | ||
continue | ||
|
||
if title in line: | ||
line = line.replace(title + ".", "") | ||
if " module" in line: | ||
# replace with ".py" | ||
line = line.replace(" module", ".py") | ||
f.write(line) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
version: 2 | ||
|
||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
python: | ||
install: | ||
- requirements: docs/requirements.txt | ||
- requirements: docs/requirements.txt | ||
|
||
submodules: | ||
include: all | ||
recursive: true | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.11" | ||
jobs: | ||
pre_create_environment: | ||
- echo "Update autodocs" | ||
- python3 docs/build_api_docs.py -f -o docs/api MIDIAnimator |