Skip to content
Permalink
Browse files
Merge pull request #3 from aa9863/Example
Example
  • Loading branch information
aa9863 committed Sep 14, 2018
2 parents 304d331 + 6ab5a1d commit 54b508919b7af677d4534cf292437aba416f0c6e
Show file tree
Hide file tree
Showing 13 changed files with 332 additions and 104 deletions.
@@ -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()
@@ -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()
@@ -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 ----
---

This file was deleted.

@@ -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 <https://github.coventry.ac.uk/aa9863/markdown_dissertation>. 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 <https://github.com/GR8DAN/coventry-thesis>.

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


File renamed without changes.
@@ -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
@@ -0,0 +1,3 @@
# Quick Markdown Primer

Pandoc

0 comments on commit 54b5089

Please sign in to comment.