-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import yaml | ||
from jinja2 import Template | ||
import os | ||
|
||
current_directory = os.path.dirname(os.path.abspath(__file__)) | ||
events_file = "../events.yaml" | ||
events_path = os.path.join(current_directory, events_file) | ||
template_path = os.path.join(current_directory, 'templates/readme.j2') | ||
readme_path = os.path.join(current_directory, '../README.md') | ||
|
||
# Read events from events.yaml | ||
with open(events_path, 'r') as file: | ||
events = yaml.safe_load(file) | ||
|
||
category_order = ['Conference', 'Expo', 'Workshop', 'Competition', 'Meetup'] | ||
|
||
# Group events by category and maintain the desired order | ||
events_by_category = {category: [] for category in category_order} | ||
for event in events: | ||
category = event['category'] | ||
if category in category_order: | ||
events_by_category[category].append(event) | ||
|
||
# Load the Jinja template | ||
with open(template_path, 'r') as file: | ||
template_content = file.read() | ||
|
||
template = Template(template_content) | ||
|
||
# Render the template with events | ||
rendered_template = template.render(events_by_category=events_by_category) | ||
|
||
# Write the rendered template to README.md | ||
with open(readme_path, 'w') as file: | ||
file.write(rendered_template) |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Robotic Events | ||
A repository containing upcoming events in robotics maintained by [](https://www.linkedin.com/in/knmcguire/) and [Mat Sadowski](https://www.linkedin.com/in/mateuszsadowski/). | ||
|
||
The events in this repository are rendered on [Weekly Robotics website](https://www.weeklyrobotics.com/events) | ||
|
||
## Contributing | ||
|
||
Please feel free to create a PR adding your event details. To insert the event, modify events.yml file, inserting your event using the format below. Please don't edit the README.md file directly, it is autogenerated from the yaml file. | ||
|
||
``` | ||
- title: Robotics Summit & Expo | ||
link: https://www.roboticssummit.com/ | ||
start_date: 2024-05-01 | ||
end_date: 2024-05-02 | ||
city: Boston | ||
country: US | ||
category: Expo | ||
``` | ||
|
||
Using any of the categories: | ||
* Conference | ||
* Expo | ||
* Workshop | ||
* Competition | ||
* Meetup | ||
|
||
When you insert the event, make sure it is inserted chronically with respect of start_date of other events. Please note that at this time we don't accept any events related to weaponry or weaponization. | ||
|
||
# Events | ||
|
||
{% for category, events in events_by_category.items() %} | ||
## {{ category }} | ||
|
||
{% for event in events %} | ||
* [{{ event.title }}]({{ event.link }}){% if event.end_date %}: {{ event.start_date.strftime('%b %d') }}-{{ event.end_date.strftime('%b %d, %Y') }}.{% else %}: {{ event.start_date.strftime('%b %d, %Y') }}.{% endif %} {{ event.city }}, {{ event.country }}{% endfor %} | ||
{% endfor %} |