summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkennyballou <kballou@onyx.boisestate.edu>2013-03-12 18:41:54 -0600
committerkennyballou <kballou@onyx.boisestate.edu>2013-03-12 18:41:54 -0600
commit6e3c50892f6d299baf253f675e14816c15b359e2 (patch)
treea7f70d9681e0c3a1b13e442de6f53a732e4e0cdf
parente5195919b0afd37cd110204564c68f3ef3df3219 (diff)
downloadxnt-6e3c50892f6d299baf253f675e14816c15b359e2.tar.gz
xnt-6e3c50892f6d299baf253f675e14816c15b359e2.tar.xz
Add clean method to tex module
-rw-r--r--docs/source/buildreference.rst7
-rw-r--r--xnt/build/tex.py17
2 files changed, 24 insertions, 0 deletions
diff --git a/docs/source/buildreference.rst b/docs/source/buildreference.rst
index eae9601..2cabe1f 100644
--- a/docs/source/buildreference.rst
+++ b/docs/source/buildreference.rst
@@ -127,3 +127,10 @@ pdflatex
Where *document* is the master tex file of the document and *path* is the
full or relative path to exectue `pdflatex` in.
+
+.. _xnt.build.tex.clean:
+.. function:: clean(path="./", remove_pdf=False)
+
+ Clean up generated output files of `pdflatex` and similar. Currently, the
+ function removes `out`, `log`, `aux`, `toc`, `tol`, `tof`, `tot`, `bbl`,
+ and `blg`. Conditionally, it will remove the generated `pdf` as well.
diff --git a/xnt/build/tex.py b/xnt/build/tex.py
index 1cd20e3..6249edf 100644
--- a/xnt/build/tex.py
+++ b/xnt/build/tex.py
@@ -56,3 +56,20 @@ def pdflatex(document,
error_codes.append(pdf(draftmode=False))
os.chdir(cwd)
return sum(error_codes)
+
+def clean(path="./", remove_pdf=False):
+ """Clean up generated files of PDF compiliation"""
+ cwd = os.getcwd()
+ os.chdir(path)
+ xnt.tasks.rm("*.out",
+ "*.log",
+ "*.aux",
+ "*.toc",
+ "*.tol",
+ "*.tof",
+ "*.tot",
+ "*.bbl",
+ "*.blg")
+ if remove_pdf:
+ xnt.tasks.rm("*.pdf")
+ os.chdir(cwd)