diff options
author | Lars Hjemli | 2007-05-23 22:46:54 +0200 |
---|---|---|
committer | Lars Hjemli | 2007-05-23 22:46:54 +0200 |
commit | bbcdc290c6c0b8121e57dbca4bd66c9e5e729959 (patch) | |
tree | fb762f2153b60cc4f997095626af70baa16ce7b1 | |
parent | Remove unused variable from ui-repolist.c:read_agefile() (diff) | |
download | cgit-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.tar.gz cgit-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.zip |
Add repo.readme parameter
This parameter can be used to specify a repo-specific includefile, which will then be printed on the summary page for the repo. If the parametervalue is a not an absolute path, it is taken to be relative to repo.path. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.css | 14 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | cgitrc | 1 | ||||
-rw-r--r-- | shared.c | 8 | ||||
-rw-r--r-- | ui-summary.c | 14 |
5 files changed, 23 insertions, 15 deletions
diff --git a/cgit.css b/cgit.css index 327eaba..8977533 100644 --- a/cgit.css +++ b/cgit.css | |||
@@ -140,22 +140,20 @@ td#search input { | |||
140 | background-color: #fff; | 140 | background-color: #fff; |
141 | } | 141 | } |
142 | 142 | ||
143 | td#summary { | 143 | div#summary { |
144 | vertical-align: top; | 144 | vertical-align: top; |
145 | padding-bottom: 1em; | 145 | margin-bottom: 1em; |
146 | } | 146 | } |
147 | 147 | ||
148 | td#archivelist { | 148 | table#downloads { |
149 | padding-bottom: 1em; | ||
150 | } | ||
151 | |||
152 | td#archivelist table { | ||
153 | float: right; | 149 | float: right; |
154 | border-collapse: collapse; | 150 | border-collapse: collapse; |
155 | border: solid 1px #777; | 151 | border: solid 1px #777; |
152 | margin-left: 0.5em; | ||
153 | margin-bottom: 0.5em; | ||
156 | } | 154 | } |
157 | 155 | ||
158 | td#archivelist table th { | 156 | table#downloads th { |
159 | background-color: #ccc; | 157 | background-color: #ccc; |
160 | } | 158 | } |
161 | 159 | ||
diff --git a/cgit.h b/cgit.h index 3938633..5c55bec 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -68,6 +68,7 @@ struct repoinfo { | |||
68 | char *defbranch; | 68 | char *defbranch; |
69 | char *group; | 69 | char *group; |
70 | char *module_link; | 70 | char *module_link; |
71 | char *readme; | ||
71 | int snapshots; | 72 | int snapshots; |
72 | int enable_log_filecount; | 73 | int enable_log_filecount; |
73 | int enable_log_linecount; | 74 | int enable_log_linecount; |
diff --git a/cgitrc b/cgitrc index eaa9ce3..054a708 100644 --- a/cgitrc +++ b/cgitrc | |||
@@ -108,3 +108,4 @@ | |||
108 | #repo.enable-log-filecount=0 # override the default filecount setting | 108 | #repo.enable-log-filecount=0 # override the default filecount setting |
109 | #repo.enable-log-linecount=0 # override the default linecount setting | 109 | #repo.enable-log-linecount=0 # override the default linecount setting |
110 | #repo.module-link=/git/%s/commit/?id=%s # override the standard module-link | 110 | #repo.module-link=/git/%s/commit/?id=%s # override the standard module-link |
111 | #repo.readme=info/web/readme # specify a file to include on summary page | ||
diff --git a/shared.c b/shared.c index ce3ca4f..e3123a8 100644 --- a/shared.c +++ b/shared.c | |||
@@ -107,6 +107,7 @@ struct repoinfo *add_repo(const char *url) | |||
107 | ret->enable_log_filecount = cgit_enable_log_filecount; | 107 | ret->enable_log_filecount = cgit_enable_log_filecount; |
108 | ret->enable_log_linecount = cgit_enable_log_linecount; | 108 | ret->enable_log_linecount = cgit_enable_log_linecount; |
109 | ret->module_link = cgit_module_link; | 109 | ret->module_link = cgit_module_link; |
110 | ret->readme = NULL; | ||
110 | return ret; | 111 | return ret; |
111 | } | 112 | } |
112 | 113 | ||
@@ -187,7 +188,12 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
187 | cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value); | 188 | cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value); |
188 | else if (cgit_repo && !strcmp(name, "repo.module-link")) | 189 | else if (cgit_repo && !strcmp(name, "repo.module-link")) |
189 | cgit_repo->module_link= xstrdup(value); | 190 | cgit_repo->module_link= xstrdup(value); |
190 | else if (!strcmp(name, "include")) | 191 | else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) { |
192 | if (*value == '/') | ||
193 | cgit_repo->readme = xstrdup(value); | ||
194 | else | ||
195 | cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value)); | ||
196 | } else if (!strcmp(name, "include")) | ||
191 | cgit_read_config(value, cgit_global_config_cb); | 197 | cgit_read_config(value, cgit_global_config_cb); |
192 | } | 198 | } |
193 | 199 | ||
diff --git a/ui-summary.c b/ui-summary.c index 5799773..5c1fc33 100644 --- a/ui-summary.c +++ b/ui-summary.c | |||
@@ -153,7 +153,7 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1, | |||
153 | hashcpy(fileid, sha1); | 153 | hashcpy(fileid, sha1); |
154 | } | 154 | } |
155 | if (!header) { | 155 | if (!header) { |
156 | html("<table>"); | 156 | html("<table id='downloads'>"); |
157 | html("<tr><th>Downloads</th></tr>"); | 157 | html("<tr><th>Downloads</th></tr>"); |
158 | header = 1; | 158 | header = 1; |
159 | } | 159 | } |
@@ -193,16 +193,18 @@ static void cgit_print_archives() | |||
193 | 193 | ||
194 | void cgit_print_summary() | 194 | void cgit_print_summary() |
195 | { | 195 | { |
196 | html("<table class='list nowrap'>"); | 196 | html("<div id='summary'>"); |
197 | html("<tr class='nohover'><td id='summary' colspan='3'>"); | 197 | cgit_print_archives(); |
198 | html("<h2>"); | 198 | html("<h2>"); |
199 | html_txt(cgit_repo->name); | 199 | html_txt(cgit_repo->name); |
200 | html(" - "); | 200 | html(" - "); |
201 | html_txt(cgit_repo->desc); | 201 | html_txt(cgit_repo->desc); |
202 | html("</h2>"); | 202 | html("</h2>"); |
203 | html("</td><td id='archivelist'>"); | 203 | if (cgit_repo->readme) |
204 | cgit_print_archives(); | 204 | html_include(cgit_repo->readme); |
205 | html("</td></tr>"); | 205 | html("</div>"); |
206 | |||
207 | html("<table class='list nowrap'>"); | ||
206 | cgit_print_branches(); | 208 | cgit_print_branches(); |
207 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); | 209 | html("<tr class='nohover'><td colspan='4'> </td></tr>"); |
208 | cgit_print_tags(); | 210 | cgit_print_tags(); |