Skip to content

Commit

Permalink
require build type in rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjwilson committed Jun 13, 2024
1 parent 719bb0a commit 888357f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions ecoval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,23 @@ def make_header_bold(x):
webbrowser.open("file://" + os.path.abspath(f"{book_dir}/_build/latex/python.pdf"))


def rebuild():
os.system(f"jupyter-book build book/")
webbrowser.open("file://" + os.path.abspath("book/_build/html/index.html"))
def rebuild(build = None):
"""
This function will rebuild the book.
Parameters
----------
build : str
The type of the existing build. Default is None. Options are "html" or "pdf"
"""

if build is None:
raise ValueError("Please provide a build type")
os.system(f"jupyter-book build book_{build}/")
if build == "html":
webbrowser.open("file://" + os.path.abspath(f"book_{build}/_build/html/index.html"))
else:
webbrowser.open("file://" + os.path.abspath(f"book_{build}/_build/latex/python.pdf"))


try:
Expand Down

0 comments on commit 888357f

Please sign in to comment.