-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabout.qmd
More file actions
41 lines (34 loc) · 1.28 KB
/
about.qmd
File metadata and controls
41 lines (34 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: "Schedule"
execute:
echo: false
---
```{python}
import pandas as pd
import markdown
from IPython.display import HTML, display
# Read the schedule CSV (path relative to the project root)
df = pd.read_csv('data/schedule.csv')
def md_to_html(text):
if pd.isna(text) or str(text).strip() == '':
return ''
# convert markdown to HTML (extensions=['extra'] supports lists/tables)
return markdown.markdown(str(text), extensions=['extra'])
def slides_to_button(url):
if pd.isna(url) or str(url).strip() == '':
return ''
return f'<a href="{url}" target="_blank" class="slides-btn">📊 Slides</a>'
# Convert Markdown in these columns to HTML so the HTML is rendered in Quarto
for col in ['Assignment', 'Required Reading', 'Materials']:
if col in df.columns:
df[col] = df[col].fillna('').apply(md_to_html)
# Render Slides column as styled buttons
if 'Slides' in df.columns:
df['Slides'] = df['Slides'].fillna('').apply(slides_to_button)
# Render one table per Unit
for unit in df['Unit'].unique():
display(HTML(f"<h2>{unit}</h2>"))
sub = df[df['Unit'] == unit][['Date','Topic','Slides','Assignment','Required Reading','Materials']]
html = sub.to_html(index=False, escape=False, classes='schedule-table')
display(HTML(html))
```