categories

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

View file

@ -103,27 +103,31 @@ 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(
dict(
key=uid,
title=talk.decoded("SUMMARY").decode("utf8"),
format="conference",
start=talk.decoded("DTSTART"),
end=talk.decoded("DTEND"),
location=self.talk_location[uid],
duration=int(
(
talk.decoded("DTEND") - talk.decoded("DTSTART")
).total_seconds()
// 60
),
tags=[],
frontmatter = (
dict(
key=uid,
title=talk.decoded("SUMMARY").decode("utf8"),
format="conference",
start=talk.decoded("DTSTART"),
end=talk.decoded("DTEND"),
location=self.talk_location[uid],
duration=int(
(
talk.decoded("DTEND") - talk.decoded("DTSTART")
).total_seconds()
// 60
),
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: