From 6663f83de9f699d495b6127e10de74e915021f5b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:55:17 -0700 Subject: Open and close each page through the layout calls --- source/ui-shared.c | 67 +++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 36 deletions(-) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index 7c198ea..1d09c26 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1375,7 +1375,7 @@ void cgit_redirect(const char *url, const char *query, bool permanent) html("\n\n"); } -void cgit_print_docstart(void) +static void print_docstart(void) { const struct object_id *pinned; struct string_list_item *item; @@ -1462,28 +1462,6 @@ void cgit_print_docstart(void) html_include(ctx.cfg.header); } -void cgit_print_docend(void) -{ - html("\n"); - if (ctx.cfg.embedded) { - html("\n"); - if (ctx.cfg.footer) - html_include(ctx.cfg.footer); - return; - } - if (ctx.cfg.footer) - html_include(ctx.cfg.footer); - else if (ctx.cfg.enable_version_info) - htmlf("\n", - cgit_version, git_version_string); - else - html("\n"); - html("\n"); - html("\n\n"); -} - void cgit_print_error_page(int code, const char *msg, const char *fmt, ...) { va_list ap; @@ -1521,18 +1499,6 @@ void cgit_print_blob_too_large(size_t size) size / 1024, ctx.cfg.max_blob_size); } -void cgit_print_layout_start(void) -{ - cgit_print_http_headers(); - cgit_print_docstart(); - cgit_print_pageheader(); -} - -void cgit_print_layout_end(void) -{ - cgit_print_docend(); -} - static void add_clone_urls(void (*fn)(const char *), char *urls, char *suffix) { struct strbuf **url_list = strbuf_split_str(urls, ' ', 0); @@ -1624,7 +1590,7 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, const char *page } } -void cgit_print_pageheader(void) +static void print_pageheader(void) { const struct object_id *pinned; @@ -1711,6 +1677,35 @@ void cgit_print_pageheader(void) html("
\n"); } +void cgit_print_layout_start(void) +{ + cgit_print_http_headers(); + print_docstart(); + print_pageheader(); +} + +void cgit_print_layout_end(void) +{ + html("
\n"); + if (ctx.cfg.embedded) { + html("\n"); + if (ctx.cfg.footer) + html_include(ctx.cfg.footer); + return; + } + if (ctx.cfg.footer) + html_include(ctx.cfg.footer); + else if (ctx.cfg.enable_version_info) + htmlf("\n", + cgit_version, git_version_string); + else + html("\n"); + html("\n"); + html("\n\n"); +} + static void print_fileperm(unsigned short mode) { htmlf("%c%c%c", (mode & 4 ? 'r' : '-'), (mode & 2 ? 'w' : '-'), (mode & 1 ? 'x' : '-')); -- cgit