Skip to content

Commit

Permalink
de-duplicate docs/_static/(examples|phase_diagram).png
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Mar 28, 2023
1 parent 443987f commit 3f35386
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Binary file removed docs/_static/examples.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs_rst/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ One of the ways you can contribute is to fork the matgenb repo and add your own

Below are a quick look at some of the graphical output possible.

.. figure:: _static/examples.png
.. figure:: _static/phase_diagram.png
:width: 100%
:alt: Examples
:align: center
Expand Down
16 changes: 8 additions & 8 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ def make_doc(ctx):
:param ctx:
"""
with open("CHANGES.rst") as f:
contents = f.read()
with open("CHANGES.rst") as file:
contents = file.read()

toks = re.split(r"\-{3,}", contents)
n = len(toks[0].split()[-1])
changes = [toks[0]]
changes.append("\n" + "\n".join(toks[1].strip().split("\n")[0:-1]))
changes = ("-" * n).join(changes)

with open("docs_rst/latest_changes.rst", "w") as f:
f.write(changes)
with open("docs_rst/latest_changes.rst", "w") as file:
file.write(changes)

with cd("docs_rst"):
ctx.run("cp ../CHANGES.rst change_log.rst")
ctx.run("rm pymatgen.*.rst", warn=True)
ctx.run("sphinx-apidoc --implicit-namespaces --separate -d 7 -o . -f ../pymatgen")
ctx.run("rm *.tests.*rst")
for f in glob("*.rst"):
if f.startswith("pymatgen") and f.endswith("rst"):
for file in glob("*.rst"):
if file.startswith("pymatgen") and file.endswith("rst"):
new_output = []
sub_output = []
sub_package = False
with open(f) as fid:
with open(file) as fid:
for line in fid:
clean = line.strip()
if clean == "Subpackages":
Expand All @@ -67,7 +67,7 @@ def make_doc(ctx):
sub_package = False
sub_output = []

with open(f, "w") as fid:
with open(file, "w") as fid:
fid.write("".join(new_output))
ctx.run("make html")

Expand Down

0 comments on commit 3f35386

Please sign in to comment.