From e9441296274594289b285431780f498b5fca59e2 Mon Sep 17 00:00:00 2001 From: gauthiier Date: Sun, 21 Sep 2025 07:19:06 +0200 Subject: [PATCH] desc --- .gitignore | 8 +++++- README.md | 9 +++++- content/description.md | 5 ++++ make.py | 63 +++++++++++++++++++++++++----------------- 4 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 content/description.md diff --git a/.gitignore b/.gitignore index 30719e2..d5a7d06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +conf.yml +public/ +content/events +content/bibliography + # ---> macOS # General .DS_Store @@ -5,7 +10,8 @@ .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/README.md b/README.md index 5983175..bc0e5bc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # Mathematics & Artifice -Site logics of "Mathematics & Artifice" \ No newline at end of file +Site logics of "Mathematics & Artifice" + +''' +> python -m venv venv +> source venv/bin/activate +> pip install -r requirements.txt +> python make.py +''' \ No newline at end of file diff --git a/content/description.md b/content/description.md new file mode 100644 index 0000000..3f015ed --- /dev/null +++ b/content/description.md @@ -0,0 +1,5 @@ +--- +type: 'desc' +--- + +We are a reading group based at Utrecht University interested in the historical, philosophical, and contemporary aspects of mathematics. diff --git a/make.py b/make.py index 4e63f30..d2ca9f1 100644 --- a/make.py +++ b/make.py @@ -49,43 +49,54 @@ if __name__ == "__main__": # section {events + readings} section_template = jinja2.Template(utils.read_file(partials['section'])) + content_dir = pathlib.Path(conf['content']) + # events - events = list(utils.get_files_in_subdir(conf['content'], 'event', 'md').values()) + events_dir = content_dir / 'events' upcoming_events = [] previous_events = [] - for e in events: - p = frontmatter.load(e) - summary = f"{p['title']} - {p['date']}" - content = markdown.markdown(p.content) - detail = f"When: {p['date']}
Where: {p['location']}
{content}" - el = {'summary': summary, 'detail': detail} + + if not events_dir.exists(): + print("path content/events does not exist.") + else: + 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"When: {p['date']}
Where: {p['location']}
{content}" + el = {'summary': summary, 'detail': detail} - if read_date(p) > arrow.utcnow(): - upcoming_events.append(el) - else: - previous_events.append(el) + 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) previous = section_template.render(section_id='archive', section_title="Previous sessions", section_items=previous_events) - # reading bibliography + # bibliography reading = "" - bibliography_dir = pathlib.Path(conf['content']) / "bibliography" - bibliography = utils.ls_dir(bibliography_dir) + bibliography_dir = content_dir / "bibliography" - 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}) + if not bibliography_dir.exists(): + print("path content/bibliography does not exist.") + else: + bibliography = utils.ls_dir(bibliography_dir) - 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 if 'footer' in partials and 'footer_img' in conf: