Sun, 07 Jan 2018 00:56:15 +0200
fix parsing
{% from "macros.html" import route_rep %} <html> <head> <link rel="icon" type="image/png" href="../static/favicon.png" /> <link rel="stylesheet" type="text/css" href="../static/style.css" /> <meta charset='UTF-8' /> <title>{{name}}</title> <style> .minute-time { font-weight: bold; } td.minute-time { width: 20pt; text-align: right; border-left: 1px solid gray; } td.minute-route { width: 0; margin: 0; padding-left: 0; padding-right: 3pt; text-align: left; } .minute-route span { font-size: 75%; } .hour-column { width: 20pt; } /* * Working days */ tr.working-day td.minute-time { border-left: 1px solid #0f2e4d; } .aikataulu tr.working-day td, .aikataulu tr.working-day th { border-top: 1px solid #0f2e4d; } .aikataulu tr.working-day { background-color: #adcae6; } .aikataulu tbody tr.working-day:nth-child(even) { background-color: #8fa7bf; } .aikataulu tr.working-day.night { background-color: #1f2933; color: white; } .aikataulu tbody tr.working-day.night:nth-child(even) { background-color: #2f3e4d; color: white; } /* * Satuday */ tr.saturday td.minute-time { border-left: 1px solid #194d0f; } .aikataulu tr.saturday td, .aikataulu tr.saturday th { border-top: 1px solid #194d0f; } .aikataulu tr.saturday { background-color: #b6e6ad; } .aikataulu tbody tr.saturday:nth-child(even) { background-color: #97bf8f; } .aikataulu tr.saturday.night { background-color: #30402d; color: white; } .aikataulu tbody tr.saturday.night:nth-child(even) { background-color: #4c6647; color: white; } /* * Sunday */ tr.sunday td.minute-time { border-left: 1px solid #4d132d; } .aikataulu tr.sunday td, .aikataulu tr.sunday th { border-top: 1px solid #4d132d; } .aikataulu tr.sunday { background-color: #e68ab8; } .aikataulu tbody tr.sunday:nth-child(even) { background-color: #bf7399; } .aikataulu tr.sunday.night { background-color: #4d2e3d; color: white; } .aikataulu tbody tr.sunday.night:nth-child(even) { background-color: #331f29; color: white; } </style> </head> {% macro night_class(hour) %} {% if hour < 5 or hour >= 23 %} night {% endif %} {% endmacro %} <body> <table class='aikataulu' cellspacing="0"> <thead> <tr> <th colspan='100' class='primary-heading'> <span><img src="../static/pysäkki.png" height="96" /> {{ref}} {{name}}</span> </th> </tr> </thead> <tbody> {% for day in week %} <tr class='{{day["day-class"]}}'> <th colspan='100'>{{day['day'].strftime('%a %e.%m.')}}</th> </tr> {% for hour, hour_schedule in day['schedule'].items() %} <tr class='{{day["day-class"]}} {{night_class(hour)}}'> <th class='hour-column {{night_class(hour)}}'>{{hour}}</th> {% for entry in hour_schedule %} <td class='minute-time'><span>{{'%02d' % entry['minute']}}</span></td> <td class='minute-route'><span>{{entry['route']}}</span></td> {% endfor %} </tr> {% endfor %} {% endfor %} </tbody> </table> </body> </html>