categories
This commit is contained in:
parent
92813b05ee
commit
f7938c3025
1 changed files with 24 additions and 20 deletions
44
ics2mdwn.py
44
ics2mdwn.py
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue