diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf1..b63b368a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -18,3 +18,11 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +docs: + # rm -rf source/apidoc docs/_build + sphinx-apidoc -fMeT -o source/apidoc ../src/bsk_rl + for f in source/apidoc/*.rst; do\ + ./apidoc_format.sh $$f ;\ + done + $(MAKE) html \ No newline at end of file diff --git a/docs/apidoc_format.sh b/docs/apidoc_format.sh new file mode 100755 index 00000000..8f2d987c --- /dev/null +++ b/docs/apidoc_format.sh @@ -0,0 +1,21 @@ +for file in "$@"; do + # Check if file exists + if [ -f "$file" ]; then + # Get the first line of the file + body=$(tail -n +3 "$file") + first_line=$(head -n 1 "$file") + package_loc=$(echo "$first_line" | sed -E 's/( module| package)$//') + page_title="${package_loc##*.}" + echo "TITLE" "$page_title" + + # Update the file with the modified first line + echo $page_title > $file + echo $(printf '=%.0s' $(seq 1 ${#page_title})) >> $file + echo "\`$package_loc\`" >> $file + echo "$body" >> $file + + echo "Processed $file" + else + echo "File '$file' does not exist." + fi +done diff --git a/docs/source/conf.py b/docs/source/conf.py index 6a5065d3..5efa50c5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -3,15 +3,18 @@ # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html +import datetime + # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information import os import sys -#sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src"))) +# sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src"))) +now = datetime.datetime.now() project = "bsk_rl" -copyright = "2023, Mark Stephenson" +copyright = str(now.year) + ", Autonomous Vehicle Systems (AVS) Laboratory" author = "Mark Stephenson" release = "0.0.0" @@ -25,17 +28,40 @@ "sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon", + "sphinx_rtd_theme", ] templates_path = ["_templates"] exclude_patterns = [] +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = "en" + # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = "sphinx_rtd_theme" +html_theme_options = { + "style_nav_header_background": "#CFB87C", + "navigation_depth": -1, +} html_static_path = ["_static"] -html_css_files = ["custom.css"] +# html_css_files = ["custom.css"] +html_logo = "./_images/static/Basilisk-Logo.png" + +add_module_names = False + + +def skip(app, what, name, obj, would_skip, options): + if name == "__init__": + return False + return would_skip + -add_module_names = False \ No newline at end of file +def setup(app): + app.connect("autodoc-skip-member", skip) diff --git a/docs/source/index.rst b/docs/source/index.rst index 3640aaa4..9ff62891 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -16,8 +16,9 @@ Check out the :doc:`usage` section for further information. .. toctree:: :maxdepth: 2 :caption: Contents: + :titlesonly: - documentation/modules + apidoc/bsk_rl Indices and tables diff --git a/docs/source/usage.rst b/docs/source/usage.rst index d6b91dba..0adbf59f 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -1,8 +1,5 @@ -Usage -===== - Installation ------------- +============ .. note:: To use Lumache, bsk_rl, Basilisk must be installed first. You can find instructions on how to do so