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
|
fname = "%s.md" % uid
|
||||||
fpath = self.args.out_md_dir / fname
|
fpath = self.args.out_md_dir / fname
|
||||||
self.changed_files.append(fpath)
|
self.changed_files.append(fpath)
|
||||||
with open(str(fpath), "w") as buf:
|
frontmatter = (
|
||||||
# preamble
|
dict(
|
||||||
buf.write("---\n")
|
key=uid,
|
||||||
yaml.safe_dump(
|
title=talk.decoded("SUMMARY").decode("utf8"),
|
||||||
dict(
|
format="conference",
|
||||||
key=uid,
|
start=talk.decoded("DTSTART"),
|
||||||
title=talk.decoded("SUMMARY").decode("utf8"),
|
end=talk.decoded("DTEND"),
|
||||||
format="conference",
|
location=self.talk_location[uid],
|
||||||
start=talk.decoded("DTSTART"),
|
duration=int(
|
||||||
end=talk.decoded("DTEND"),
|
(
|
||||||
location=self.talk_location[uid],
|
talk.decoded("DTEND") - talk.decoded("DTSTART")
|
||||||
duration=int(
|
).total_seconds()
|
||||||
(
|
// 60
|
||||||
talk.decoded("DTEND") - talk.decoded("DTSTART")
|
|
||||||
).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")
|
buf.write("---\n\n")
|
||||||
# body
|
# body
|
||||||
if "DESCRIPTION" in talk:
|
if "DESCRIPTION" in talk:
|
||||||
|
|
Loading…
Reference in a new issue