all repos — py-vite @ 83c00b04d32e91cd0c5f6c488743c4131bb5281f

the original vite, written in python

make.py (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
from markdown2 import markdown_path
from glob import glob
import os
import jinja2

# constants
PAGES_PATH = 'pages/'
BUILD_PATH = 'build/'
TEMPL_PATH = 'templates/'

# jinja2
def jinja_render(markdown_text, template_file):
    template_loader = jinja2.FileSystemLoader(searchpath=TEMPL_PATH)
    env = jinja2.Environment(loader=template_loader)
    template = env.get_template(template_file)
    output = template.render(body=markdown_text)
    return output