Skip to content
Snippets Groups Projects
Commit 09212a21 authored by dh00601's avatar dh00601
Browse files

fixing docs generator

parent df642163
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,9 @@ Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
https://brendanhasz.github.io/2019/01/05/sphinx.html
https://www.sphinx-doc.org/en/master/usage/configuration.html
https://brendanhasz.github.io/2019/01/05/sphinx.html
https://www.sphinx-doc.org/en/1.5/ext/example_google.html
"""
# -- Path setup --------------------------------------------------------------
......@@ -18,7 +19,33 @@ import sys
import sphinx_rtd_theme
# https://www.sphinx-doc.org/en/1.5/ext/example_google.html
import m2r2
from binarycpython.utils.functions import (
write_binary_c_parameter_descriptions_to_rst_file,
)
# from binarycpython.utils.grid import write_grid_options_to_rst_file
from binarycpython.utils.grid import Population
from functions import write_custom_footer
#
def patched_m2r2_setup(app):
"""
Function to handle the markdown parsing better
"""
try:
return current_m2r2_setup(app)
except (AttributeError):
app.add_source_suffix(".md", "markdown")
app.add_source_parser(m2r2.M2RParser)
return dict(
version=m2r2.__version__,
parallel_read_safe=True,
parallel_write_safe=True,
)
# Include paths for python code
sys.path.insert(0, os.path.abspath("."))
......@@ -95,44 +122,23 @@ html_static_path = ["_static"]
"""Patching m2r2"""
import m2r2
current_m2r2_setup = m2r2.setup
def patched_m2r2_setup(app):
try:
return current_m2r2_setup(app)
except (AttributeError):
app.add_source_suffix(".md", "markdown")
app.add_source_parser(m2r2.M2RParser)
return dict(
version=m2r2.__version__,
parallel_read_safe=True,
parallel_write_safe=True,
)
#
m2r2.setup = patched_m2r2_setup
# Generate some custom documentations for this version of binarycpython and binary_c
from binarycpython.utils.functions import (
write_binary_c_parameter_descriptions_to_rst_file,
)
from binarycpython.utils.grid_options_defaults import write_grid_options_to_rst_file
docs_pop = Population()
print("Generating binary_c_parameters.rst")
write_binary_c_parameter_descriptions_to_rst_file("binary_c_parameters.rst")
print("Done")
print("Generating grid_options_descriptions.rst")
write_grid_options_to_rst_file("grid_options_descriptions.rst")
docs_pop.write_grid_options_to_rst_file("grid_options_descriptions.rst")
print("Done")
# Generate a custom footer
from functions import write_custom_footer
print("Generating custom footer")
write_custom_footer()
print("Done")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment