diff --git a/app.py b/app.py index 18770f6..cfd7cf3 100644 --- a/app.py +++ b/app.py @@ -8,13 +8,8 @@ from datetime import datetime from jinja2 import Environment, PackageLoader, select_autoescape import frontmatter import markdown -from markdown_include.include import MarkdownInclude from slugify import slugify -markdown_include = MarkdownInclude( - configs={'base_path': 'src/content/'} -) - env = Environment( loader=PackageLoader("src"), autoescape=select_autoescape() @@ -33,6 +28,21 @@ def listDocuments(params): return html +def detail(params): + param = params.split(" ") + modifier = False + + if len(param)> 2: + modifier = param[2] + + for doc in documents[param[0]]: + if doc.filename == param[1]: + template = env.select_template([f"snippets/detail.jinja"]) + html = template.render(document=doc, modifier = modifier) + return html + + return "" + def listEvents(params): param = params.split(" ") @@ -58,7 +68,8 @@ def shortcode_filter(value): shortcode_callbacks = { "show": listDocuments, - "events": listEvents + "events": listEvents, + "detail": detail } def shortcode_replacer(match): @@ -107,8 +118,7 @@ def get_page_data(path): page.content, extensions=[ 'def_list', - 'footnotes', - markdown_include]) + 'footnotes']) return page diff --git a/get_events.py b/get_events.py index e7ce765..2c03b1f 100644 --- a/get_events.py +++ b/get_events.py @@ -2,7 +2,6 @@ import os from pathlib import Path import requests import frontmatter -from datetime import datetime def get_API(URL): @@ -43,7 +42,6 @@ def get_calendar_events(): items = get_API("https://calendar.klank.school/api/events?tags=repair&start=-1") for item in items: - start_date = datetime.fromtimestamp(item["start_datetime"]).strftime('%Y%m%d') filename = f"{item['slug']}.md" filepath = os.path.join("src/content/events", filename) diff --git a/requirements.txt b/requirements.txt index ced814a..d8259ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ importlib_metadata==8.5.0 Jinja2==3.1.4 Markdown==3.7 -markdown-include==0.8.1 MarkupSafe==3.0.2 python-frontmatter==1.1.0 python-slugify==8.0.4 PyYAML==5.1 +requests==2.32.3 text-unidecode==1.3 zipp==3.21.0 diff --git a/src/content/events/lets-unrepair-things-together-6.md b/src/content/events/lets-unrepair-things-together-6.md new file mode 100644 index 0000000..b416745 --- /dev/null +++ b/src/content/events/lets-unrepair-things-together-6.md @@ -0,0 +1,41 @@ +--- +boost: [] +description:
Bring your (un)broken devices and sound makers!
+end_datetime: 1734040800 +id: 19 +image_path: null +isAnon: false +isMine: false +is_visible: true +likes: [] +media: [] +multidate: null +next: lets-unrepair-things-together-7 +online_locations: [] +parent: + id: 9 + is_visible: false + recurrent: + frequency: 1w + start_datetime: 1730998800 +parentId: 9 +place: + address: Catullusweg 11 + id: 1 + latitude: 51.8766465 + longitude: 4.5242688 + name: Catu +plain_description: Bring your (un)broken devices and sound makers! +prev: lets-unrepair-things-together-analog-video-edition +recurrent: null +resources: [] +slug: lets-unrepair-things-together-6 +start_datetime: 1734022800 +tags: +- klankschool +- noise +- repair +title: Let's (un)repair things together! +--- + +Bring your (un)broken devices and sound makers!
\ No newline at end of file diff --git a/src/content/newsletters/december.md b/src/content/newsletters/december.md index e178b82..c866f87 100644 --- a/src/content/newsletters/december.md +++ b/src/content/newsletters/december.md @@ -6,5 +6,4 @@ title: A newsletter for december Hello world, this is a newsletter being generated for the month December. Keen to check out what has been happening? Here are some repair logs i wanted to share with you. ### Repair logs in december - -{! repair-logs/20241031.md !} +{{ detail repair-logs 20241031 }} \ No newline at end of file diff --git a/src/templates/newsletters.jinja b/src/templates/newsletters.jinja new file mode 100644 index 0000000..be06623 --- /dev/null +++ b/src/templates/newsletters.jinja @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + {% block title %} + + {% if page['title'] %} +