From 3800f43bd10871f6903fdf4a66e255464a9a3c65 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 5 Apr 2017 14:44:22 +0100 Subject: [PATCH] Restructure assets --- .gitignore | 2 +- md_pdf/assets/{ => static}/context.js | 0 md_pdf/assets/{ => static}/style.css | 0 md_pdf/assets/{ => templates}/cover-template.html | 0 md_pdf/assets/{ => templates}/footer.html | 0 md_pdf/assets/{ => templates}/header.html | 0 md_pdf/build/cover.py | 6 +++--- md_pdf/build/pdf.py | 8 ++++---- md_pdf/consts.py | 4 +++- 9 files changed, 11 insertions(+), 9 deletions(-) rename md_pdf/assets/{ => static}/context.js (100%) rename md_pdf/assets/{ => static}/style.css (100%) rename md_pdf/assets/{ => templates}/cover-template.html (100%) rename md_pdf/assets/{ => templates}/footer.html (100%) rename md_pdf/assets/{ => templates}/header.html (100%) diff --git a/.gitignore b/.gitignore index ba76f92..b43b745 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,6 @@ ENV/ .ropeproject out/ -md_pdf/assets/cover.html +md_pdf/assets/templates/cover.html md_pdf/assets/csl/ md_pdf/assets/styles-master/ diff --git a/md_pdf/assets/context.js b/md_pdf/assets/static/context.js similarity index 100% rename from md_pdf/assets/context.js rename to md_pdf/assets/static/context.js diff --git a/md_pdf/assets/style.css b/md_pdf/assets/static/style.css similarity index 100% rename from md_pdf/assets/style.css rename to md_pdf/assets/static/style.css diff --git a/md_pdf/assets/cover-template.html b/md_pdf/assets/templates/cover-template.html similarity index 100% rename from md_pdf/assets/cover-template.html rename to md_pdf/assets/templates/cover-template.html diff --git a/md_pdf/assets/footer.html b/md_pdf/assets/templates/footer.html similarity index 100% rename from md_pdf/assets/footer.html rename to md_pdf/assets/templates/footer.html diff --git a/md_pdf/assets/header.html b/md_pdf/assets/templates/header.html similarity index 100% rename from md_pdf/assets/header.html rename to md_pdf/assets/templates/header.html diff --git a/md_pdf/build/cover.py b/md_pdf/build/cover.py index d0a8b5c..dc3b3d5 100644 --- a/md_pdf/build/cover.py +++ b/md_pdf/build/cover.py @@ -1,13 +1,13 @@ from jinja2 import Template -from md_pdf.consts import ASSET_DIR +from md_pdf.consts import TEMPLATES_DIR import os import logging logger = logging.getLogger(__file__) -COVER_TEMPLATE = os.path.join(ASSET_DIR, 'cover-template.html') -OUTPUT_COVER_FILE = os.path.join(ASSET_DIR, 'cover.html') +COVER_TEMPLATE = os.path.join(TEMPLATES_DIR, 'cover-template.html') +OUTPUT_COVER_FILE = os.path.join(TEMPLATES_DIR, 'cover.html') def render_cover(config): diff --git a/md_pdf/build/pdf.py b/md_pdf/build/pdf.py index a11ce51..334af73 100644 --- a/md_pdf/build/pdf.py +++ b/md_pdf/build/pdf.py @@ -1,5 +1,5 @@ import pdfkit -from md_pdf.consts import ASSET_DIR +from md_pdf.consts import TEMPLATES_DIR, STATIC_DIR from md_pdf.build.cover import OUTPUT_COVER_FILE import os import logging @@ -7,9 +7,9 @@ import logging logger = logging.getLogger(__file__) -STYLE_FILE = os.path.join(ASSET_DIR, 'style.css') -HEADER_FILE = os.path.join(ASSET_DIR, 'header.html') -FOOTER_FILE = os.path.join(ASSET_DIR, 'footer.html') +STYLE_FILE = os.path.join(STATIC_DIR, 'style.css') +HEADER_FILE = os.path.join(TEMPLATES_DIR, 'header.html') +FOOTER_FILE = os.path.join(TEMPLATES_DIR, 'footer.html') PDF_OPTIONS = { "quiet": "", "no-pdf-compression": "", diff --git a/md_pdf/consts.py b/md_pdf/consts.py index 230f92c..a0aadb9 100644 --- a/md_pdf/consts.py +++ b/md_pdf/consts.py @@ -3,8 +3,10 @@ import os PROJECT_DIR = os.path.dirname(__file__) WORKING_DIR = os.getcwd() ASSET_DIR = os.path.join(PROJECT_DIR, 'assets') -CSL_DIR = os.path.join(ASSET_DIR, 'csl') +CSL_DIR = os.path.join(ASSET_DIR, 'csl') +TEMPLATES_DIR = os.path.join(ASSET_DIR, 'templates') +STATIC_DIR = os.path.join(ASSET_DIR, 'static') CONFIG_FILE = os.path.join(WORKING_DIR, 'mdp.yml')