mirror of
https://git.bolliret.ch/pcs/pcs-website
synced 2026-01-18 15:01:37 +01:00
Converting termine from table to list as a basis for responsive quirks
This commit is contained in:
parent
be931c9b4d
commit
17fdb4f3be
2 changed files with 75 additions and 21 deletions
|
|
@ -4,18 +4,52 @@ title: Termine
|
|||
---
|
||||
body:
|
||||
|
||||
| **Datum** | **Anlass** | **Zeit** | **Ort** |
|
||||
|-------|--------|------|-----|
|
||||
| So. 8. Dezember 2024 | Pistolen Gangfisch Schiessen | | Ermatingen |
|
||||
| Sa. 14. Dezember 2024 | Pistolen Gangfisch Schiessen | | Ermatingen |
|
||||
| So. 15. Dezember 2024 | Pistolen Gangfisch Schiessen | | Ermatingen |
|
||||
| Do. 2. Januar 2025 | 40. Appenzeller Luftpistolenmeisterschaft 2025 | | |
|
||||
| Do. 9. Januar 2025 | 40. Appenzeller Luftpistolenmeisterschaft 2025 | | |
|
||||
| So. 12. Januar 2025 | Appenzeller Lupi Meisterschaft | | |
|
||||
| Sa. 20. September 2025 | Schwaderlohschiessen | 13:00 | |
|
||||
| Di. 23. September 2025 | Schwaderlohschiessen | 17:00 | |
|
||||
| Sa. 27. September 2025 | Schwaderlohschiessen | | |
|
||||
| So. 28. September 2025 | Schwaderlohschiessen | | |
|
||||
| Do. 23. August 2029 | Bezirkssommerschiessen | 18:00 | |
|
||||
| Do. 30. August 2029 | Bezirkssommerschiessen | 18:00 | |
|
||||
* <div>Pistolen Gangfisch Schiessen</div>
|
||||
* <div>So. 8. Dezember 2024</div>
|
||||
* <div> </div>
|
||||
* <div>Ermatingen</div>
|
||||
* <div>Pistolen Gangfisch Schiessen</div>
|
||||
* <div>Sa. 14. Dezember 2024</div>
|
||||
* <div> </div>
|
||||
* <div>Ermatingen</div>
|
||||
* <div>Pistolen Gangfisch Schiessen</div>
|
||||
* <div>So. 15. Dezember 2024</div>
|
||||
* <div> </div>
|
||||
* <div>Ermatingen</div>
|
||||
* <div>40. Appenzeller Luftpistolenmeisterschaft 2025</div>
|
||||
* <div>Do. 2. Januar 2025</div>
|
||||
* <div> </div>
|
||||
* <div> </div>
|
||||
* <div>40. Appenzeller Luftpistolenmeisterschaft 2025</div>
|
||||
* <div>Do. 9. Januar 2025</div>
|
||||
* <div> </div>
|
||||
* <div> </div>
|
||||
* <div>Appenzeller Lupi Meisterschaft</div>
|
||||
* <div>So. 12. Januar 2025</div>
|
||||
* <div> </div>
|
||||
* <div> </div>
|
||||
* <div>Schwaderlohschiessen</div>
|
||||
* <div>Sa. 20. September 2025</div>
|
||||
* <div>13:00</div>
|
||||
* <div> </div>
|
||||
* <div>Schwaderlohschiessen</div>
|
||||
* <div>Di. 23. September 2025</div>
|
||||
* <div>17:00</div>
|
||||
* <div> </div>
|
||||
* <div>Schwaderlohschiessen</div>
|
||||
* <div>Sa. 27. September 2025</div>
|
||||
* <div> </div>
|
||||
* <div> </div>
|
||||
* <div>Schwaderlohschiessen</div>
|
||||
* <div>So. 28. September 2025</div>
|
||||
* <div> </div>
|
||||
* <div> </div>
|
||||
* <div>Bezirkssommerschiessen</div>
|
||||
* <div>Do. 23. August 2029</div>
|
||||
* <div>18:00</div>
|
||||
* <div> </div>
|
||||
* <div>Bezirkssommerschiessen</div>
|
||||
* <div>Do. 30. August 2029</div>
|
||||
* <div>18:00</div>
|
||||
* <div> </div>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,33 @@ echo "title: Termine"
|
|||
echo "---"
|
||||
echo "body:"
|
||||
echo ""
|
||||
echo "| **Datum** | **Anlass** | **Zeit** | **Ort** |"
|
||||
echo "|-------|--------|------|-----|"
|
||||
|
||||
#original statement:
|
||||
#awk 'BEGIN{FS=":"}/^DTSTART/{dtstart=$2}/^SUMMARY/{summary=$2}/^END:VEVENT/{print substr(dtstart,7,2)"/"substr(dtstart,5,2)"/"substr(dtstart,1,4),sprintf("%02d",substr(dtstart,10,2)+3)":"substr(dtstart,12,2),summary}' file.txt
|
||||
#from here: https://stackoverflow.com/questions/74111401/parse-ics-and-create-output
|
||||
|
||||
#OK what the heck are we doing here? TBH I even do not know exactly myself
|
||||
# First we iterate over the ICS items looking for DTSTART, SUMMARY, LOCATION and END:VEVENT
|
||||
# as soon as we found an END:VEVENT we consider that an event and start processing it
|
||||
# if we havent found DTSTART, SUMMARY OR LOCATION for that event (actually rather just since last itartion step, that's why at the end we empty those variables)
|
||||
# we insert "19700101T000000" for dtstart and " " for the other variables.
|
||||
# As whole day events have a starting time of exactly 00:00 we consider this starting time equivalent to a whole day event.
|
||||
# Yes, that' means we can't have all those midnight parties as those turn into whole day events.
|
||||
# Once we have this all collected we print that into the markdown representation of a list item with a sublist for the subsequent fields
|
||||
# We wrap each string into a div as Summaries like "40. Appenzeller Luftpistolenmeisterschaft 2025" would be rendered int a numbered list representation in markdown
|
||||
# turning it into "1. Appenzeller Luftpistolenmeisterschaft 2025" which gives it a completely different meaning
|
||||
# But! Beware: we are for one not printing the newlines (except for one at the end of eac event) and for the other our lines start with a YYYYMMDD representation of the date
|
||||
# So we have for each event a line starting with YYYYMMDD followed by the markdown representation of a list item containing a sublist with all fields terminated with a newline
|
||||
# Thats the first awk command
|
||||
# Second awk command filters all lines which are in the past (yes, most probably this could have been done in the first awk call as well)
|
||||
# Now we sort those remaining lines as they come in absolute random order (that's the reason for having an event squeezed on one line, and starting the line with YYYYMMDD representation of te event date)
|
||||
# Now we no longer need the leading timestamp so we cut it off
|
||||
# Last thing to do is to expand the list items into separate lines so they are actually markdown
|
||||
# I chose a very simple approach: As each field is wrapped in a div I just use closing div tag as indication (this breaks if a calendar-entry contains HTML with a div element)
|
||||
# Additionally after the closing tag I add an additional .
|
||||
# This is due to a limitation of the list rendered which does not render the sub-list if the last sub-list item terminates with a closing div tag
|
||||
# and finally I trim excessive linefeeds (aboave approach leads to double linefeeds after an event as the event was already a seperate line and adding linefeeds adds then one too much)
|
||||
|
||||
echo "$ICS_DATA" | awk 'BEGIN{FS=":"}
|
||||
/^DTSTART/{dtstart=$2}
|
||||
/^SUMMARY/{summary=$2}
|
||||
|
|
@ -32,8 +52,8 @@ echo "$ICS_DATA" | awk 'BEGIN{FS=":"}
|
|||
gsub(/\r/, "", summary)
|
||||
gsub(/\r/, "", location)
|
||||
if (dtstart == "") dtstart = "19700101T000000"
|
||||
if (summary == "") summary = " "
|
||||
if (location == "") location = " "
|
||||
if (summary == "") summary = " "
|
||||
if (location == "") location = " "
|
||||
|
||||
date_str = substr(dtstart, 1, 4) "-" substr(dtstart, 5, 2) "-" substr(dtstart, 7, 2)
|
||||
cmd = "LC_ALL=de_DE.UTF-8 date -d \"" date_str "\" +%a"
|
||||
|
|
@ -49,12 +69,12 @@ echo "$ICS_DATA" | awk 'BEGIN{FS=":"}
|
|||
starttime=sprintf("%02d:%02d", substr(dtstart,10,2), substr(dtstart,12,2))
|
||||
summarystring=sprintf("%s", summary)
|
||||
locationstring=sprintf("%s", location)
|
||||
wholeline=sprintf("%s | %s | %s | %s | %s |", orderstartdate, realstartdate, summarystring, starttime, location)
|
||||
gsub(/\| 00:00 \|/, "| |", wholeline)
|
||||
wholeline=sprintf("%s * <div>%s</div> * <div>%s</div> * <div>%s</div> * <div>%s</div>", orderstartdate, summarystring, realstartdate, starttime, location)
|
||||
gsub(/<div>00:00<\/div>/, "<div>\ </div>", wholeline)
|
||||
print wholeline
|
||||
dtstart=""
|
||||
summary=""
|
||||
location=""
|
||||
}' | awk -v today="$TODAY" 'substr($1,1,8) >= today' | sort | awk '{$1=""}1' | awk '{$1=$1}1'
|
||||
}' | awk -v today="$TODAY" 'substr($1,1,8) >= today' | sort | cut -d " " -f 2- | sed 's@</div>@</div>\ \n@g' | sed '/^$/d'
|
||||
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue