categories

This commit is contained in:
boyska 2021-08-19 18:31:09 +02:00
parent 92813b05ee
commit f7938c3025

View file

@ -103,10 +103,7 @@ class HugoConverter(Converter):
fname = "%s.md" % uid
fpath = self.args.out_md_dir / fname
self.changed_files.append(fpath)
with open(str(fpath), "w") as buf:
# preamble
buf.write("---\n")
yaml.safe_dump(
frontmatter = (
dict(
key=uid,
title=talk.decoded("SUMMARY").decode("utf8"),
@ -120,10 +117,17 @@ class HugoConverter(Converter):
).total_seconds()
// 60
),
tags=[],
),
buf,
)
if "CATEGORIES" in talk:
frontmatter["tags"] = [str(t) for t in talk.get("CATEGORIES").cats]
else:
frontmatter["tags"] = []
if 'base' in frontmatter['tags']:
frontmatter['level'] = 'Principiante'
with open(str(fpath), "w") as buf:
buf.write("---\n")
yaml.safe_dump(frontmatter, buf)
buf.write("---\n\n")
# body
if "DESCRIPTION" in talk: