diff options
Diffstat (limited to 'ui-summary.c')
-rw-r--r-- | ui-summary.c | 85 |
1 files changed, 59 insertions, 26 deletions
diff --git a/ui-summary.c b/ui-summary.c index 947812a..dcf39af 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -40,31 +40,6 @@ static void print_url(const char *url) html("</a></td></tr>\n"); } -void cgit_print_summary(void) -{ - int columns = 3; - - if (ctx.repo->enable_log_filecount) - columns++; - if (ctx.repo->enable_log_linecount) - columns++; - - cgit_print_layout_start(); - html("<table summary='repository info' class='list nowrap'>"); - cgit_print_branches(ctx.cfg.summary_branches); - htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); - cgit_print_tags(ctx.cfg.summary_tags); - if (ctx.cfg.summary_log > 0) { - htmlf("<tr class='nohover'><td colspan='%d'> </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>"); - cgit_print_layout_end(); -} - /* The caller must free the return value. */ static char* append_readme_path(const char *filename, const char *ref, const char *path) { @@ -98,6 +73,64 @@ static char* append_readme_path(const char *filename, const char *ref, const cha return full_path; } +/* +static void cgit_print_readme_into_summary(const char *path) { + char *filename, *ref; + int free_filename = 0; + + if (ctx.repo->readme.nr == 0) + return; + + 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) + return; + } + + 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); +} +*/ + +void cgit_print_summary(void) +{ + int columns = 3; + + if (ctx.repo->enable_log_filecount) + columns++; + if (ctx.repo->enable_log_linecount) + columns++; + + cgit_print_layout_start(); + html("<table summary='repository info' class='list nowrap'>"); + cgit_print_branches(ctx.cfg.summary_branches); + htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); + cgit_print_tags(ctx.cfg.summary_tags); + if (ctx.cfg.summary_log > 0) { + htmlf("<tr class='nohover'><td colspan='%d'> </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>"); + //html("<b>Down here should be readme:</b>"); + //if (ctx.repo->readme.nr) + // cgit_print_readme_into_summary(ctx.qry.path); + cgit_print_layout_end(); +} void cgit_print_repo_readme(const char *path) { @@ -128,7 +161,7 @@ void cgit_print_repo_readme(const char *path) goto done; } - /* Print the calculated readme, either from the git repo or from the + /* print the calculated readme, either from the git repo or from the * filesystem, while applying the about-filter. */ html("<div id='summary'>"); |