mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-11-22 07:19:53 +00:00
render articles with jinja
This commit is contained in:
parent
444c777135
commit
de3d758005
14
gronk.py
14
gronk.py
@ -256,17 +256,23 @@ def render_markdown_file(input_filepath):
|
|||||||
write markdown file to args.output_dir in html,
|
write markdown file to args.output_dir in html,
|
||||||
return list of tuple of output filepath, frontmatter post
|
return list of tuple of output filepath, frontmatter post
|
||||||
"""
|
"""
|
||||||
print(f"render_markdown_file({input_filepath})")
|
|
||||||
with open(input_filepath, encoding='utf-8') as file_pointer:
|
with open(input_filepath, encoding='utf-8') as file_pointer:
|
||||||
content = frontmatter.load(file_pointer).content
|
content = frontmatter.load(file_pointer).content
|
||||||
|
|
||||||
properties = FILEMAP.get(input_filepath)
|
properties = FILEMAP.get(input_filepath)
|
||||||
|
|
||||||
# TODO pandoc no longer handles template due to metadata passing issues, use jinja to fill in the metadata
|
|
||||||
html = render_markdown(content)
|
html = render_markdown(content)
|
||||||
|
html = JINJA_TEMPLATE_ARTICLE.render(
|
||||||
|
license=LICENSE,
|
||||||
|
content=html,
|
||||||
|
lecture_slides=properties.get("lecture_slides"),
|
||||||
|
lecture_notes=properties.get("lecture_notes"),
|
||||||
|
uuid=properties.get("uuid"),
|
||||||
|
tags=properties.get("tags"),
|
||||||
|
author=properties.get("author"),
|
||||||
|
title=properties.get("title"))
|
||||||
|
|
||||||
with open(properties['dst_path']['html'], 'w+', encoding='utf-8') as file_pointer:
|
properties['dst_path']['html'].write_text(html)
|
||||||
file_pointer.write(html)
|
|
||||||
|
|
||||||
|
|
||||||
def render_plaintext_file(input_filepath):
|
def render_plaintext_file(input_filepath):
|
||||||
|
Loading…
Reference in New Issue
Block a user