|
|
@@ -49,43 +49,54 @@ if __name__ == "__main__":
|
|
|
|
# section {events + readings}
|
|
|
|
# section {events + readings}
|
|
|
|
section_template = jinja2.Template(utils.read_file(partials['section']))
|
|
|
|
section_template = jinja2.Template(utils.read_file(partials['section']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
content_dir = pathlib.Path(conf['content'])
|
|
|
|
|
|
|
|
|
|
|
|
# events
|
|
|
|
# events
|
|
|
|
events = list(utils.get_files_in_subdir(conf['content'], 'event', 'md').values())
|
|
|
|
events_dir = content_dir / 'events'
|
|
|
|
upcoming_events = []
|
|
|
|
upcoming_events = []
|
|
|
|
previous_events = []
|
|
|
|
previous_events = []
|
|
|
|
for e in events:
|
|
|
|
|
|
|
|
p = frontmatter.load(e)
|
|
|
|
|
|
|
|
summary = f"{p['title']} - {p['date']}"
|
|
|
|
|
|
|
|
content = markdown.markdown(p.content)
|
|
|
|
|
|
|
|
detail = f"<i>When:</i> {p['date']}<br><i>Where:</i> {p['location']}<br>{content}"
|
|
|
|
|
|
|
|
el = {'summary': summary, 'detail': detail}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if read_date(p) > arrow.utcnow():
|
|
|
|
if not events_dir.exists():
|
|
|
|
upcoming_events.append(el)
|
|
|
|
print("path content/events does not exist.")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
previous_events.append(el)
|
|
|
|
events = list(utils.get_files_in_subdir(conf['content'], 'event', 'md').values())
|
|
|
|
|
|
|
|
for e in events:
|
|
|
|
|
|
|
|
p = frontmatter.load(e)
|
|
|
|
|
|
|
|
summary = f"{p['title']} - {p['date']}"
|
|
|
|
|
|
|
|
content = markdown.markdown(p.content)
|
|
|
|
|
|
|
|
detail = f"<i>When:</i> {p['date']}<br><i>Where:</i> {p['location']}<br>{content}"
|
|
|
|
|
|
|
|
el = {'summary': summary, 'detail': detail}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if read_date(p) > arrow.utcnow():
|
|
|
|
|
|
|
|
upcoming_events.append(el)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
previous_events.append(el)
|
|
|
|
|
|
|
|
|
|
|
|
upcoming = section_template.render(section_id='events', section_title="Upcoming session(s)", section_items=upcoming_events)
|
|
|
|
upcoming = section_template.render(section_id='events', section_title="Upcoming session(s)", section_items=upcoming_events)
|
|
|
|
previous = section_template.render(section_id='archive', section_title="Previous sessions", section_items=previous_events)
|
|
|
|
previous = section_template.render(section_id='archive', section_title="Previous sessions", section_items=previous_events)
|
|
|
|
|
|
|
|
|
|
|
|
# reading bibliography
|
|
|
|
# bibliography
|
|
|
|
reading = ""
|
|
|
|
reading = ""
|
|
|
|
bibliography_dir = pathlib.Path(conf['content']) / "bibliography"
|
|
|
|
bibliography_dir = content_dir / "bibliography"
|
|
|
|
bibliography = utils.ls_dir(bibliography_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for b in bibliography:
|
|
|
|
if not bibliography_dir.exists():
|
|
|
|
reading_list = utils.get_files_in_subdir(bibliography_dir, b.stem, 'md')
|
|
|
|
print("path content/bibliography does not exist.")
|
|
|
|
if not reading_list:
|
|
|
|
else:
|
|
|
|
continue
|
|
|
|
bibliography = utils.ls_dir(bibliography_dir)
|
|
|
|
reading_list = list(reading_list.values())
|
|
|
|
|
|
|
|
readings = []
|
|
|
|
|
|
|
|
for r in sorted(reading_list):
|
|
|
|
|
|
|
|
p = frontmatter.load(r)
|
|
|
|
|
|
|
|
summary = p['title']
|
|
|
|
|
|
|
|
detail = markdown.markdown(p.content)
|
|
|
|
|
|
|
|
readings.append({'summary': summary, 'detail': detail})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reading += section_template.render(section_id='readings', section_title=b.stem, section_items=readings) + "\n"
|
|
|
|
for b in bibliography:
|
|
|
|
|
|
|
|
reading_list = utils.get_files_in_subdir(bibliography_dir, b.stem, 'md')
|
|
|
|
|
|
|
|
if not reading_list:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
reading_list = list(reading_list.values())
|
|
|
|
|
|
|
|
readings = []
|
|
|
|
|
|
|
|
for r in sorted(reading_list):
|
|
|
|
|
|
|
|
p = frontmatter.load(r)
|
|
|
|
|
|
|
|
summary = p['title']
|
|
|
|
|
|
|
|
detail = markdown.markdown(p.content)
|
|
|
|
|
|
|
|
readings.append({'summary': summary, 'detail': detail})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reading += section_template.render(section_id='readings', section_title=b.stem, section_items=readings) + "\n"
|
|
|
|
|
|
|
|
|
|
|
|
# footer
|
|
|
|
# footer
|
|
|
|
if 'footer' in partials and 'footer_img' in conf:
|
|
|
|
if 'footer' in partials and 'footer_img' in conf:
|
|
|
|