From 9943065ccb6532511b0c861d30fe77e8fed43a7f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 12:09:44 -1000 Subject: Tidy the structure of the generated markup --- source/ui-commit.c | 14 +++++++------- source/ui-diff.c | 16 ++++++++-------- source/ui-log.c | 2 +- source/ui-refs.c | 10 +++++----- source/ui-repolist.c | 10 +++++----- source/ui-shared.c | 18 +++++++++--------- source/ui-ssdiff.c | 10 +++++----- source/ui-stats.c | 18 +++++++++--------- source/ui-summary.c | 4 ++-- 9 files changed, 51 insertions(+), 51 deletions(-) (limited to 'source') diff --git a/source/ui-commit.c b/source/ui-commit.c index 5a71954..befff25 100644 --- a/source/ui-commit.c +++ b/source/ui-commit.c @@ -55,7 +55,7 @@ static int print_parent_rows(struct commit *commit, const char *rev, if (!parent) { html(""); cgit_print_error("Error reading parent commit"); - html(""); + html("\n"); continue; } html("parent" @@ -68,7 +68,7 @@ static int print_parent_rows(struct commit *commit, const char *rev, html(" ("); cgit_diff_link("diff", NULL, NULL, ctx.qry.head, rev, oid_to_hex(&p->item->object.oid), prefix); - html(")"); + html(")\n"); parents++; } return parents; @@ -153,16 +153,16 @@ void cgit_print_commit(char *hex, const char *prefix) html("
"); print_filtered_text(info->subject); cgit_print_commit_decorations(commit); - html("
"); + html("\n"); html("
"); print_filtered_text(info->msg); - html("
"); + html("\n"); if (notes.len != 0) { - html("
Notes
"); + html("
Notes
\n"); html("
"); print_filtered_text(notes.buf); - html("
"); - html(""); + html("\n"); + html("\n"); } if (parents < OCTOPUS_PARENTS) { diff --git a/source/ui-diff.c b/source/ui-diff.c index 4ac3673..d6232a3 100644 --- a/source/ui-diff.c +++ b/source/ui-diff.c @@ -468,8 +468,8 @@ static void print_diffstat(const struct object_id *old_oid, html_txt(prefix); html("')"); } - html(""); - html(""); + html("\n"); + html("
\n"); max_changes = 0; cgit_diff_tree(old_oid, new_oid, inspect_filepair, prefix, ctx.qry.ignorews); @@ -719,11 +719,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, return; } - html("
"); + html("
\n"); if (use_ssdiff) { - html("
"); + html("
\n"); } else { - html("
"); + html("
\n"); html(""); - html("
"); } if (bodies_usable) { @@ -738,9 +738,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, ctx.qry.ignorews); } if (!use_ssdiff) - html("
"); - html(""); + html("\n"); + html("\n"); + html("\n"); if (show_ctrls) cgit_print_layout_end(); diff --git a/source/ui-log.c b/source/ui-log.c index 97c8925..6c428f3 100644 --- a/source/ui-log.c +++ b/source/ui-log.c @@ -544,7 +544,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, if (pager) { cgit_print_layout_start(); - html(""); + html("
\n"); } html(""); diff --git a/source/ui-refs.c b/source/ui-refs.c index 8490417..624d1a0 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -186,7 +186,7 @@ static void print_refs_link(const char *path) { html(""); + html("\n"); } static void print_ref_pager(int ofs, int pagesize, int count, const char *path) @@ -214,7 +214,7 @@ static void print_ref_pager(int ofs, int pagesize, int count, const char *path) html("'>[next]"); free(url); } - html(""); + html("\n"); } static struct ref_page page_bounds(int pagesize, int count) @@ -334,7 +334,7 @@ void cgit_print_tags(int maxcount) void cgit_print_refs(void) { cgit_print_layout_start(); - html("
"); cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); - html("
"); + html("
\n"); if (ctx.qry.path && starts_with(ctx.qry.path, "heads")) print_branches_page(ctx.cfg.max_ref_count); @@ -342,9 +342,9 @@ void cgit_print_refs(void) print_tags_page(ctx.cfg.max_ref_count); else { cgit_print_branches(ctx.cfg.max_ref_count); - html(""); + html("\n"); cgit_print_tags(ctx.cfg.max_ref_count); } - html("
 
 
"); + html("\n"); cgit_print_layout_end(); } diff --git a/source/ui-repolist.c b/source/ui-repolist.c index a8b401f..c81d822 100644 --- a/source/ui-repolist.c +++ b/source/ui-repolist.c @@ -217,7 +217,7 @@ static void print_section_row(const char *section, int columns) htmlf("", columns); html_txt(section); - html(""); + html("\n"); } static void print_repo_row(const char *currenturl, int sublevel) @@ -269,7 +269,7 @@ static void print_pager(int total, int pagelen, char *search, char *sort) int i, ofs; char *class = NULL; - html("\n"); } static int cmp_str(const char *s1, const char *s2) @@ -424,7 +424,7 @@ void cgit_print_repolist(void) sort_repolist("section"); currenturl = cgit_currenturl(); - html(""); + html("
\n"); for (i = 0; i < cgit_repolist.count; i++) { char *section; @@ -452,7 +452,7 @@ void cgit_print_repolist(void) } print_repo_row(currenturl, !column_sorted && section); } - html("
"); + html("\n"); if (hits > ctx.cfg.max_repo_count) print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search, ctx.qry.sort); free(currenturl); diff --git a/source/ui-shared.c b/source/ui-shared.c index 1f45520..12df3b2 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -302,7 +302,7 @@ static void print_abs_date(time_t t, int tz) html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); html("'>"); html_txt(show_date(t, tz, configured_date_mode())); - html(""); + html(""); } static void print_rel_date(time_t t, int tz, double count, const char *class, @@ -349,7 +349,7 @@ static int emit_css_link(struct string_list_item *item, void *fallback) html_attr(item->string); else html_attr((const char *)fallback); - html("'/>\n"); + html("'>\n"); return 0; } @@ -651,10 +651,10 @@ static void self_link(const char *name, const char *title, const char *class) cgit_stats_link(name, title, class, ctx.qry.head, ctx.qry.path); else { + // A page name this switch does not know still gets a plain + // repolink, which covers any simple page added later. repolink(title, class, ctx.qry.page, ctx.qry.head, ctx.qry.path); - html(">"); + html("'>"); html_txt(name); html(""); } @@ -1216,7 +1216,7 @@ void cgit_print_docend(void) { html("\n"); if (ctx.cfg.embedded) { - html(" \n"); + html("\n"); if (ctx.cfg.footer) html_include(ctx.cfg.footer); return; @@ -1229,7 +1229,7 @@ void cgit_print_docend(void) html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601))); html("\n"); } - html(" \n"); + html("\n"); html("\n\n"); } @@ -1306,7 +1306,7 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, void cgit_print_pageheader(void) { - html("
"); + html("
\n"); if (!ctx.env.authenticated || !ctx.cfg.noheader) print_header(); @@ -1340,7 +1340,7 @@ void cgit_print_pageheader(void) ctx.qry.follow = !ctx.qry.follow; html(")"); } - html(""); + html("\n"); } html("
\n"); } diff --git a/source/ui-ssdiff.c b/source/ui-ssdiff.c index 7f3d194..8651ce7 100644 --- a/source/ui-ssdiff.c +++ b/source/ui-ssdiff.c @@ -240,7 +240,7 @@ static void print_row(const char *class, html_txt(new_line); } - html(""); + html("\n"); free(lcs); free(new_line); free(old_line); @@ -414,11 +414,11 @@ void cgit_ssdiff_line_cb(char *line, int len) } else if (line[0] == '@') { html(""); html_txt(line); - html(""); + html("\n"); } else { html(""); html_txt(line); - html(""); + html("\n"); } line[len - 1] = terminator; } @@ -433,12 +433,12 @@ void cgit_ssdiff_header_begin(void) void cgit_ssdiff_header_end(void) { - html(""); + html("\n"); } void cgit_ssdiff_footer(void) { if (deferred_old || deferred_new) print_deferred_lines(); - html(""); + html("\n"); } diff --git a/source/ui-stats.c b/source/ui-stats.c index 89bb05f..f1a4d65 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -354,7 +354,7 @@ static void print_summary_row(struct string_list *authors, size_t from, htmlf("%ld", centerclass, subtotal); total += subtotal; } - htmlf("%ld", rightclass, total); + htmlf("%ld\n", rightclass, total); } static void print_authors(struct string_list *authors, int max_rows, @@ -365,7 +365,7 @@ static void print_authors(struct string_list *authors, int max_rows, size_t i, column, rows; long total; - html(""); + html("
Author
\n"); for (column = 0; column < labels->nr; column++) htmlf("", labels->items[column].string); html("\n"); @@ -392,7 +392,7 @@ static void print_authors(struct string_list *authors, int max_rows, total += (uintptr_t)bucket->util; } } - htmlf("", total); + htmlf("\n", total); } if (rows < authors->nr) @@ -401,7 +401,7 @@ static void print_authors(struct string_list *authors, int max_rows, print_summary_row(authors, 0, authors->nr, "Total", "total", "sum", "sum", labels); - html("
Author%sTotal
%ld
%ld
"); + html("\n"); } static const char *language_of(const char *pathname) @@ -512,8 +512,8 @@ static void print_languages(const struct lang_sizes *sizes) other += (uintptr_t)sizes->langs.items[i].util; } - html("

Languages

"); - html(""); + html("

Languages

\n"); + html("
\n"); html("\n"); shown = 0; for (i = 0; i < sizes->langs.nr && shown < MAX_LANGUAGE_ROWS; i++) { @@ -526,7 +526,7 @@ static void print_languages(const struct lang_sizes *sizes) } if (other) print_language_row("Other", other, sizes->total); - html("
LanguageSizeShare
"); + html("\n"); } static void print_options_form(const struct cgit_period *period, int top) @@ -547,7 +547,7 @@ static void print_options_form(const struct cgit_period *period, int top) html_option(cgit_fmt("%c", periods[i].code), periods[i].name, cgit_fmt("%c", period->code)); - html(""); + html("\n"); } html("Authors:"); html("