Skip to content
Permalink
master
Go to file
1 contributor

Users who have contributed to this file

62 lines (48 sloc) 1.85 KB
"""
Python script to build a dissertaion based on Markdown / Pandoc
TODO: Options?
"""
import subprocess
import os
# --------------- CHANGE THESE TWO LINES -------------------------
OUTPUT_FILE = "Foo.pdf"
#If you Reame the Header file let me know
STU_HEADER_FILE = "Dissertation.md" #Students Header File
#ENTER ALL THE SOURCE FILES THAT YOU HAVE IN THE DISSERTAION HERE.
SOURCE_FILES = ["Example/Intro.md", "Example/Use.md"]
#Are you using the Submodule Approach
SUBMODULE = False
#Is it the Default Path
SUBMODULE_PATH="markdown-dissertation"
# --------------- END OF STUFF THAT YOU NEED TO CHANGE -------------------------
def buildCommand():
"""Build the list that we send to pandoc"""
HEADER_FILE = "Header.md"
SUB_HEADER_FILE = "SubHeader.md"
#Needed otherwise refs come on the same page
FOOTER_FILE = "References.md"
# Pandoc Template
LATEX_TEMPLATE = "Template/disso.latex"
if SUBMODULE:
HEADER_FILE = os.path.join(SUBMODULE_PATH, SUB_HEADER_FILE)
FOOTER_FILE = os.path.join(SUBMODULE_PATH, FOOTER_FILE)
LATEX_TEMPLATE = os.path.join(SUBMODULE_PATH, LATEX_TEMPLATE)
PANDOC_OPTS = ["--filter=pandoc-citeproc",
"--template={0}".format(LATEX_TEMPLATE),
"--top-level-division=chapter"]
#Actually Build the list
commandList = ["pandoc"]
commandList.extend(PANDOC_OPTS) #Add the options
commandList.append(STU_HEADER_FILE) #Students Headderfile
commandList.append(HEADER_FILE) #Header File
commandList.extend(SOURCE_FILES) #STUDENT source
commandList.append(FOOTER_FILE) #FOOTER FILE
commandList.append("-o")
commandList.append(OUTPUT_FILE)
print (commandList)
for item in commandList:
print (item)
subprocess.run(commandList)
if __name__ == "__main__":
#Build the damm thing
buildCommand()
You can’t perform that action at this time.