diff --git a/Build-Example.py b/Build-Example.py new file mode 100644 index 0000000..69b64af --- /dev/null +++ b/Build-Example.py @@ -0,0 +1,62 @@ +""" +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() diff --git a/Build.py b/Build.py new file mode 100644 index 0000000..2a59ee3 --- /dev/null +++ b/Build.py @@ -0,0 +1,58 @@ +""" +Python script to build a dissertaion based on Markdown / Pandoc + +TODO: Options? +""" + +import subprocess +import os + +# --------------- CHANGE THESE TWO LINES ------------------------- +OUTPUT_FILE = "Disso.pdf" + +#If you Reame the Header file you will need to let the script know. +STU_HEADER_FILE = "Dissertation.md" #Students Header File + +#ENTER ALL THE SOURCE FILES THAT YOU HAVE IN THE DISSERTAION HERE. +SOURCE_FILES = [] + +#Are you using the Recommended Submodule Approach +SUBMODULE = True + +#If you rename the Templates repository, Let the script know. +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) + subprocess.run(commandList) + + +if __name__ == "__main__": + #Build the damm thing + buildCommand() diff --git a/Dissertation.md b/Dissertation.md new file mode 100644 index 0000000..cd1b508 --- /dev/null +++ b/Dissertation.md @@ -0,0 +1,24 @@ +--- +# ----- THINGS THAT YOU NEED TO CHANGE ---- +author: "Your Name" +title: "Project Title" + +# Keywords associated with your project +keywords: Comma, Seperated, Keywords + +degreetitle: 'BSc: Ethical Hacking and cybersecurity' + +#Ethics form, REPLACE THIS WITH YOUR ONE +PDF-ethics: Supporting/ethics-certificate.pdf + +#Origianlity Statement: REPLACE THIS WITH YOURS +PDF-declaration: Supporting/submission-declaration.pdf + +#Finally the Bibtex file for your references. +bibliography: example-bib.bib + +#Font to use +fontfamily: helvet + +# -------- LEAVE THE THINGS BELOW HERE ALONE ---- +--- diff --git a/EG-Intro.md b/EG-Intro.md deleted file mode 100644 index 31a87de..0000000 --- a/EG-Intro.md +++ /dev/null @@ -1,49 +0,0 @@ -# Introduction - -You can now replace this with whatever content you need, I would have a file per section (as it looks nicer) -Then modify the build.sh script to include the files in order. - -For example Original script looks like this - -~~~ bash -#!/bin/sh - -pandoc 02-Originallity_Statement.md -o /tmp/02-Originallity_Statement.tex - - -pandoc --template=Template/disso.latex --top-level-division=chapter --filter=pandoc-citeproc \ - Frontpage.md \ - 01-intro.md \ - References.md \ --o Dissertation.pdf -~~~ - - -If you add a new file 02-LitReview.md you need to modfy to be - -~~~ bash -#!/bin/sh - -pandoc 02-Originallity_Statement.md -o /tmp/02-Originallity_Statement.tex - - -pandoc --template=Template/disso.latex --top-level-division=chapter --filter=pandoc-citeproc \ - Frontpage.md \ - 01-intro.md \ - 02-LitReview.md \ - References.md \ --o Dissertation.pdf -~~~ - - - - -This is a section - -## Subsections Should also work - -I hope very much - -[@goldsmith2010spanish] - - diff --git a/Example/Intro.md b/Example/Intro.md new file mode 100644 index 0000000..dcd9d8f --- /dev/null +++ b/Example/Intro.md @@ -0,0 +1,38 @@ +# Introduction + +This template lets you write awesome looking Dissertations in Markdown. + +## Why would you want to do this + + - It looks better + - You have nicer references + - You can use whatever tools you want to write (IE not stuck with Word) + +## Installation Instructions + +### Getting the Template +TODO: Instructions on Submodules etc here. + +First we want to download the Template, which can be found at . There are two options here: + + 1. Clone my Repository + 1. Make use of Submodules to do it + +### Other Requirements + +You will also need a copy of: + + - Pandoc + - LaTeX + +## Behind the Scenes + +Template is based on the (unofficial) Latex Coventry Universtiy Thesis +template . + +Pandoc is used to convert from Markdown to text, with some custom +export templates to glue everything together. + +It should work on Windows / Mac and Linux + + diff --git a/Lorum.md b/Example/Lorum.md similarity index 100% rename from Lorum.md rename to Example/Lorum.md diff --git a/Example/Use.md b/Example/Use.md new file mode 100644 index 0000000..fb409c6 --- /dev/null +++ b/Example/Use.md @@ -0,0 +1,73 @@ +# Using the Template + +## Step 1: Modify the **Dissertaion.md** file. + +This file contains the metadata used to generate the title page etc. +There isn't a huge amount that needs changing here, and it should be +self explanatory. + +~~~ {.yaml} +# ----- THINGS THAT YOU NEED TO CHANGE ---- +author: "Your Name" +title: "Project Title" + +# Keywords associated with your project +keywords: Comma, Seperated, Keywords + +degreetitle: 'BSc: Ethical Hacking and cybersecurity' + +# Ethics form, REPLACE THIS WITH YOUR ONE +PDF-ethics: Supporting/ethics-certificate.pdf + +# Origianlity Statement: REPLACE THIS WITH YOURS +PDF-declaration: Supporting/submission-declaration.pdf + +# Finally the Bibtex file for your references. +bibliography: example-bib.bib + +# Font to use (I would leave this) +fontfamily: helvet +~~~ + + +## Step 2: Create some Content + +You next need to create any content. +I would recommend creating *One file per chapter* + +A Basic Markdown Primer can be found in [LINK] +I am also putting together some docs on how I go about writing things + +## Step 3: Modify the Build script + +You will also need to modify the script that builds the dissertation **Build.py** +As with the config file, there are only a couple of lines that you should need to change. + + - Add any source files to the list of source files + - If you want, modify the name of the output file + +~~~ {.python} +# --------------- CHANGE THESE TWO LINES ------------------------- +OUTPUT_FILE = "Disso.pdf" + +#ENTER ALL THE SOURCE FILES THAT YOU HAVE IN THE DISSERTAION HERE. +SOURCE_FILES = ["EG-Intro.md"] +# --------------- END OF STUFF THAT YOU NEED TO CHANGE ------------------------- +~~~ + +## Step 4: Build the Document + +We can now build the document using the script + +Either on the Command line. + +~~~ +python Build.py +~~~ + +Or by double clicking in you like Window Managers. + +## Optional: + + - Commit all your files using Git + - Share the repository with your supervisor diff --git a/Example/Writing.md b/Example/Writing.md new file mode 100644 index 0000000..81182b2 --- /dev/null +++ b/Example/Writing.md @@ -0,0 +1,3 @@ +# Quick Markdown Primer + +Pandoc diff --git a/Frontpage.md b/Header.md similarity index 57% rename from Frontpage.md rename to Header.md index 96bbdea..9b4719a 100644 --- a/Frontpage.md +++ b/Header.md @@ -1,51 +1,35 @@ ---- -author: Your Name -title: "Project Title" - -documentclass: Template/Classes/CUPhDThesis -classoption: - - a4paper - - 10pt - - numbered - - print - - index - - oneside - -toc: true -toc-depth: 2 -lof: true -lot: false - -keywords: Comma, Seperated, Keywords - - -fontfamily: helvet -header-includes: - - \renewcommand{\familydefault}{\sfdefault} - - \renewcommand{\chaptername}{} - - \renewcommand{\thechapter}{} - - -dept: 'Faculty of Enginnering and Computing' -university: 'Coventry University' -crest: 'Template/Figs/CULogo.pdf' -degreetitle: 'BSc: Ethical Hacking and cybersecurity' - -#Ethics form, REPLACE THIS WITH YOUR ONE -PDF-ethics: Supporting/ethics-certificate.pdf - -#Choice of ither a printied and scanned Originality form -#PDF-declaration: Supporting/submission-declaration.pdf - -#OR Nates, awesome Markdown one -TEX-declaration: Supporting/OriginallityStatement.tex - -bibliography: example-bib.bib - -#Bibliograpy Style -csl: Template/harvard-coventry-university.csl - -#If we are using biblatex instead -biblatexoptions: backend=biber, style=authoryear, sorting=nty, natbib=true -biblio-title: "References" ---- +--- +documentclass: Template/Classes/CUPhDThesis +classoption: + - a4paper + - 10pt + - numbered + - print + - index + - oneside + +toc: true +toc-depth: 2 +lof: true +lot: false + +header-includes: + - \renewcommand{\familydefault}{\sfdefault} + - \renewcommand{\chaptername}{} + - \renewcommand{\thechapter}{} + + +dept: 'Faculty of Enginnering and Computing' +university: 'Coventry University' +crest: 'Template/Figs/CULogo.pdf' + +#Bibliograpy Style +csl: Template/harvard-coventry-university.csl + +#OR Nates, awesome Markdown one +#TEX-declaration: Supporting/OriginallityStatement.tex + +#If we are using biblatex instead +biblatexoptions: backend=biber, style=authoryear, sorting=nty, natbib=true +biblio-title: "References" +--- diff --git a/Makefile b/Makefile index 2a08bf9..2d65697 100755 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ # If we have multiple inputs we we can stick them here # NOTE, It is important they are in order # Again we can pass this through the command line -SOURCES = Frontpage.md EG-Intro.md Lorum.md References.md -TARGET = Dissertaion.pdf +SOURCES = Dissertation.md References.md +TARGET = #Report Export Options PDF_PANDOC_OPTIONS = --filter=pandoc-citeproc --template=Template/disso.latex --top-level-division=chapter @@ -36,5 +36,5 @@ endif %.tex: %.md # Old way of doing it, now dealt with through target # #pandoc $(PANDOC_OPTIONS) -o $@ $< - pandoc $(TEX_PANDOC_OPTIONS) -s $(SOURCES) -o Foo.tex + pandoc $(TEX_PANDOC_OPTIONS) -s $(SOURCES) -o $(TARGET) #$(TARGET) diff --git a/SubHeader.md b/SubHeader.md new file mode 100644 index 0000000..6da308c --- /dev/null +++ b/SubHeader.md @@ -0,0 +1,35 @@ +--- +documentclass: markdown-dissertation/Template/Classes/CUPhDThesis +classoption: + - a4paper + - 10pt + - numbered + - print + - index + - oneside + +toc: true +toc-depth: 2 +lof: true +lot: false + +header-includes: + - \renewcommand{\familydefault}{\sfdefault} + - \renewcommand{\chaptername}{} + - \renewcommand{\thechapter}{} + + +dept: 'Faculty of Enginnering and Computing' +university: 'Coventry University' +crest: 'markdown-dissertation/Template/Figs/CULogo.pdf' + +#Bibliograpy Style +csl: markdown-dissertation/Template/harvard-coventry-university.csl + +#OR Nates, awesome Markdown one +#TEX-declaration: Supporting/OriginallityStatement.tex + +#If we are using biblatex instead +biblatexoptions: backend=biber, style=authoryear, sorting=nty, natbib=true +biblio-title: "References" +--- diff --git a/Supporting/submission-declaration.pdf b/Supporting/submission-declaration.pdf new file mode 100644 index 0000000..368f84a Binary files /dev/null and b/Supporting/submission-declaration.pdf differ diff --git a/build.sh b/build.sh index 789eccd..c15e60e 100755 --- a/build.sh +++ b/build.sh @@ -8,5 +8,5 @@ pandoc --template=Template/disso.latex --top-level-division=chapter --filter=pan EG-Intro.md \ Lorum.md \ References.md \ - -o Dissertation.pdf + -o Dissertation.tex