Skip to content

Commit

Permalink
Update conf.py
Browse files Browse the repository at this point in the history
Signed-off-by: KonanAI <[email protected]>
  • Loading branch information
konan-ai authored Jul 25, 2023
1 parent 937d454 commit 4fe239e
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,72 +74,72 @@
}
issues_github_path = "KonanAI-LLC/konanai"

# # HTML -----------------------------------------------------------------

# html_theme = "flask"
# html_theme_options = {"index_sidebar_logo": False}
# html_context = {
# "project_links": [
# ProjectLink("PyPI Releases", "https://pypi.org/project/konanai/"),
# ProjectLink("Source Code", "https://github.com/KonanAI-LLC/konanai"),
# ProjectLink("Issue Tracker", "https://github.com/KonanAI-LLC/konanai/issues/"),
# ]
# }
# html_sidebars = {
# "index": ["project.html", "localtoc.html", "searchbox.html"],
# "**": ["localtoc.html", "relations.html", "searchbox.html"],
# }
# singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
# html_static_path = ["_static"]
# html_favicon = "_static/shortcut-icon.png"
# html_logo = "_static/konanai-logo.png"
# html_title = f"konanai Documentation ({version})"
# html_show_sourcelink = False

# exclude_patterns = ['**/konanai/src/konanai/externals/lib']

# LaTeX ----------------------------------------------------------------

# latex_documents = [(master_doc, f"konanai-{version}.tex", html_title, author, "manual")]

# Local Extensions -----------------------------------------------------

# def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):
# app = inliner.document.settings.env.app
# release = app.config.release
# base_url = "https://github.com/KonanAI-LLC/konanai/tree/"

# if text.endswith(">"):
# words, text = text[:-1].rsplit("<", 1)
# words = words.strip()
# else:
# words = None

# if packaging.version.parse(release).is_devrelease:
# url = f"{base_url}main/{text}"
# else:
# url = f"{base_url}{release}/{text}"

# if words is None:
# words = url

# from docutils.nodes import reference
# from docutils.parsers.rst.roles import set_classes

# options = options or {}
# set_classes(options)
# node = reference(rawtext, words, refuri=url, **options)
# return [node], []

# def setup(app: Sphinx):
# app.add_role("gh", github_link)
# HTML -----------------------------------------------------------------

html_theme = "flask"
html_theme_options = {"index_sidebar_logo": False}
html_context = {
"project_links": [
ProjectLink("PyPI Releases", "https://pypi.org/project/konanai/"),
ProjectLink("Source Code", "https://github.com/KonanAI-LLC/konanai"),
ProjectLink("Issue Tracker", "https://github.com/KonanAI-LLC/konanai/issues/"),
]
}
html_sidebars = {
"index": ["project.html", "localtoc.html", "searchbox.html"],
"**": ["localtoc.html", "relations.html", "searchbox.html"],
}
singlehtml_sidebars = {"index": ["project.html", "localtoc.html"]}
html_static_path = ["_static"]
html_favicon = "_static/shortcut-icon.png"
html_logo = "_static/konanai-logo.png"
html_title = f"konanai Documentation ({version})"
html_show_sourcelink = False

exclude_patterns = ['**/konanai/src/konanai/externals/lib']

LaTeX ----------------------------------------------------------------

latex_documents = [(master_doc, f"konanai-{version}.tex", html_title, author, "manual")]

Local Extensions -----------------------------------------------------

def github_link(name, rawtext, text, lineno, inliner, options=None, content=None):
app = inliner.document.settings.env.app
release = app.config.release
base_url = "https://github.com/KonanAI-LLC/konanai/tree/"

if text.endswith(">"):
words, text = text[:-1].rsplit("<", 1)
words = words.strip()
else:
words = None

if packaging.version.parse(release).is_devrelease:
url = f"{base_url}main/{text}"
else:
url = f"{base_url}{release}/{text}"

if words is None:
words = url

from docutils.nodes import reference
from docutils.parsers.rst.roles import set_classes

options = options or {}
set_classes(options)
node = reference(rawtext, words, refuri=url, **options)
return [node], []

def setup(app: Sphinx):
app.add_role("gh", github_link)

# app.connect('build-finished', run_postprocess)
app.connect('build-finished', run_postprocess)

# def run_postprocess(app, exception):
# # The script and html directory paths
# script_path = os.path.join(os.path.dirname(__file__), "postprocess.py")
# html_dir_path = os.path.join(app.outdir)
def run_postprocess(app, exception):
# The script and html directory paths
script_path = os.path.join(os.path.dirname(__file__), "postprocess.py")
html_dir_path = os.path.join(app.outdir)

# # Call the postprocess script on the html directory
# subprocess.check_call([sys.executable, script_path, html_dir_path])
# Call the postprocess script on the html directory
subprocess.check_call([sys.executable, script_path, html_dir_path])

0 comments on commit 4fe239e

Please sign in to comment.