Skip to content

Commit

Permalink
Get GitHub icon to import
Browse files Browse the repository at this point in the history
  • Loading branch information
tkphd committed Sep 19, 2023
1 parent b962b7c commit a3c67de
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import subprocess
import sys
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify

sys.path.insert(0, os.path.abspath(".."))

Expand Down Expand Up @@ -84,8 +83,8 @@
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = [
".github",
"_build",
"_build/*",
"Thumbs.db",
".DS_Store",
"README.md"
Expand Down Expand Up @@ -123,7 +122,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down Expand Up @@ -199,42 +198,23 @@

# Copy Markdown files, after https://github.com/materialsinnovation/pymks/blob/master/doc/conf.py


def url_resolver(url):
"""Resolve url for both documentation and Github online.
If the url is an IPython notebook links to the correct path.
Args:
url: the path to the link (not always a full url)
Returns:
a local url to either the documentation or the Github
"""
if url[-6:] == ".ipynb":
return url[4:-6] + ".html"
else:
return url


def setup(app):
app.add_config_value(
"recommonmark_config",
{"url_resolver": url_resolver, "auto_toc_tree_section": "Contents"},
True,
)
app.add_transform(AutoStructify)


rst_directory = "rst"
img_directory = os.path.join(rst_directory, "common-diffusion")
rst_directories = [
rst_directory,
os.path.join(rst_directory, "common-diffusion"),
os.path.join(rst_directory, ".github")
]

for directory in [rst_directory, img_directory]:
for directory in rst_directories:
if not os.path.exists(directory):
os.makedirs(directory)

files_to_copy = (
"README.rst",
"LICENSE.md",
"LICENSE.rst",
"common-diffusion/diffusion.*.png",
"HiPerC.png",
".github/github.png",
)

for fpath in files_to_copy:
Expand Down

0 comments on commit a3c67de

Please sign in to comment.