Merge pull request #8 from sedders123/match-style-guide

Changed default styling to match university guidelines
This commit is contained in:
Jake Howard 2017-05-03 16:52:25 +01:00 committed by GitHub
commit bf222a121d
2 changed files with 22 additions and 5 deletions

View file

@ -6,4 +6,17 @@ body.cover {
padding-top: 400px; padding-top: 400px;
font-size: 48px; font-size: 48px;
} }
& h3 {
font-size: 36px;
}
& h4 {
font-size: 18px;
}
}
body, html {
line-height: 1.5;
font-size: 12px;
} }

View file

@ -7,6 +7,9 @@ import logging
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
DEFAULT_MARGIN_VERTICAL = '1.5cm'
DEFAULT_MARGIN_HORIZONTAL = '2.5cm'
STYLE_FILE = os.path.join(STATIC_DIR, 'style.css') STYLE_FILE = os.path.join(STATIC_DIR, 'style.css')
HEADER_FILE = os.path.join(TEMPLATES_DIR, 'header.html') HEADER_FILE = os.path.join(TEMPLATES_DIR, 'header.html')
FOOTER_FILE = os.path.join(TEMPLATES_DIR, 'footer.html') FOOTER_FILE = os.path.join(TEMPLATES_DIR, 'footer.html')
@ -14,11 +17,6 @@ PDF_OPTIONS = {
"quiet": "", "quiet": "",
"no-pdf-compression": "", "no-pdf-compression": "",
"margin-top": '0.6in',
"margin-bottom": '0.6in',
"margin-left": '0.4in',
"margin-right": '0.4in',
"header-html": HEADER_FILE, "header-html": HEADER_FILE,
"footer-html": FOOTER_FILE, "footer-html": FOOTER_FILE,
"footer-spacing": 5, "footer-spacing": 5,
@ -31,6 +29,12 @@ PDF_OPTIONS = {
def export_pdf(content, config): def export_pdf(content, config):
PDF_OPTIONS['title'] = config.get('title', 'Output') PDF_OPTIONS['title'] = config.get('title', 'Output')
PDF_OPTIONS['replace'] = [(key, str(value)) for key, value in config['context'].items()] PDF_OPTIONS['replace'] = [(key, str(value)) for key, value in config['context'].items()]
PDF_OPTIONS['margin-top'] = config['context'].get('margin_vertical', DEFAULT_MARGIN_VERTICAL)
PDF_OPTIONS['margin-bottom'] = config['context'].get('margin_vertical', DEFAULT_MARGIN_VERTICAL)
PDF_OPTIONS['margin-left'] = config['context'].get('margin_horizontal', DEFAULT_MARGIN_HORIZONTAL)
PDF_OPTIONS['margin-right'] = config['context'].get('margin_horizontal', DEFAULT_MARGIN_HORIZONTAL)
logger.info("Rendering PDF...") logger.info("Rendering PDF...")
return pdfkit.from_string( return pdfkit.from_string(
content, content,