generated from sylhare/Type-on-Strap
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Events/freies hacken #74
Open
timherrm
wants to merge
9
commits into
main
Choose a base branch
from
events/freies_hacken
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
efd42af
Add script to generate Freies Hacken Events
timherrm 61f0020
:bulb: Update comment
timherrm 9d71edc
:art: Add Variables
timherrm 07dc648
:art: Save new Events to subfolder
timherrm 145a61e
:art: Add CLI Parameter
timherrm bf7174c
:memo: Update Readme
timherrm c1e9c49
:truck: Rename Script
timherrm 04543d6
:bulb: Change comment
timherrm 83c443d
:pencil2: Fix indentation
timherrm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,62 @@ | ||
import os | ||
import datetime | ||
import sys | ||
|
||
layout = "event" | ||
title = "Freies Hacken" | ||
event_description = f""" | ||
**Wann: 19:30 Uhr**\\ | ||
**Wo: Netz39 e.V.** | ||
|
||
Jeden Mittwoch treffen wir uns zum Basteln, Reparieren, Kochen und Ideen austauschen. Gäste sind gerne willkommen | ||
|
||
Bitte beachtet, dass jede dritte Woche unser Stammtisch ist, wo wir über vereinsinterne Sachen reden und erst anschließend zum gemütlichen Abend übergehen. | ||
""" | ||
folder_name = "_events" | ||
filename_prefix = "n39_freies_hacken" | ||
|
||
|
||
# Function to generate the markdown content for a specific date | ||
def generate_markdown_file(year, month, day): | ||
markdown_content = f"""--- | ||
layout: {layout} | ||
title: {title} | ||
event_date: {year}-{month:02d}-{day:02d} | ||
--- | ||
{event_description} | ||
""" | ||
|
||
folder_path = f"../{folder_name}/{year}/" | ||
filename = f"{year}-{month:02d}-{day:02d}_{filename_prefix}.md" | ||
file_path = os.path.join(folder_path, filename) | ||
|
||
if not os.path.exists(folder_path): | ||
os.makedirs(folder_path) | ||
|
||
with open(file_path, 'w', encoding='utf-8') as file: | ||
file.write(markdown_content) | ||
|
||
print(f"Markdown file '{filename}' generated successfully in the '{folder_path}' folder!") | ||
|
||
|
||
if len(sys.argv) < 2: | ||
print(f"Usage: python3 {sys.argv[0]} <year>") | ||
sys.exit() | ||
|
||
# Get year from CLI | ||
year = int(sys.argv[1]) | ||
|
||
# Calculate Wednesdays | ||
for month in range(1, 13): | ||
for day in range(1, 32): | ||
try: | ||
# Generate a date object | ||
current_date = datetime.date(year, month, day) | ||
|
||
# Check if the date is a Wednesday | ||
if current_date.weekday() == 2: | ||
generate_markdown_file(year, month, day) | ||
|
||
except ValueError: | ||
# If the day is out of range for the month, skip to the next month | ||
pass |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wollen wir diesen Output wirklich im Repo haben?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mir ist das egal, ich kann es auch einfach wieder löschen. Möchte nur verstehen, was dein Gedanke dahinter ist, das zu löschen, damit ich es fürs nächste Mal weiß 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich hab mich gefragt, was wir mit der Info im README machen - geht es darum, noch zu wissen, was dafür passiert ist? Dann würde ich die Info eher in die Commit-Message oder den PR schreiben.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Für mich war es eher ein "so führst du es aus" und "das sollte dann dabei rauskommen, wenn alles funktioniert hat".
Hat für mich als Unwissender halt Sinn gemacht das da hin zu schreiben :D
Aber ja man sieht ja im Zweifel ob eine Fehlermeldung kommt oder Dateien in den Ordner geschrieben werden