File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 5
5
- id : check-yaml
6
6
- id : end-of-file-fixer
7
7
- id : trailing-whitespace
8
+
9
+ - repo : local
10
+ hooks :
11
+ - id : malformed-event-dates
12
+ name : Malformed event date check
13
+ entry : ./_scripts/_malformeddates.sh
14
+ language : system
15
+ types : [file]
16
+ files : \.(markdown|md)$
17
+ pass_filenames : false
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ online_and_timezone=$( grep -Er --files-match ' ^online: true$' | xargs grep --files-with-match ' ^tz:' )
3
+ if [ -n " ${malformed_event_dates} " ]; then
4
+ echo " Online events should not have a time-zone. Offending files:" >&2
5
+ echo " ${malformed_event_dates} " >&2
6
+ exit 1
7
+ fi
8
+ malformed_timezones=$( grep -Er --files-match ' ^tz:[^/]*$' )
9
+ if [ -n " ${malformed_timezones} " ]; then
10
+ echo " Time-zones should be in the form 'Continent/City'. Offending files:" >&2
11
+ echo " ${malformed_timezones} " >&2
12
+ exit 1
13
+ fi
14
+ malformed_event_dates=$( grep -Er --files-without-match ' ^eventdate: [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [-+][0-9]{4}$' _events)
15
+ if [ -n " ${malformed_event_dates} " ]; then
16
+ echo " Malformed event date in:" >&2
17
+ echo " ${malformed_event_dates} " >&2
18
+ exit 1
19
+ fi
You can’t perform that action at this time.
0 commit comments