No es necesario jinja, solo hago un replace :3

This commit is contained in:
2020-11-23 18:01:40 -03:00
parent a02d56d307
commit cff6315a1b
2 changed files with 3 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ import sys
import time import time
import shutil import shutil
from pathlib import Path from pathlib import Path
from jinja2 import Template
from markdown import markdown from markdown import markdown
from watchdog.observers import Observer from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler from watchdog.events import PatternMatchingEventHandler
@@ -14,7 +13,7 @@ src_dir = Path('src')
out_dir = Path('www') out_dir = Path('www')
with open('template.html') as f: with open('template.html') as f:
template = Template(f.read()); template = f.read();
# Creates the directory tree for the out directory based on the src directory # Creates the directory tree for the out directory based on the src directory
def create_dir_tree(path): def create_dir_tree(path):
@@ -26,7 +25,8 @@ def create_dir_tree(path):
# generates html from a md file and a jinja template # generates html from a md file and a jinja template
def generate_html(md): def generate_html(md):
return template.render(md=markdown(text=md, extensions=['codehilite'])); html = markdown(text=md, extensions=['codehilite'])
return template.replace('{{ md }}', html);
# takes a md file and puts it in a html file using generate_html # takes a md file and puts it in a html file using generate_html
def process_md(path): def process_md(path):

View File

@@ -1,4 +1,3 @@
jinja2
markdown markdown
pygments pygments
watchdog watchdog