From d20f16f384ab10353a21d5776d47a81dda188b85 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sun, 24 Aug 2025 03:58:15 +0000 Subject: print repo readme with summary --- ui-summary.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'ui-summary.c') diff --git a/ui-summary.c b/ui-summary.c index 947812a..6e04c55 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -62,6 +62,7 @@ void cgit_print_summary(void) urls = 0; cgit_add_clone_urls(print_url); html(""); + cgit_print_repo_readme(ctx.qry.path, false); cgit_print_layout_end(); } @@ -99,22 +100,25 @@ static char* append_readme_path(const char *filename, const char *ref, const cha return full_path; } -void cgit_print_repo_readme(const char *path) +void cgit_print_repo_readme(const char *path, bool page) { char *filename, *ref, *mimetype; int free_filename = 0; mimetype = get_mimetype_for_filename(path); if (mimetype && (!strncmp(mimetype, "image/", 6) || !strncmp(mimetype, "video/", 6))) { - ctx.page.mimetype = mimetype; - ctx.page.charset = NULL; - cgit_print_plain(); + if (page) { + ctx.page.mimetype = mimetype; + ctx.page.charset = NULL; + cgit_print_plain(); + } free(mimetype); return; } free(mimetype); - cgit_print_layout_start(); + if (page) + cgit_print_layout_start(); if (ctx.repo->readme.nr == 0) goto done; @@ -131,6 +135,10 @@ void cgit_print_repo_readme(const char *path) /* Print the calculated readme, either from the git repo or from the * filesystem, while applying the about-filter. */ + if (!page) { + html(""); + html("
"); + } html("
"); cgit_open_filter(ctx.repo->about_filter, filename); if (ref) @@ -144,5 +152,6 @@ void cgit_print_repo_readme(const char *path) free(filename); done: - cgit_print_layout_end(); + if (page) + cgit_print_layout_end(); } -- cgit v1.2.3-freya