Skip to content
Snippets Groups Projects
Commit 925a1fb9 authored by James Vasile's avatar James Vasile
Browse files

Don't jinjify if there's no metadata

If a document comes in and there's no yaml frontmatter, we don't
jinjify.  You might not need any yaml frontmatter metadata but still
want jinja features (e.g. jinja macros).  In that case, add a dummy
var.

The reason for doing this is that legacy docs don't have any
frontmatter, and this is a convenient way to distinguish them.
parent 5f6b3b49
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ for r in regex:
regex[r] = re.compile(regex[r])
def run_p(text, meta):
return meta != {}
return meta.get('legacy', '') != "legacy"
# We're not using this func right now, but I do want to add markdown
......
......@@ -52,6 +52,8 @@ def cli(filename, output, option, plugin):
doc = frontmatter.load(filename)
text = doc.content
meta = doc.metadata
if meta=={}:
meta['legacy'] = "legacy"
meta['input_filename'] = filename
meta['output_filename'] = output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment