forked from sunnyvale-it/chieri-calendari-raccolta-rifiuti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
render_readme.sh
executable file
·31 lines (26 loc) · 1.13 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
#!/bin/bash
export PAGE_UPDATE_TIMESTAMP="⚡$(date)⚡"
export ICS_CALENDARS=$(
for year in $(cd ICSs/ && find * -type d);
do
echo -e "#### Anno $year"
for file in $(cd ICSs/${year} && find *.ics -type f);
do
echo "- [$file](https://raw.githubusercontent.com/sunnyvale-it/chieri-calendari-raccolta-rifiuti/master/ICSs/${year}/$file)"
done
done
)
export CSV_CALENDARS=$(
for year in $(cd CSVs/ && find * -type d);
do
echo -e "#### Anno $year"
for file in $(cd CSVs/${year} && find *.csv -type f);
do
echo "- [$file](https://raw.githubusercontent.com/sunnyvale-it/chieri-calendari-raccolta-rifiuti/master/CSVs/${year}/$file)"
done
done
)
#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