-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/terrain_metrics
- Loading branch information
Showing
41 changed files
with
1,044 additions
and
909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
exclude production/* | ||
include ripple1d\api\templates\* | ||
recursive-include ripple1d\api\static\ * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Define variables for Sphinx | ||
SPHINXAPIDOC = sphinx-apidoc | ||
SPHINXBUILD = sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Target to run sphinx-apidoc to generate .rst files | ||
apidoc: | ||
$(SPHINXAPIDOC) -o $(SOURCEDIR)/api ../ripple1d/ | ||
|
||
# Target to run sphinx-build to generate HTML docs | ||
html: apidoc | ||
$(SPHINXBUILD) -b html $(SOURCEDIR) $(BUILDDIR) | ||
|
||
# Clean up the generated files | ||
clean: | ||
rm -rf $(BUILDDIR)/* | ||
rm -rf $(SOURCEDIR)/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import re | ||
from io import TextIOWrapper | ||
from pathlib import Path | ||
|
||
import requests | ||
|
||
CHANGE_LOG_PATH = str(Path(__file__).parent.resolve() / "source" / "change_log.rst") | ||
|
||
|
||
def get_content() -> dict: | ||
"""Get the content of the changelog from the GitHub API.""" | ||
url = "https://api.github.com/repos/Dewberry/ripple1d/releases" | ||
headers = {"Accept": "application/vnd.github.v3+json"} | ||
response = requests.get(url, headers=headers) | ||
response.raise_for_status() | ||
return response.json() | ||
|
||
|
||
def add_heading(file: TextIOWrapper): | ||
"""Add the heading for the changelog.""" | ||
file.write(".. note::\n") | ||
file.write( | ||
" Go to the `Releases <https://github.com/Dewberry/ripple1d/releases.html>`__ page for a list of all releases.\n\n" | ||
) | ||
|
||
|
||
def add_release_body(file: TextIOWrapper, body: str): | ||
"""Add the body of a release to the changelog.""" | ||
lines = body.split("\n") | ||
for l in lines: | ||
if l.startswith("# "): | ||
file.write(f"{l[2:]}") | ||
file.write(f"{'-' * len(l[2:])}\n") | ||
elif l.startswith("## "): | ||
file.write(f"{l[3:]}") | ||
file.write(f"{'^' * len(l[3:])}\n") | ||
elif l.startswith("### "): | ||
file.write(f"{l[4:]}") | ||
underline = '"' * len(l[4:]) | ||
file.write(f"{underline}\n") | ||
else: | ||
l = re.sub(r"\[([^\]]+)\]\(([^)]+)\)", r"`\1 <\2>`_", l) # fix links | ||
file.write(f"{l}\n") | ||
|
||
|
||
def add_release(file: TextIOWrapper, release: dict): | ||
"""Add a release to the changelog.""" | ||
file.write(f"{release['name']}\n") | ||
file.write(f"{'=' * len(release['name'])}\n\n") | ||
file.write(f"**Tag:** {release['tag_name']}\n\n") | ||
file.write(f"**Published at:** {release['published_at']}\n\n") | ||
file.write(f"**Author:** {release['author']['login']}\n\n") | ||
file.write(f"**Release Notes:**\n\n") | ||
add_release_body(file, release["body"]) | ||
file.write("\n\n") | ||
|
||
|
||
def build_changelog(): | ||
"""Build the changelog for the documentation.""" | ||
releases = get_content() | ||
|
||
# Write release information to an .rst file | ||
with open(CHANGE_LOG_PATH, "w") as file: | ||
add_heading(file) | ||
for release in releases: | ||
add_release(file, release) | ||
|
||
|
||
if __name__ == "__main__": | ||
build_changelog() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.