abouttreesummaryrefslogcommitdiff
path: root/ui-summary.c
diff options
context:
space:
mode:
authorpatrick-scho2025-12-01 01:05:31 +0100
committerpatrick-scho2025-12-01 01:05:31 +0100
commitcc0722edd0776bacaec72e9b0e7a39983ee45e1e (patch)
tree10c5b7ff428b85498a8002b17f71678da41faa18 /ui-summary.c
parente8a031e1a565111169213d7fc13db4dd14fd926e (diff)
downloadps-cgit-cc0722edd0776bacaec72e9b0e7a39983ee45e1e.tar.gz
ps-cgit-cc0722edd0776bacaec72e9b0e7a39983ee45e1e.zip
moar changez
Diffstat (limited to 'ui-summary.c')
-rw-r--r--ui-summary.c72
1 files changed, 49 insertions, 23 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 19a6e0d..b5224f2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -105,15 +105,6 @@ void cgit_print_repo_readme(const char *path)
char *filename, *ref, *mimetype;
int free_filename = 0;
- // summary {{{
- int columns = 3;
-
- if (ctx.repo->enable_log_filecount)
- columns++;
- if (ctx.repo->enable_log_linecount)
- columns++;
- // }}}
-
mimetype = get_mimetype_for_filename(path);
if (mimetype && (!strncmp(mimetype, "image/", 6) || !strncmp(mimetype, "video/", 6))) {
ctx.page.mimetype = mimetype;
@@ -153,21 +144,56 @@ void cgit_print_repo_readme(const char *path)
if (free_filename)
free(filename);
- // summary {{{
- html("<table summary='repository info' class='list nowrap'>");
- cgit_print_branches(ctx.cfg.summary_branches);
- htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
- cgit_print_tags(ctx.cfg.summary_tags);
- if (ctx.cfg.summary_log > 0) {
- htmlf("<tr class='nohover'><td colspan='%d'>&nbsp;</td></tr>", columns);
- cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL,
- NULL, NULL, 0, 0, 0);
- }
- urls = 0;
- cgit_add_clone_urls(print_url);
- html("</table>");
- // }}}
done:
cgit_print_layout_end();
}
+
+void cgit_print_repo_readme_no_layout(const char *path)
+{
+ 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();
+ free(mimetype);
+ return;
+ }
+ free(mimetype);
+
+ // cgit_print_layout_start();
+ if (ctx.repo->readme.nr == 0)
+ goto done;
+
+ filename = ctx.repo->readme.items[0].string;
+ ref = ctx.repo->readme.items[0].util;
+
+ if (path) {
+ free_filename = 1;
+ filename = append_readme_path(filename, ref, path);
+ if (!filename)
+ goto done;
+ }
+
+ /* Print the calculated readme, either from the git repo or from the
+ * filesystem, while applying the about-filter.
+ */
+ html("<div id='summary'>");
+ cgit_open_filter(ctx.repo->about_filter, filename);
+ if (ref)
+ cgit_print_file(filename, ref, 1);
+ else
+ html_include(filename);
+ cgit_close_filter(ctx.repo->about_filter);
+
+ html("</div>");
+ if (free_filename)
+ free(filename);
+
+
+done:
+ // cgit_print_layout_end();
+}