-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3 Add initial prototype from pyGRAZ meetup
- Loading branch information
Dorian Santner
committed
Dec 5, 2023
1 parent
7cf66fc
commit 39f4d28
Showing
4 changed files
with
126 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
## title: Hello Website | ||
## title: | ||
|
||
Hello Website | ||
|
||
## pub_date: 2023-12-05 | ||
|
||
## author: Thoma Aglassinger | ||
|
||
body: | ||
|
||
This is an example blog post. Not much here but that's not the point :) | ||
## This is an example blog post. Not much here but that's not the point :) | ||
|
||
## author: Thomas Aglassinger | ||
|
||
body: | ||
|
||
Die pyGRAZ-Webseite wird von einer dynamischen Django-Anwendung auf eine statisch generierte Seite umgestellt unter Verwendung des Lektor CMS. Dies beinhalte u.a. Umwandlung der Datenbankeinträge unserer Treffen seit 2008. Die liegen derzeit als JSON-Dateien vor und sollen am Ende Markdown-Dokumente sein. | ||
|
||
Das machen wir gemeinsam im Rahmen eines Coding-Dojos. | ||
|
||
Der Ablauf in bewährter Manier: Alle Teilnehmer nutzen den selben Computer, um die Aufgabe umzusetzen. Eine Person ist der Pilot, der programmiert. Eine andere Person nimmt die Rolle des Co-Piloten ein und unterstützt den Piloten beim Konzipieren und Designen. Nach 2 Minuten gibt es einen Wechsel: Der Pilot geht ins Publikum, der Co-Pilot wird zum Piloten und eine neue Person aus dem Publikum wird zum Co-Piloten. Damit ist sichergestellt, dass alle etwas beitragen können. Bei Bedarf kann sich der Co-Pilot Unterstützung aus dem Publikum holen, so dass immer etwas zu tun ist und niemand stecken bleibt. Siehe dazu auch z.B. [Coding Dojo 101](https://humberto.io/blog/coding-dojo-101/). | ||
|
||
## Das Ziel eines Dojos ist ja, Spaß zu haben und am Ende etwas neues gelernt zu haben. | ||
|
||
## pub_date: 2023-12-05 | ||
|
||
## title: pyGRAZ Website-Umstellung | ||
|
||
twitter_handle: roskakori |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import csv | ||
import pathlib | ||
from datetime import datetime | ||
|
||
from slugify import slugify | ||
|
||
CSV_FOLDER = pathlib.Path(__file__).parent / "data" | ||
BLOG_FOLDER = pathlib.Path(__file__).parent.parent / "blog" | ||
|
||
csv_names = [ | ||
"meetups_location.csv", | ||
"meetups_meetup.csv", | ||
"meetups_session.csv", | ||
"meetups_sessiontype.csv", | ||
] | ||
|
||
|
||
def csv_id_to_rows(basename: str) -> dict[str, list[dict]]: | ||
result = {} | ||
with open(CSV_FOLDER / basename, newline="") as csv_file: | ||
reader = csv.DictReader(csv_file) | ||
for row in reader: | ||
result[row["id"]] = row | ||
return result | ||
|
||
|
||
data = {basename: csv_id_to_rows(basename) for basename in csv_names} | ||
|
||
|
||
def convert(): | ||
# print(data) | ||
# keys = {k:mydata[0].keys() for k, mydata in data.items()} | ||
# pprint(keys) | ||
sessions = data["meetups_session.csv"] | ||
meetups = data["meetups_meetup.csv"] | ||
for session_id, session in sessions.items(): | ||
meetup_id = session["meetup_id"] | ||
if meetup_id == "": | ||
print("warning, sesson ohne meetup:", session_id) | ||
continue | ||
|
||
meetup = meetups[meetup_id] | ||
|
||
# chase date | ||
start_date_as_string = meetup["start_date"].replace(" ", "T") + ":00" | ||
start_date = datetime.fromisoformat(start_date_as_string) | ||
date_as_string = start_date.date().isoformat() | ||
|
||
# create folder | ||
content_directory = ( | ||
BLOG_FOLDER / f"{date_as_string}-{slugify(session['title'])}" | ||
) | ||
content_directory.mkdir(parents=True, exist_ok=True) | ||
|
||
# make content-file | ||
with open(content_directory / "contents.lr", "w") as f: | ||
f.write(f"body: \n{session['abstract']}\n") | ||
f.write("---\n") | ||
f.write("author: TODO\n") | ||
f.write("---\n") | ||
f.write(f"title: {session['title']}\n") | ||
|
||
print(CSV_FOLDER) | ||
|
||
|
||
if __name__ == "__main__": | ||
convert() |