src/html.cpp

changeset 44
de22ded6d50a
parent 42
e0f3d41ae44b
--- a/src/html.cpp	Tue Feb 25 18:22:55 2025 +0100
+++ b/src/html.cpp	Tue Feb 25 18:46:17 2025 +0100
@@ -134,17 +134,19 @@
     }
 }
 
-void html::h1(const std::string& heading) {
+void html::heading_repo(const std::string& repo) {
     indent();
-    printf("<h1>%s</h1>\n", encode(heading).c_str());
+    printf("<h1>%s</h1>\n", encode(repo).c_str());
 }
 
-void html::h2(const std::string& heading) {
+void html::heading_author(const std::string& author, unsigned int total_commits) {
     indent();
-    printf("<h2>%s</h2>\n", encode(heading).c_str());
+    printf("<h2 title=\"Total commits: %u\">%s</h2>\n",
+        total_commits,
+        encode(author).c_str());
 }
 
-void html::table_begin(year y) {
+void html::table_begin(year y, const std::array<unsigned int, 12> &commits_per_month) {
     static constexpr const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
     // compute the column spans, first
     unsigned colspans[12] = {};
@@ -169,7 +171,8 @@
     puts("<th></th>");
     for (unsigned i = 0 ; i < 12 ; i++) {
         indent();
-        printf("<th scope=\"col\" colspan=\"%d\">%s</th>\n", colspans[i], months[i]);
+        printf("<th scope=\"col\" title=\"Total commits: %u\" colspan=\"%d\">%s</th>\n",
+            commits_per_month[i], colspans[i], months[i]);
     }
     indent(-1);
     puts("</tr>");

mercurial