From 76e405c175edef43b610ce508b106b609212067a Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 11:54:18 -1000 Subject: Wrap the dates in time elements --- assets/cgit.css | 24 ++++++++++++------------ source/ui-commit.c | 6 ++++-- source/ui-shared.c | 15 ++++++++++++--- source/ui-tag.c | 7 +++++-- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/assets/cgit.css b/assets/cgit.css index 5f6ad42..dbf76e9 100644 --- a/assets/cgit.css +++ b/assets/cgit.css @@ -1099,37 +1099,37 @@ div#cgit ul.pager .current { /* Ages / line counts */ -div#cgit span.age-mins, -div#cgit span.age-hours, -div#cgit span.age-days, -div#cgit span.age-weeks, -div#cgit span.age-months, -div#cgit span.age-years { +div#cgit time.age-mins, +div#cgit time.age-hours, +div#cgit time.age-days, +div#cgit time.age-weeks, +div#cgit time.age-months, +div#cgit time.age-years { white-space: nowrap; } -div#cgit span.age-mins { +div#cgit time.age-mins { font-weight: bold; color: var(--age-mins); } -div#cgit span.age-hours { +div#cgit time.age-hours { color: var(--age-hours); } -div#cgit span.age-days { +div#cgit time.age-days { color: var(--age-days); } -div#cgit span.age-weeks { +div#cgit time.age-weeks { color: var(--age-weeks); } -div#cgit span.age-months { +div#cgit time.age-months { color: var(--age-months); } -div#cgit span.age-years { +div#cgit time.age-years { color: var(--age-years); } diff --git a/source/ui-commit.c b/source/ui-commit.c index 4838210..5a71954 100644 --- a/source/ui-commit.c +++ b/source/ui-commit.c @@ -34,9 +34,11 @@ static void print_ident_row(const char *role, const char *name, html_txt(email); } cgit_close_filter(ctx.repo->email_filter); - html(""); + html("\n"); } static int print_parent_rows(struct commit *commit, const char *rev, diff --git a/source/ui-shared.c b/source/ui-shared.c index 7a2255e..1f45520 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -289,9 +289,16 @@ static struct date_mode configured_date_mode(void) return mode; } +/* + * Dates render as time elements, whose datetime attribute wants the strict + * ISO 8601 form with the T separator rather than the space git prints by + * default. + */ static void print_abs_date(time_t t, int tz) { - html(""); html_txt(show_date(t, tz, configured_date_mode())); @@ -301,9 +308,11 @@ static void print_abs_date(time_t t, int tz) static void print_rel_date(time_t t, int tz, double count, const char *class, const char *suffix) { - htmlf("%.0f %s", count, suffix); + htmlf("'>%.0f %s", count, suffix); } static char *http_date(time_t t) diff --git a/source/ui-tag.c b/source/ui-tag.c index 7020ed7..8bfbd8e 100644 --- a/source/ui-tag.c +++ b/source/ui-tag.c @@ -75,10 +75,13 @@ static void print_annotated_tag(const char *revname, html_txt(revname); htmlf(" (%s)\n", oid_to_hex(oid)); if (info->tagger_date > 0) { - html("tag date"); + html("tag date\n"); } if (info->tagger) { html("tagged by"); -- cgit v2.8.0