Tue, 25 Sep 2018 22:22:10 +0300
commented and simplified
{% 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; } .routes-legend .route { font-weight: bold } .routes-legend .night-route { color: blue } .routes-legend { border-spacing: 0px; border-collapse: separate; width: 100%; border: 1px solid rgba(0, 0, 0, 0.2); } .routes-legend tr { width: 100%; } .routes-legend .rare-group td { padding-top: 5px; padding-bottom: 5px; } .rare-group .routes:before, .common-route-group .rare-route-variant:before { content: "("; } .rare-group .routes:after, .common-route-group .rare-route-variant:after { content: ")"; } .rare-group td, .common-route-group .rare-route-variant { font-size: 15pt; } </style> </head> {% macro night_class(hour) %} {% if hour < 5 or hour >= 23 %} night {% endif %} {% endmacro %} {% macro all_night_routes(entry, description) %} {% if description['all-night-routes'](entry, description) %} night-route {% endif %} {% endmacro %} <body> <table class='aikataulu' cellspacing="0"> <thead> <tr> <th colspan='100' class='primary-heading'> <span style='float:left'><a href='?week={{previous_week}}'>⏴</a></span> <span><img src="../static/{{typename}}.png" height="96" /> {{ref}} {{name}}</span> <span style='float:right'><a href='?week={{next_week}}'>⏵</a></span> </th> </tr> <tr> <td colspan='100'> <table class='routes-legend'> {% for entry in description['description'] %} <tr class="{{entry[0] in description['rare-variant-groups'] and 'rare-group' or 'common-route-group'}}"> <td> <span class='routes'>{% for route in entry[0] %}<span class="route {{route in description['night-routes'] and 'night-route' or ''}} {{route in description['rare-variants'] and 'rare-route-variant' or ''}}">{{ route }}</span>{{ route != entry[0][-1] and '.' or '' }}{% endfor %}</span> </td> <td class="{{all_night_routes(entry, description)}} description">{{ entry[1] }}</td> </tr> {% endfor %} </table> </td> </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'><a href="../trip/{{entry['trip']}}">{{'%02d' % entry['minute']}}</a></td> {% if not description['simple'] %} <td class='minute-route'><span>{{entry['route']}}</span></td> {% endif %} {% endfor %} </tr> {% endfor %} {% endfor %} </tbody> </table> </body> </html>