all repos — py-vite @ f230d78eb6b51ce871dad02f720d983d8f0f9562

the original vite, written in python

style(make.py): follow flake8
icyphox icyph0x@protonmail.com
Sat, 17 Mar 2018 18:25:05 +0530
commit

f230d78eb6b51ce871dad02f720d983d8f0f9562

parent

7036c57fb3c5150a618ebd2e8e934dbf4bd8d31b

1 files changed, 9 insertions(+), 2 deletions(-)

jump to
M make.pymake.py

@@ -1,5 +1,4 @@

from markdown2 import markdown_path -from glob import glob import os import sys import jinja2

@@ -16,17 +15,24 @@ PAGES_PATH = 'pages/'

BUILD_PATH = 'build/' TEMPL_PATH = 'templates' + # jinja2 def jinja_render(html_text, template_file): template_loader = jinja2.FileSystemLoader('./') env = jinja2.Environment(loader=template_loader) template = env.get_template(template_file) - output = template.render(title=config.title, author=config.author, header=config.header, footer=config.footer, body=html_text) + output = template.render(title=config.title, + author=config.author, + header=config.header, + footer=config.footer, + body=html_text) return output + def markdown_render(filename): html_text = markdown_path(PAGES_PATH + filename) return html_text + def main(): template_file = TEMPL_PATH + '/template.html'

@@ -37,6 +43,7 @@ output = jinja_render(html_text, template_file)

with open(BUILD_PATH + html_file, 'w') as f: f.write(output) print('Rendered %s' % (page)) + if __name__ == "__main__": main()