tfixed color highlighting - canteen-info - scrape weekly menus from canteens surrounding Aarhus University
(HTM) git clone git://src.adamsgaard.dk/canteen-info
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 614864e850e4265d5dc2f873179c76062560d025
(DIR) parent 03828869089738c2e2f68dbddf4fd0219ddf9e62
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 19 Feb 2015 12:13:01 +0100
fixed color highlighting
Diffstat:
M canteeninfo.sh | 34 +++++++++++++++----------------
1 file changed, 16 insertions(+), 18 deletions(-)
---
(DIR) diff --git a/canteeninfo.sh b/canteeninfo.sh
t@@ -1,6 +1,20 @@
#!/bin/bash
out=/tmp/canteeninfo.html
+weekday=$(date +%A)
+highlight="1234567890asdfasdf"
+if [[ "$weekday" == "Monday" ]]; then
+ highlight="Mandag"
+elif [[ "$weekday" == "Tuesday" ]]; then
+ highlight "Tirsdag"
+elif [[ "$weekday" == "Wednesday" ]]; then
+ highlight="Onsdag"
+elif [[ "$weekday" == "Thursday" ]]; then
+ highlight="Torsdag"
+elif [[ "$weekday" == "Friday" ]]; then
+ highlight="Fredag"
+fi
+
echo -n "<!DOCTYPE html>
<html>
<head>
t@@ -62,21 +76,5 @@ echo -n "<!DOCTYPE html>
<a href='mailto:anders.damsgaard@geo.au.dk'>Anders</a></p>
<a href='https://github.com/anders-dc/canteen-info'>Source code</a></p>
</body>
-</html>" > $out
-
-weekday=$(date +%A)
-highlight="1234567890asdfasdf"
-if [[ "$weekday" == "Monday" ]]; then
- highlight="Mandag"
-elif [[ "$weekday" == "Tuesday" ]]; then
- highlight "Tirsdag"
-elif [[ "$weekday" == "Wednesday" ]]; then
- highlight="Onsdag"
-elif [[ "$weekday" == "Thursday" ]]; then
- highlight="Torsdag"
-elif [[ "$weekday" == "Friday" ]]; then
- highlight="Fredag"
-fi
-
-# Highlight current weekday
-cat $out | sed "s/${highlight}/<font color='red'>${highlight}<\/font>/g" > $out
+</html>" |\
+ sed "s/${highlight}/<font color='red'>${highlight}<\/font>/g" > $out