25 #include "html.h" |
25 #include "html.h" |
26 |
26 |
27 #include <cstdio> |
27 #include <cstdio> |
28 |
28 |
29 namespace chrono = std::chrono; |
29 namespace chrono = std::chrono; |
|
30 using chrono::operator ""d; |
30 |
31 |
31 namespace html { |
32 namespace html { |
32 static constexpr const char* weekdays[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; |
33 static constexpr const char* weekdays[] = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; |
33 |
34 |
34 static unsigned indentation; |
35 static unsigned indentation; |
138 static constexpr const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
139 static constexpr const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
139 // compute the column spans, first |
140 // compute the column spans, first |
140 unsigned colspans[12] = {}; |
141 unsigned colspans[12] = {}; |
141 { |
142 { |
142 unsigned total_cols = 0; |
143 unsigned total_cols = 0; |
143 chrono::sys_days day{chrono::year_month_day{chrono::year{year}, chrono::month{1}, chrono::day{1}}}; |
144 chrono::sys_days day{chrono::year_month_day{chrono::year{year}, chrono::January, 1d}}; |
144 if (chrono::weekday{day}.iso_encoding() != 1) { |
145 if (chrono::weekday{day}.iso_encoding() != 1) { |
145 colspans[0] = 1; |
146 colspans[0] = 1; |
146 total_cols = 1; |
147 total_cols = 1; |
147 } |
148 } |
148 for (unsigned col = 0; col < 12; ++col) { |
149 for (unsigned col = 0; col < 12; ++col) { |