Allow scss styles
This commit is contained in:
parent
3800f43bd1
commit
490263f7cd
|
@ -89,5 +89,6 @@ ENV/
|
|||
|
||||
out/
|
||||
md_pdf/assets/templates/cover.html
|
||||
md_pdf/assets/static/style.css
|
||||
md_pdf/assets/csl/
|
||||
md_pdf/assets/styles-master/
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
body.cover {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body.cover h1 {
|
||||
font-size: 48px;
|
||||
padding-top: 400px;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
body.cover {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
|
||||
& h1 {
|
||||
font-size: 48px;
|
||||
padding-top: 400px;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
from md_pdf.build.md import read_files
|
||||
from md_pdf.build.pandoc import build_document, output_html
|
||||
from md_pdf.build.cover import render_cover
|
||||
from md_pdf.build.css import render_css
|
||||
from md_pdf.build.pdf import export_pdf
|
||||
import os
|
||||
import logging
|
||||
|
@ -16,4 +17,5 @@ def build(config):
|
|||
output_html(doc, os.path.abspath(config['output_dir']))
|
||||
if 'pdf' in config['output_formats']:
|
||||
render_cover(config)
|
||||
render_css()
|
||||
export_pdf(doc, config)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
from scss import Compiler
|
||||
from md_pdf.consts import STATIC_DIR
|
||||
from md_pdf.build.pdf import STYLE_FILE
|
||||
import os
|
||||
|
||||
|
||||
STYLE_SRC_FILE = os.path.join(STATIC_DIR, 'style.scss')
|
||||
|
||||
|
||||
def render_css():
|
||||
compiler = Compiler()
|
||||
with open(STYLE_SRC_FILE) as f:
|
||||
style = f.read()
|
||||
with open(STYLE_FILE, 'w') as f:
|
||||
data = compiler.compile_string(style)
|
||||
f.write(data)
|
||||
return data
|
Reference in New Issue