-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrender_readme.sh
executable file
·33 lines (28 loc) · 1.16 KB
/
render_readme.sh
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
#!/bin/bash
export PAGE_UPDATE_TIMESTAMP="⚡$(date)⚡"
export ICS_CALENDARS=$(
for year in $(cd ICSs/ && find * -type d | sort -nr);
do
echo -e "#### Anno $year"
for file in $(cd ICSs/${year} && find *.ics -type f);
do
echo "- [$file](https://github.com/sunnyvale-it/chieri-calendari-raccolta-rifiuti/releases/download/${year}-ICS/$file)"
done
done
)
rm -r ICSs/*
export CSV_CALENDARS=$(
for year in $(cd CSVs/ && find * -type d | sort -nr);
do
echo -e "#### Anno $year"
for file in $(cd CSVs/${year} && find *.csv -type f);
do
echo "- [$file](https://github.com/sunnyvale-it/chieri-calendari-raccolta-rifiuti/releases/download/${year}-CSV/$file)"
done
done
)
rm -r CSVs/*
#echo "$ICS_CALENDARS"
perl -p -i -e "s/^Ultimo aggiornamento:.*$/Ultimo aggiornamento: $PAGE_UPDATE_TIMESTAMP/g" ./README.md
perl -0777 -p -i -e "s/(?<=### Formato iCalendar compatibile con Google Calendar, MacOS Calendar, iOS Calendar, Zimbra)(.*)(?=### Formato MS Outlook)/\n$(echo "$ICS_CALENDARS" | sed -e 's/\//\\\//g')\n/gs" ./README.md
perl -0777 -p -i -e "s/(?<=### Formato MS Outlook)(.*)(?=## Istruzioni)/\n$(echo "$CSV_CALENDARS" | sed -e 's/\//\\\//g')\n/gs" ./README.md