Skip to content

Commit

Permalink
Add sphinx apidoc and return includes for conan
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Lefkowitz committed Apr 24, 2024
1 parent 79dc551 commit bf6f7f8
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 2,833 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ current_version = 0.9.0
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:DOXYFILE]
search = PROJECT_NUMBER = {current_version}
replace = PROJECT_NUMBER = {new_version}
[bumpversion:file:docs/sphinx/conf.py]
search = version = "{current_version}"
replace = version = "{new_version}"
18 changes: 17 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,35 @@
],
"language": "en",
"words": [
"autoapi",
"autoflake",
"autosummary",
"bumpversion",
"cobertura",
"codacy",
"conandeps",
"cppcheck",
"cppdefines",
"cpppath",
"cxxcomstr",
"cxxflags",
"debugpy",
"doctest",
"doxyfile",
"emojize",
"furo",
"giphy",
"grotesk",
"gtest",
"isort",
"lefkowitz",
"linkcomstr",
"mainpage",
"matplotlib",
"mdfile",
"miniscons",
"mypy",
"opengraph",
"psutil",
"pycache",
"pylint",
Expand All @@ -54,11 +66,15 @@
"scons",
"sdist",
"searchengine",
"searchindex",
"sphinxext",
"stylesheet",
"toctree",
"treeview",
"trufflehog",
"debugpy",
"undoc",
"venv",
"walkmate",
"werror"
]
}
43 changes: 0 additions & 43 deletions Doxyfile

This file was deleted.

75 changes: 75 additions & 0 deletions docs/sphinx/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import re
import shutil
from cgitb import html
from datetime import date
from glob import glob
from walkmate import tree

project = "Miniscons"
version = "0.9.0"

package = "miniscons"
primary = "#4165FF"
secondary = "#914FF5"

project_copyright = f"{date.today().year} Joel Lefkowitz"

extensions = [
"autoapi.extension",
"myst_parser",
"sphinxext.opengraph",
]

autoapi_dirs = ["../../src"]
autoapi_options = [
"members",
"undoc-members",
"private-members",
"show-inheritance",
]

myst_all_links_external = True

html_theme = "furo"
html_title = project
html_static_path = [""]
html_js_files = ["scripts.js"]
html_css_files = ["styles.css"]
html_theme_options = {
"font-stack": "Space Grotesk, sans-serif",
"font-stack--monospace": "CQ Mono, monospace",
"light_css_variables": {
"color-brand-content": primary,
"color-problematic": primary,
"color-brand-primary": secondary,
"color-highlight-on-target": "#E0E0E0",
},
"dark_css_variables": {
"color-problematic": primary,
"color-brand-content": primary,
"color-brand-primary": secondary,
"color-highlight-on-target": "#202020",
},
}


def build(app, build):

shutil.copytree("docs/images", "docs/dist/docs/images", dirs_exist_ok=True)
shutil.move("docs/dist/autoapi/src", f"docs/dist/autoapi/{package}")

pattern = re.compile(r"src(?!\=)")

for file in tree("docs/dist", r"\.html") + ["docs/dist/searchindex.js"]:
with open(file, "r") as stream:
text = pattern.sub(package, stream.read())

with open(file, "w") as stream:
stream.write(text)

for path in glob(f"*.md"):
shutil.copyfile(path, f"docs/dist/{path}")


def setup(app):
app.connect("build-finished", build)
7 changes: 7 additions & 0 deletions docs/sphinx/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. include:: ../../README.md
:parser: myst_parser.sphinx_

.. toctree::
:hidden:

.. autosummary::
13 changes: 13 additions & 0 deletions docs/sphinx/scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Array.from(document.querySelectorAll("img"))
.filter((img) => img.hasAttribute("height"))
.forEach((img) => {
img.style.height = img.getAttribute("height").concat("px");
});

Array.from(document.querySelectorAll(".toctree-checkbox")).forEach(
(section) => {
if (!section.checked) {
section.click();
}
},
);
50 changes: 50 additions & 0 deletions docs/sphinx/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.content {
width: 100%;
padding: 0 40px;
}

.toc-drawer {
width: 400px;
}

.sidebar-brand-text {
text-align: center;
}

.sidebar-drawer {
width: 300px;
}

.sidebar-container {
width: 300px;
}

section#documentation {
display: none;
}

@media (max-width: 67em) {
.content {
padding: 0 20px;
}

.icon {
margin: 0 10px;

svg {
width: 20px;
height: 20px;
}
}

.sidebar-drawer {
left: -300px;
}
}

@media (max-width: 82em) {
.toc-drawer {
max-width: 300px;
right: -400px;
}
}
Loading

0 comments on commit bf6f7f8

Please sign in to comment.