diff --git a/.sass-lint.yml b/.sass-lint.yml
new file mode 100644
index 0000000..45bbe42
--- /dev/null
+++ b/.sass-lint.yml
@@ -0,0 +1,60 @@
+rules:
+ clean-import-paths: 0
+ extends-before-mixins: 2
+ extends-before-declarations: 2
+ force-attribute-nesting: 0
+ no-css-comments: 0
+ no-debug: 1
+ no-duplicate-properties:
+ - 2
+ -
+ exclude:
+ - src
+ - transform
+ no-ids: 0
+ no-important: 0
+ no-transition-all: 0
+ no-vendor-prefixes: 2
+ no-qualifying-elements: 0
+ no-url-protocols: 0
+ no-warn: 1
+ hex-notation:
+ - 2
+ -
+ style: uppercase
+ indentation:
+ - 2
+ -
+ size: 2
+ variable-name-format:
+ - 2
+ -
+ allow-leading-underscore: false
+ convention: hyphenatedlowercase
+ quotes:
+ - 2
+ -
+ style: double
+ property-sort-order:
+ - 2
+ -
+ order: 'concentric'
+ empty-line-between-blocks: 2
+ space-after-bang: 2
+ space-after-colon: 2
+ space-after-comma: 2
+ space-before-bang: 2
+ space-before-brace: 2
+ space-before-colon: 2
+ space-between-parens: 2
+ trailing-semicolon: 2
+ leading-zero: 0
+ single-line-per-selector: 0
+ force-pseudo-nesting: 0
+ force-element-nesting: 0
+ placeholder-in-extend: 0
+ no-url-domains: 0
+ nesting-depth:
+ - 2
+ -
+ max-depth: 5
diff --git a/circle.yml b/circle.yml
index c0e9715..f321653 100644
--- a/circle.yml
+++ b/circle.yml
@@ -6,6 +6,10 @@ machine:
dependencies:
+ pre:
+ - sudo apt install pandoc pandoc-citeproc
+ - bash scripts/before_script.sh
+
post:
- pip install -r dev-requirements.txt
@@ -15,3 +19,4 @@ test:
- flake8 md_pdf/ --ignore=E128,E501
- safety check
- bandit -r md_pdf/
+ - mdp --help
diff --git a/md_pdf/assets/static/context.js b/md_pdf/assets/static/context.js
index 90adc1b..8675777 100644
--- a/md_pdf/assets/static/context.js
+++ b/md_pdf/assets/static/context.js
@@ -21,4 +21,5 @@ function subst() {
}
}
-window.subst = subst();
+
+subst();
diff --git a/md_pdf/assets/static/style.scss b/md_pdf/assets/static/style.scss
index 5025637..1212730 100644
--- a/md_pdf/assets/static/style.scss
+++ b/md_pdf/assets/static/style.scss
@@ -3,8 +3,7 @@ body.cover {
text-align: center;
& h1 {
- font-size: 48px;
padding-top: 400px;
-
+ font-size: 48px;
}
}
diff --git a/md_pdf/assets/templates/cover-template.html b/md_pdf/assets/templates/cover-template.html
index 8675240..53f95a4 100644
--- a/md_pdf/assets/templates/cover-template.html
+++ b/md_pdf/assets/templates/cover-template.html
@@ -1,7 +1,7 @@
-
+
{{ title }}
diff --git a/md_pdf/assets/templates/footer.html b/md_pdf/assets/templates/footer.html
index 8765260..9b988e4 100644
--- a/md_pdf/assets/templates/footer.html
+++ b/md_pdf/assets/templates/footer.html
@@ -1,10 +1,9 @@
-
-
+
-
+
+
diff --git a/md_pdf/assets/templates/header.html b/md_pdf/assets/templates/header.html
index e8b7db6..91e760b 100644
--- a/md_pdf/assets/templates/header.html
+++ b/md_pdf/assets/templates/header.html
@@ -1,9 +1,9 @@
-
-
+
-
+
+
diff --git a/md_pdf/build/pdf.py b/md_pdf/build/pdf.py
index 334af73..39c550d 100644
--- a/md_pdf/build/pdf.py
+++ b/md_pdf/build/pdf.py
@@ -23,6 +23,8 @@ PDF_OPTIONS = {
"footer-html": FOOTER_FILE,
"footer-spacing": 5,
"header-spacing": 5,
+
+ "user-style-sheet": STYLE_FILE
}
@@ -34,6 +36,5 @@ def export_pdf(content, config):
content,
os.path.join(os.path.abspath(config['output_dir']), 'output.pdf'),
options=PDF_OPTIONS,
- css=STYLE_FILE,
cover=OUTPUT_COVER_FILE
)
diff --git a/md_pdf/config/__init__.py b/md_pdf/config/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/md_pdf/csl.py b/md_pdf/csl.py
index bd8f08e..3bf07c6 100644
--- a/md_pdf/csl.py
+++ b/md_pdf/csl.py
@@ -24,7 +24,6 @@ def download_csl():
bar = ProgressBar()
remove_dir(CSL_DIR)
- remove_dir(CSL_DOWNLOAD_LINK)
def download_handle(count, block_size, total_size):
bar.update(int(count * block_size * 100 / total_size))
@@ -48,6 +47,7 @@ def download_csl():
bar.finish()
logger.info("Cleaning Up...")
+ os.close(_)
shutil.copytree(CSL_TEMP_DIR, CSL_DIR)
os.remove(download_location)
remove_dir(CSL_TEMP_DIR)
diff --git a/package.json b/package.json
index 33e2150..3062185 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"description": "",
"scripts": {
"test": "npm run lint-scss && npm run lint-js",
- "lint-scss": "sass-lint -vq md_pdf/assets/static/**/*.scss",
+ "lint-scss": "sass-lint -vqc .sass-lint.yml md_pdf/assets/static/**/*.scss",
"lint-js": "eslint -c eslint-config-dabapps/base/.eslintrc md_pdf/assets/static/**/*.js"
},
"repository": {
diff --git a/scripts/before_script.sh b/scripts/before_script.sh
new file mode 100644
index 0000000..1d1adaa
--- /dev/null
+++ b/scripts/before_script.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+# 'stolen' from https://github.com/JazzCore/python-pdfkit/blob/master/travis/before-script.sh
+
+set -e
+
+sudo apt-get install -y openssl build-essential xorg libssl-dev
+wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
+tar -xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
+cd wkhtmltox
+sudo chown root:root bin/wkhtmltopdf
+sudo cp -r * /usr/
diff --git a/setup.py b/setup.py
index a357cdc..ec9d32c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-from setuptools import setup
+from setuptools import setup, find_packages
setup(
@@ -13,6 +13,8 @@ setup(
"pyscss==1.3.5",
"PyYAML==3.12"
],
+ packages=find_packages(),
+ include_package_data=True,
entry_points="""
[console_scripts]
mdp=md_pdf.cli:cli