# HG changeset patch # User Mike Becker # Date 1747655899 -7200 # Node ID 7e099403e5b0bc2e65a7450538d9060814ef442c # Parent 2cb7fdd2ba188352d8351e2258009ee7cf6286f9 make charts identifiable with a query - fixes #608 diff -r 2cb7fdd2ba18 -r 7e099403e5b0 src/html.cpp --- a/src/html.cpp Mon May 19 13:30:18 2025 +0200 +++ b/src/html.cpp Mon May 19 13:58:19 2025 +0200 @@ -134,9 +134,21 @@ } } +void html::chart_begin(const std::string& repo, const std::string& author) { + indent(); + printf("
\n", + encode(repo).c_str(), encode(author).c_str()); + indentation++; +} + +void html::chart_end() { + indent(-1); + puts("
"); +} + void html::heading_repo(const std::string& repo) { indent(); - printf("

%s

\n", encode(repo).c_str()); + printf("

%1$s

\n", encode(repo).c_str()); } void html::heading_author(const std::string& author, unsigned int total_commits) { @@ -179,8 +191,7 @@ } void html::table_end() { - indentation--; - indent(); + indent(-1); puts(""); } diff -r 2cb7fdd2ba18 -r 7e099403e5b0 src/html.h --- a/src/html.h Mon May 19 13:30:18 2025 +0200 +++ b/src/html.h Mon May 19 13:58:19 2025 +0200 @@ -36,6 +36,8 @@ void open(bool fragment); void close(bool fragment); + void chart_begin(const std::string& repo, const std::string& author); + void chart_end(); void heading_repo(const std::string& repo); void heading_author(const std::string& author, unsigned int total_commits); void table_begin(std::chrono::year y, const std::array &commits_per_month); diff -r 2cb7fdd2ba18 -r 7e099403e5b0 src/main.cpp --- a/src/main.cpp Mon May 19 13:30:18 2025 +0200 +++ b/src/main.cpp Mon May 19 13:58:19 2025 +0200 @@ -271,6 +271,7 @@ html::heading_repo(repo); h1_rendered = true; } + html::chart_begin(repo, author); const auto commits_per_month = heatmap.commits_per_month(repo, author, report_year); const auto total_commits = std::accumulate(commits_per_month.begin(), commits_per_month.end(), 0u); @@ -280,7 +281,7 @@ // initialize counters unsigned column = 0, row = 0; - // initialize first day (which must be a Monday, possibly the year before) + // initialize the first day (which must be a Monday, possibly the year before) sys_days day_to_check = January / Monday[1] / report_year; if (year_month_day{day_to_check}.day() != 1d) { day_to_check -= days{7}; @@ -289,7 +290,7 @@ // remember the starting point auto start = day_to_check; - // now add all entries for Monday, Tuesdays, etc. always starting back in january + // now add all entries for Monday, Tuesdays, etc. always starting back in January while (true) { html::row_begin(row); @@ -330,6 +331,7 @@ } html::table_end(); + html::chart_end(); } } html::close(settings.fragment);