]>
git.cameronkatri.com Git - cgit.git/blob - ui-summary.c
1 /* ui-summary.c: functions for generating repo summary page
3 * Copyright (C) 2006 Lars Hjemli
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
16 static void print_url(char *base
, char *suffix
)
21 html("<tr class='nohover'><td colspan='4'> </td></tr>");
22 html("<tr><th class='left' colspan='4'>Clone</th></tr>\n");
24 if (suffix
&& *suffix
)
25 base
= fmt("%s/%s", base
, suffix
);
26 html("<tr><td colspan='4'><a href='");
30 html("</a></td></tr>\n");
33 static void print_urls(char *txt
, char *suffix
)
38 while (h
&& *h
== ' ')
41 while (t
&& *t
&& *t
!= ' ')
51 void cgit_print_summary()
53 html("<table summary='repository info' class='list nowrap'>");
54 cgit_print_branches(ctx
.cfg
.summary_branches
);
55 html("<tr class='nohover'><td colspan='4'> </td></tr>");
56 cgit_print_tags(ctx
.cfg
.summary_tags
);
57 if (ctx
.cfg
.summary_log
> 0) {
58 html("<tr class='nohover'><td colspan='4'> </td></tr>");
59 cgit_print_log(ctx
.qry
.head
, 0, ctx
.cfg
.summary_log
, NULL
,
62 if (ctx
.repo
->clone_url
)
63 print_urls(ctx
.repo
->clone_url
, NULL
);
64 else if (ctx
.cfg
.clone_prefix
)
65 print_urls(ctx
.cfg
.clone_prefix
, ctx
.repo
->url
);
69 void cgit_print_repo_readme(char *path
)
73 if (!ctx
.repo
->readme
)
77 slash
= strrchr(ctx
.repo
->readme
, '/');
80 tmp
= xmalloc(slash
- ctx
.repo
->readme
+ 1 + strlen(path
) + 1);
81 strncpy(tmp
, ctx
.repo
->readme
, slash
- ctx
.repo
->readme
+ 1);
82 strcpy(tmp
+ (slash
- ctx
.repo
->readme
+ 1), path
);
84 tmp
= ctx
.repo
->readme
;
85 html("<div id='summary'>");
86 if (ctx
.repo
->about_filter
)
87 cgit_open_filter(ctx
.repo
->about_filter
);
89 if (ctx
.repo
->about_filter
)
90 cgit_close_filter(ctx
.repo
->about_filter
);