Skip to content
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

Change web schedule export to json #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions templates/schedule/web_schedule_template.html

This file was deleted.

9 changes: 6 additions & 3 deletions zosia_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def has_lecture(events: List[Dict[str, Any]]) -> bool:
return schedule


def export_schedule_to_json(schedule: List[Dict[str, Any]]) -> None:
with open(f"{TARGET_DIR}/web_schedule.json", "w", encoding="utf-8") as file:
file.write(json.dumps(schedule))


def get_options(path: str) -> List[str]:
return [f.rstrip(".yaml") for f in os.listdir(path)]

Expand Down Expand Up @@ -301,9 +306,7 @@ def main() -> None:
})

# Web schedule for zosia-site
render_document("schedule/web_schedule_template.html", {
"days": schedule
}, "web_schedule", True)
export_schedule_to_json(schedule)

if render_all or args.render.startswith('identifier'):
# Identifier
Expand Down