3 ed619ca0 2022-12-14 op * Copyright (c) 2022 Omar Polo <op@openbsd.org>
4 ed619ca0 2022-12-14 op * Copyright (c) 2016, 2019, 2020-2022 Tracey Emery <tracey@traceyemery.net>
6 ed619ca0 2022-12-14 op * Permission to use, copy, modify, and distribute this software for any
7 ed619ca0 2022-12-14 op * purpose with or without fee is hereby granted, provided that the above
8 ed619ca0 2022-12-14 op * copyright notice and this permission notice appear in all copies.
10 ed619ca0 2022-12-14 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 ed619ca0 2022-12-14 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 ed619ca0 2022-12-14 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ed619ca0 2022-12-14 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 ed619ca0 2022-12-14 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ed619ca0 2022-12-14 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 ed619ca0 2022-12-14 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 ed619ca0 2022-12-14 op #include <sys/types.h>
20 ed619ca0 2022-12-14 op #include <sys/queue.h>
21 43d421de 2023-01-05 op #include <sys/stat.h>
23 1abb18e1 2022-12-20 op #include <ctype.h>
24 ed619ca0 2022-12-14 op #include <event.h>
25 ed619ca0 2022-12-14 op #include <stdint.h>
26 43d421de 2023-01-05 op #include <stdio.h>
27 ed619ca0 2022-12-14 op #include <stdlib.h>
28 ed619ca0 2022-12-14 op #include <string.h>
29 43d421de 2023-01-05 op #include <sha1.h>
30 ed619ca0 2022-12-14 op #include <imsg.h>
32 3ab2c914 2023-01-11 op #include "got_error.h"
33 43d421de 2023-01-05 op #include "got_object.h"
34 3ab2c914 2023-01-11 op #include "got_reference.h"
36 ed619ca0 2022-12-14 op #include "proc.h"
38 ed619ca0 2022-12-14 op #include "gotwebd.h"
39 ed619ca0 2022-12-14 op #include "tmpl.h"
41 298f95fb 2023-01-05 op static int gotweb_render_blob_line(struct template *, const char *, size_t);
42 43d421de 2023-01-05 op static int gotweb_render_tree_item(struct template *, struct got_tree_entry *);
43 8319855f 2023-01-15 op static int blame_line(struct template *, const char *, struct blame_line *,
46 e3662697 2023-02-03 op static inline int gotweb_render_more(struct template *, int);
48 587550a5 2023-01-10 op static inline int diff_line(struct template *, char *);
49 067396e6 2023-01-09 op static inline int tag_item(struct template *, struct repo_tag *);
50 3ab2c914 2023-01-11 op static inline int branch(struct template *, struct got_reflist_entry *);
51 1abb18e1 2022-12-20 op static inline int rss_tag_item(struct template *, struct repo_tag *);
52 1abb18e1 2022-12-20 op static inline int rss_author(struct template *, char *);
56 ed619ca0 2022-12-14 op {{ define gotweb_render_header(struct template *tp) }}
58 ed619ca0 2022-12-14 op struct request *c = tp->tp_arg;
59 ed619ca0 2022-12-14 op struct server *srv = c->srv;
60 ed619ca0 2022-12-14 op struct querystring *qs = c->t->qs;
61 ed619ca0 2022-12-14 op struct gotweb_url u_path;
62 d19d9fce 2022-12-20 op const char *prfx = c->document_uri;
63 ed619ca0 2022-12-14 op const char *css = srv->custom_css;
65 ed619ca0 2022-12-14 op memset(&u_path, 0, sizeof(u_path));
66 ed619ca0 2022-12-14 op u_path.index_page = -1;
67 ed619ca0 2022-12-14 op u_path.page = -1;
68 ed619ca0 2022-12-14 op u_path.action = SUMMARY;
70 ed619ca0 2022-12-14 op <!doctype html>
73 ed619ca0 2022-12-14 op <meta charset="utf-8" />
74 ed619ca0 2022-12-14 op <title>{{ srv->site_name }}</title>
75 ed619ca0 2022-12-14 op <meta name="viewport" content="initial-scale=.75" />
76 ed619ca0 2022-12-14 op <meta name="msapplication-TileColor" content="#da532c" />
77 ed619ca0 2022-12-14 op <meta name="theme-color" content="#ffffff"/>
78 ed619ca0 2022-12-14 op <link rel="apple-touch-icon" sizes="180x180" href="{{ prfx }}apple-touch-icon.png" />
79 ed619ca0 2022-12-14 op <link rel="icon" type="image/png" sizes="32x32" href="{{ prfx }}favicon-32x32.png" />
80 ed619ca0 2022-12-14 op <link rel="icon" type="image/png" sizes="16x16" href="{{ prfx }}favicon-16x16.png" />
81 ed619ca0 2022-12-14 op <link rel="manifest" href="{{ prfx }}site.webmanifest"/>
82 ed619ca0 2022-12-14 op <link rel="mask-icon" href="{{ prfx }}safari-pinned-tab.svg" />
83 ed619ca0 2022-12-14 op <link rel="stylesheet" type="text/css" href="{{ prfx }}{{ css }}" />
86 ed619ca0 2022-12-14 op <div id="gw_body">
87 ed619ca0 2022-12-14 op <div id="header">
88 ed619ca0 2022-12-14 op <div id="got_link">
89 ed619ca0 2022-12-14 op <a href="{{ srv->logo_url }}" target="_blank">
90 ed619ca0 2022-12-14 op <img src="{{ prfx }}{{ srv->logo }}" />
94 ed619ca0 2022-12-14 op <div id="site_path">
95 ed619ca0 2022-12-14 op <div id="site_link">
96 ed619ca0 2022-12-14 op <a href="?index_page={{ printf "%d", qs->index_page }}">
97 ed619ca0 2022-12-14 op {{ srv->site_link }}
99 ed619ca0 2022-12-14 op {{ if qs->path }}
100 ed619ca0 2022-12-14 op {! u_path.path = qs->path; !}
102 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &u_path)}}">
103 ed619ca0 2022-12-14 op {{ qs->path }}
106 ed619ca0 2022-12-14 op {{ if qs->action != INDEX }}
107 ed619ca0 2022-12-14 op {{ " / " }}{{ gotweb_action_name(qs->action) }}
111 ed619ca0 2022-12-14 op <div id="content">
114 ed619ca0 2022-12-14 op {{ define gotweb_render_footer(struct template *tp) }}
116 ed619ca0 2022-12-14 op struct request *c = tp->tp_arg;
117 ed619ca0 2022-12-14 op struct server *srv = c->srv;
119 ed619ca0 2022-12-14 op <div id="site_owner_wrapper">
120 ed619ca0 2022-12-14 op <div id="site_owner">
121 ed619ca0 2022-12-14 op {{ if srv->show_site_owner }}
122 ed619ca0 2022-12-14 op {{ srv->site_owner }}
132 ed619ca0 2022-12-14 op {{ define gotweb_render_repo_table_hdr(struct template *tp) }}
134 ed619ca0 2022-12-14 op struct request *c = tp->tp_arg;
135 ed619ca0 2022-12-14 op struct server *srv = c->srv;
137 ed619ca0 2022-12-14 op <div id="index_header">
138 ed619ca0 2022-12-14 op <div id="index_header_project">
141 ed619ca0 2022-12-14 op {{ if srv->show_repo_description }}
142 ed619ca0 2022-12-14 op <div id="index_header_description">
146 ed619ca0 2022-12-14 op {{ if srv->show_repo_owner }}
147 ed619ca0 2022-12-14 op <div id="index_header_owner">
151 ed619ca0 2022-12-14 op {{ if srv->show_repo_age }}
152 ed619ca0 2022-12-14 op <div id="index_header_age">
159 ed619ca0 2022-12-14 op {{ define gotweb_render_repo_fragment(struct template *tp, struct repo_dir *repo_dir) }}
161 ed619ca0 2022-12-14 op struct request *c = tp->tp_arg;
162 ed619ca0 2022-12-14 op struct server *srv = c->srv;
163 ed619ca0 2022-12-14 op struct gotweb_url summary = {
164 ed619ca0 2022-12-14 op .action = SUMMARY,
165 ed619ca0 2022-12-14 op .index_page = -1,
167 ed619ca0 2022-12-14 op .path = repo_dir->name,
168 ed619ca0 2022-12-14 op }, briefs = {
169 ed619ca0 2022-12-14 op .action = BRIEFS,
170 ed619ca0 2022-12-14 op .index_page = -1,
172 ed619ca0 2022-12-14 op .path = repo_dir->name,
173 ed619ca0 2022-12-14 op }, commits = {
174 ed619ca0 2022-12-14 op .action = COMMITS,
175 ed619ca0 2022-12-14 op .index_page = -1,
177 ed619ca0 2022-12-14 op .path = repo_dir->name,
179 ed619ca0 2022-12-14 op .action = TAGS,
180 ed619ca0 2022-12-14 op .index_page = -1,
182 ed619ca0 2022-12-14 op .path = repo_dir->name,
184 ed619ca0 2022-12-14 op .action = TREE,
185 ed619ca0 2022-12-14 op .index_page = -1,
187 ed619ca0 2022-12-14 op .path = repo_dir->name,
189 1abb18e1 2022-12-20 op .action = RSS,
190 1abb18e1 2022-12-20 op .index_page = -1,
192 1abb18e1 2022-12-20 op .path = repo_dir->name,
195 ed619ca0 2022-12-14 op <div class="index_wrapper">
196 ed619ca0 2022-12-14 op <div class="index_project">
197 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">{{ repo_dir->name }}</a>
199 ed619ca0 2022-12-14 op {{ if srv->show_repo_description }}
200 ed619ca0 2022-12-14 op <div class="index_project_description">
201 ed619ca0 2022-12-14 op {{ repo_dir->description }}
204 ed619ca0 2022-12-14 op {{ if srv->show_repo_owner }}
205 ed619ca0 2022-12-14 op <div class="index_project_owner">
206 ed619ca0 2022-12-14 op {{ repo_dir->owner }}
209 ed619ca0 2022-12-14 op {{ if srv->show_repo_age }}
210 ed619ca0 2022-12-14 op <div class="index_project_age">
211 cb93ab40 2023-01-22 op {{ render gotweb_render_age(tp, repo_dir->age, TM_DIFF) }}
214 ed619ca0 2022-12-14 op <div class="navs_wrapper">
215 ed619ca0 2022-12-14 op <div class="navs">
216 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">summary</a>
218 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &briefs) }}">briefs</a>
220 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &commits) }}">commits</a>
222 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &tags) }}">tags</a>
224 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &tree) }}">tree</a>
226 1abb18e1 2022-12-20 op <a href="{{ render gotweb_render_url(tp->tp_arg, &rss) }}">rss</a>
228 ed619ca0 2022-12-14 op <div class="dotted_line"></div>
233 ed619ca0 2022-12-14 op {{ define gotweb_render_briefs(struct template *tp) }}
235 ed619ca0 2022-12-14 op const struct got_error *error;
236 ed619ca0 2022-12-14 op struct request *c = tp->tp_arg;
237 ed619ca0 2022-12-14 op struct server *srv = c->srv;
238 ed619ca0 2022-12-14 op struct transport *t = c->t;
239 ed619ca0 2022-12-14 op struct querystring *qs = c->t->qs;
240 ed619ca0 2022-12-14 op struct repo_commit *rc;
241 ed619ca0 2022-12-14 op struct repo_dir *repo_dir = t->repo_dir;
242 ed619ca0 2022-12-14 op struct gotweb_url diff_url, tree_url;
245 ed619ca0 2022-12-14 op diff_url = (struct gotweb_url){
246 ed619ca0 2022-12-14 op .action = DIFF,
247 ed619ca0 2022-12-14 op .index_page = -1,
249 ed619ca0 2022-12-14 op .path = repo_dir->name,
250 ed619ca0 2022-12-14 op .headref = qs->headref,
252 ed619ca0 2022-12-14 op tree_url = (struct gotweb_url){
253 ed619ca0 2022-12-14 op .action = TREE,
254 ed619ca0 2022-12-14 op .index_page = -1,
256 ed619ca0 2022-12-14 op .path = repo_dir->name,
257 ed619ca0 2022-12-14 op .headref = qs->headref,
260 ed619ca0 2022-12-14 op if (qs->action == SUMMARY) {
261 ed619ca0 2022-12-14 op qs->action = BRIEFS;
262 ed619ca0 2022-12-14 op error = got_get_repo_commits(c, D_MAXSLCOMMDISP);
264 ed619ca0 2022-12-14 op error = got_get_repo_commits(c, srv->max_commits_display);
268 ed619ca0 2022-12-14 op <div id="briefs_title_wrapper">
269 ed619ca0 2022-12-14 op <div id="briefs_title">Commit Briefs</div>
271 ed619ca0 2022-12-14 op <div id="briefs_content">
272 ed619ca0 2022-12-14 op {{ tailq-foreach rc &t->repo_commits entry }}
274 ed619ca0 2022-12-14 op diff_url.commit = rc->commit_id;
275 ed619ca0 2022-12-14 op tree_url.commit = rc->commit_id;
277 6c3d3263 2023-01-10 op tmp = strchr(rc->committer, '<');
281 ed619ca0 2022-12-14 op tmp = strchr(rc->commit_msg, '\n');
285 ed619ca0 2022-12-14 op <div class="briefs_age">
286 ed619ca0 2022-12-14 op {{ render gotweb_render_age(tp, rc->committer_time, TM_DIFF) }}
288 ed619ca0 2022-12-14 op <div class="briefs_author">
289 6c3d3263 2023-01-10 op {{ rc->committer }}
291 ed619ca0 2022-12-14 op <div class="briefs_log">
292 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
293 ed619ca0 2022-12-14 op {{ rc->commit_msg }}
295 ed619ca0 2022-12-14 op {{ if rc->refs_str }}
296 ed619ca0 2022-12-14 op {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
300 ed619ca0 2022-12-14 op <div class="navs_wrapper">
301 ed619ca0 2022-12-14 op <div class="navs">
302 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">diff</a>
304 ed619ca0 2022-12-14 op <a href="{{ render gotweb_render_url(tp->tp_arg, &tree_url) }}">tree</a>
307 ed619ca0 2022-12-14 op <div class="dotted_line"></div>
309 e3662697 2023-02-03 op {{ render gotweb_render_more(tp, BRIEFS) }}
313 e3662697 2023-02-03 op {{ define gotweb_render_more(struct template *tp, int action) }}
315 e3662697 2023-02-03 op struct request *c = tp->tp_arg;
316 e3662697 2023-02-03 op struct transport *t = c->t;
317 e3662697 2023-02-03 op struct querystring *qs = t->qs;
318 e3662697 2023-02-03 op struct gotweb_url more = {
319 e3662697 2023-02-03 op .action = action,
320 e3662697 2023-02-03 op .index_page = -1,
321 e3662697 2023-02-03 op .path = qs->path,
322 e3662697 2023-02-03 op .commit = t->more_id,
323 e3662697 2023-02-03 op .headref = qs->headref,
326 e3662697 2023-02-03 op {{ if t->more_id }}
327 e3662697 2023-02-03 op <div id="np_wrapper">
328 e3662697 2023-02-03 op <div id="nav_more">
329 e3662697 2023-02-03 op <a href="{{ render gotweb_render_url(c, &more) }}">
330 0af50e04 2023-02-03 op More ↓
337 b4c0bd72 2022-12-17 op {{ define gotweb_render_navs(struct template *tp) }}
339 b4c0bd72 2022-12-17 op struct request *c = tp->tp_arg;
340 b4c0bd72 2022-12-17 op struct transport *t = c->t;
341 b4c0bd72 2022-12-17 op struct gotweb_url prev, next;
342 b4c0bd72 2022-12-17 op int have_prev, have_next;
344 b4c0bd72 2022-12-17 op gotweb_get_navs(c, &prev, &have_prev, &next, &have_next);
346 b4c0bd72 2022-12-17 op <div id="np_wrapper">
347 b4c0bd72 2022-12-17 op <div id="nav_prev">
348 b4c0bd72 2022-12-17 op {{ if have_prev }}
349 b4c0bd72 2022-12-17 op <a href="{{ render gotweb_render_url(c, &prev) }}">
354 b4c0bd72 2022-12-17 op <div id="nav_next">
355 b4c0bd72 2022-12-17 op {{ if have_next }}
356 b4c0bd72 2022-12-17 op <a href="{{ render gotweb_render_url(c, &next) }}">
362 b4c0bd72 2022-12-17 op {{ finally }}
364 b4c0bd72 2022-12-17 op free(t->next_id);
365 b4c0bd72 2022-12-17 op t->next_id = NULL;
366 b4c0bd72 2022-12-17 op free(t->prev_id);
367 b4c0bd72 2022-12-17 op t->prev_id = NULL;
371 156a1144 2022-12-17 op {{ define gotweb_render_commits(struct template *tp) }}
373 156a1144 2022-12-17 op struct request *c = tp->tp_arg;
374 156a1144 2022-12-17 op struct transport *t = c->t;
375 156a1144 2022-12-17 op struct repo_dir *repo_dir = t->repo_dir;
376 156a1144 2022-12-17 op struct repo_commit *rc;
377 156a1144 2022-12-17 op struct gotweb_url diff, tree;
379 156a1144 2022-12-17 op diff = (struct gotweb_url){
380 156a1144 2022-12-17 op .action = DIFF,
381 156a1144 2022-12-17 op .index_page = -1,
383 156a1144 2022-12-17 op .path = repo_dir->name,
385 156a1144 2022-12-17 op tree = (struct gotweb_url){
386 156a1144 2022-12-17 op .action = TREE,
387 156a1144 2022-12-17 op .index_page = -1,
389 156a1144 2022-12-17 op .path = repo_dir->name,
392 156a1144 2022-12-17 op <div class="commits_title_wrapper">
393 156a1144 2022-12-17 op <div class="commits_title">Commits</div>
395 156a1144 2022-12-17 op <div class="commits_content">
396 156a1144 2022-12-17 op {{ tailq-foreach rc &t->repo_commits entry }}
398 156a1144 2022-12-17 op diff.commit = rc->commit_id;
399 156a1144 2022-12-17 op tree.commit = rc->commit_id;
401 156a1144 2022-12-17 op <div class="commits_header_wrapper">
402 156a1144 2022-12-17 op <div class="commits_header">
403 156a1144 2022-12-17 op <div class="header_commit_title">Commit:</div>
404 156a1144 2022-12-17 op <div class="header_commit">{{ rc->commit_id }}</div>
405 af800df5 2023-01-10 op <div class="header_author_title">From:</div>
406 156a1144 2022-12-17 op <div class="header_author">{{ rc->author }}</div>
407 af800df5 2023-01-10 op {{ if strcmp(rc->committer, rc->author) != 0 }}
408 af800df5 2023-01-10 op <div class="header_author_title">Via:</div>
409 af800df5 2023-01-10 op <div class="header_author">{{ rc->committer }}</div>
411 156a1144 2022-12-17 op <div class="header_age_title">Date:</div>
412 156a1144 2022-12-17 op <div class="header_age">
413 156a1144 2022-12-17 op {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
417 cf536071 2022-12-31 op <div class="dotted_line"></div>
418 cf536071 2022-12-31 op <div class="commit">
420 cf536071 2022-12-31 op {{ rc->commit_msg }}
422 156a1144 2022-12-17 op <div class="navs_wrapper">
423 156a1144 2022-12-17 op <div class="navs">
424 156a1144 2022-12-17 op <a href="{{ render gotweb_render_url(c, &diff) }}">diff</a>
426 156a1144 2022-12-17 op <a href="{{ render gotweb_render_url(c, &tree) }}">tree</a>
429 156a1144 2022-12-17 op <div class="dotted_line"></div>
431 e3662697 2023-02-03 op {{ render gotweb_render_more(tp, COMMITS) }}
435 298f95fb 2023-01-05 op {{ define gotweb_render_blob(struct template *tp,
436 298f95fb 2023-01-05 op struct got_blob_object *blob) }}
438 298f95fb 2023-01-05 op struct request *c = tp->tp_arg;
439 298f95fb 2023-01-05 op struct transport *t = c->t;
440 298f95fb 2023-01-05 op struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
442 298f95fb 2023-01-05 op <div id="blob_title_wrapper">
443 298f95fb 2023-01-05 op <div id="blob_title">Blob</div>
445 298f95fb 2023-01-05 op <div id="blob_content">
446 298f95fb 2023-01-05 op <div id="blob_header_wrapper">
447 298f95fb 2023-01-05 op <div id="blob_header">
448 298f95fb 2023-01-05 op <div class="header_age_title">Date:</div>
449 298f95fb 2023-01-05 op <div class="header_age">
450 298f95fb 2023-01-05 op {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
452 298f95fb 2023-01-05 op <div id="header_commit_msg_title">Message:</div>
453 298f95fb 2023-01-05 op <div id="header_commit_msg">{{ rc->commit_msg }}</div>
456 298f95fb 2023-01-05 op <div class="dotted_line"></div>
457 298f95fb 2023-01-05 op <div id="blob">
459 298f95fb 2023-01-05 op {{ render got_output_blob_by_lines(tp, blob, gotweb_render_blob_line) }}
465 298f95fb 2023-01-05 op {{ define gotweb_render_blob_line(struct template *tp, const char *line,
466 298f95fb 2023-01-05 op size_t no) }}
468 298f95fb 2023-01-05 op char lineno[16];
471 298f95fb 2023-01-05 op r = snprintf(lineno, sizeof(lineno), "%zu", no);
472 298f95fb 2023-01-05 op if (r < 0 || (size_t)r >= sizeof(lineno))
475 298f95fb 2023-01-05 op <div class="blob_line" id="line{{ lineno }}">
476 298f95fb 2023-01-05 op <div class="blob_number">
477 298f95fb 2023-01-05 op <a href="#line{{ lineno }}">{{ lineno }}</a>
479 298f95fb 2023-01-05 op <div class="blob_code">{{ line }}</div>
483 43d421de 2023-01-05 op {{ define gotweb_render_tree(struct template *tp) }}
485 43d421de 2023-01-05 op struct request *c = tp->tp_arg;
486 43d421de 2023-01-05 op struct transport *t = c->t;
487 43d421de 2023-01-05 op struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
489 43d421de 2023-01-05 op <div id="tree_title_wrapper">
490 43d421de 2023-01-05 op <div id="tree_title">Tree</div>
492 43d421de 2023-01-05 op <div id="tree_content">
493 43d421de 2023-01-05 op <div id="tree_header_wrapper">
494 43d421de 2023-01-05 op <div id="tree_header">
495 43d421de 2023-01-05 op <div id="header_tree_title">Tree:</div>
496 43d421de 2023-01-05 op <div id="header_tree">{{ rc->tree_id }}</div>
497 43d421de 2023-01-05 op <div class="header_age_title">Date:</div>
498 43d421de 2023-01-05 op <div class="header_age">
499 43d421de 2023-01-05 op {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
501 43d421de 2023-01-05 op <div id="header_commit_msg_title">Message:</div>
502 43d421de 2023-01-05 op <div id="header_commit_msg">{{ rc->commit_msg }}</div>
505 43d421de 2023-01-05 op <div class="dotted_line"></div>
506 43d421de 2023-01-05 op <div id="tree">
507 43d421de 2023-01-05 op {{ render got_output_repo_tree(c, gotweb_render_tree_item) }}
512 43d421de 2023-01-05 op {{ define gotweb_render_tree_item(struct template *tp,
513 43d421de 2023-01-05 op struct got_tree_entry *te) }}
515 43d421de 2023-01-05 op struct request *c = tp->tp_arg;
516 43d421de 2023-01-05 op struct transport *t = c->t;
517 43d421de 2023-01-05 op struct querystring *qs = t->qs;
518 43d421de 2023-01-05 op struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
519 43d421de 2023-01-05 op const char *modestr = "";
520 43d421de 2023-01-05 op const char *name;
521 43d421de 2023-01-05 op const char *folder;
522 43d421de 2023-01-05 op char *dir = NULL;
524 43d421de 2023-01-05 op struct gotweb_url url = {
525 43d421de 2023-01-05 op .index_page = -1,
527 43d421de 2023-01-05 op .commit = rc->commit_id,
528 43d421de 2023-01-05 op .path = qs->path,
531 43d421de 2023-01-05 op name = got_tree_entry_get_name(te);
532 43d421de 2023-01-05 op mode = got_tree_entry_get_mode(te);
534 43d421de 2023-01-05 op folder = qs->folder ? qs->folder : "";
535 43d421de 2023-01-05 op if (S_ISDIR(mode)) {
536 43d421de 2023-01-05 op if (asprintf(&dir, "%s/%s", folder, name) == -1)
539 43d421de 2023-01-05 op url.action = TREE;
540 43d421de 2023-01-05 op url.folder = dir;
542 43d421de 2023-01-05 op url.action = BLOB;
543 43d421de 2023-01-05 op url.folder = folder;
544 43d421de 2023-01-05 op url.file = name;
547 43d421de 2023-01-05 op if (got_object_tree_entry_is_submodule(te))
548 43d421de 2023-01-05 op modestr = "$";
549 43d421de 2023-01-05 op else if (S_ISLNK(mode))
550 43d421de 2023-01-05 op modestr = "@";
551 43d421de 2023-01-05 op else if (S_ISDIR(mode))
552 43d421de 2023-01-05 op modestr = "/";
553 43d421de 2023-01-05 op else if (mode & S_IXUSR)
554 43d421de 2023-01-05 op modestr = "*";
556 43d421de 2023-01-05 op <div class="tree_wrapper">
557 43d421de 2023-01-05 op {{ if S_ISDIR(mode) }}
558 43d421de 2023-01-05 op <div class="tree_line">
559 43d421de 2023-01-05 op <a href="{{ render gotweb_render_url(c, &url) }}">
560 43d421de 2023-01-05 op {{ name }}{{ modestr }}
563 43d421de 2023-01-05 op <div class="tree_line_blank"> </div>
565 43d421de 2023-01-05 op <div class="tree_line">
566 43d421de 2023-01-05 op <a href="{{ render gotweb_render_url(c, &url) }}">
567 43d421de 2023-01-05 op {{ name }}{{ modestr }}
570 43d421de 2023-01-05 op <div class="tree_line_blank">
571 43d421de 2023-01-05 op {! url.action = COMMITS; !}
572 43d421de 2023-01-05 op <a href="{{ render gotweb_render_url(c, &url) }}">
576 43d421de 2023-01-05 op {! url.action = BLAME; !}
577 43d421de 2023-01-05 op <a href="{{ render gotweb_render_url(c, &url) }}">
583 43d421de 2023-01-05 op {{ finally }}
589 d60961d2 2023-01-13 op {{ define gotweb_render_tags(struct template *tp) }}
591 067396e6 2023-01-09 op struct request *c = tp->tp_arg;
592 067396e6 2023-01-09 op struct transport *t = c->t;
593 067396e6 2023-01-09 op struct querystring *qs = t->qs;
594 067396e6 2023-01-09 op struct repo_tag *rt;
595 067396e6 2023-01-09 op int commit_found;
597 067396e6 2023-01-09 op commit_found = qs->commit == NULL;
599 067396e6 2023-01-09 op <div id="tags_title_wrapper">
600 067396e6 2023-01-09 op <div id="tags_title">Tags</div>
602 067396e6 2023-01-09 op <div id="tags_content">
603 067396e6 2023-01-09 op {{ if t->tag_count == 0 }}
604 067396e6 2023-01-09 op <div id="err_content">
605 067396e6 2023-01-09 op This repository contains no tags
608 067396e6 2023-01-09 op {{ tailq-foreach rt &t->repo_tags entry }}
609 067396e6 2023-01-09 op {{ if commit_found || !strcmp(qs->commit, rt->commit_id) }}
610 067396e6 2023-01-09 op {! commit_found = 1; !}
611 067396e6 2023-01-09 op {{ render tag_item(tp, rt) }}
614 067396e6 2023-01-09 op {{ if t->next_id || t->prev_id }}
615 e3662697 2023-02-03 op {! qs->action = TAGS; !}
616 067396e6 2023-01-09 op {{ render gotweb_render_navs(tp) }}
622 067396e6 2023-01-09 op {{ define tag_item(struct template *tp, struct repo_tag *rt) }}
624 067396e6 2023-01-09 op struct request *c = tp->tp_arg;
625 067396e6 2023-01-09 op struct transport *t = c->t;
626 067396e6 2023-01-09 op struct repo_dir *repo_dir = t->repo_dir;
627 067396e6 2023-01-09 op char *tag_name = rt->tag_name;
628 067396e6 2023-01-09 op char *msg = rt->tag_commit;
630 067396e6 2023-01-09 op struct gotweb_url url = {
631 067396e6 2023-01-09 op .action = TAG,
632 067396e6 2023-01-09 op .index_page = -1,
634 067396e6 2023-01-09 op .path = repo_dir->name,
635 067396e6 2023-01-09 op .commit = rt->commit_id,
638 067396e6 2023-01-09 op if (strncmp(tag_name, "refs/tags/", 10) == 0)
639 067396e6 2023-01-09 op tag_name += 10;
642 067396e6 2023-01-09 op nl = strchr(msg, '\n');
647 067396e6 2023-01-09 op <div class="tag_age">
648 067396e6 2023-01-09 op {{ render gotweb_render_age(tp, rt->tagger_time, TM_DIFF) }}
650 067396e6 2023-01-09 op <div class="tag">{{ tag_name }}</div>
651 067396e6 2023-01-09 op <div class="tag_log">
652 067396e6 2023-01-09 op <a href="{{ render gotweb_render_url(c, &url) }}">
656 067396e6 2023-01-09 op <div class="navs_wrapper">
657 067396e6 2023-01-09 op <div class="navs">
658 067396e6 2023-01-09 op <a href="{{ render gotweb_render_url(c, &url) }}">tag</a>
660 067396e6 2023-01-09 op {! url.action = BRIEFS; !}
661 067396e6 2023-01-09 op <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
663 067396e6 2023-01-09 op {! url.action = COMMITS; !}
664 067396e6 2023-01-09 op <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
667 067396e6 2023-01-09 op <div class="dotted_line"></div>
670 dc07f76c 2023-01-09 op {{ define gotweb_render_tag(struct template *tp) }}
672 dc07f76c 2023-01-09 op struct request *c = tp->tp_arg;
673 dc07f76c 2023-01-09 op struct transport *t = c->t;
674 dc07f76c 2023-01-09 op struct repo_tag *rt;
675 dc07f76c 2023-01-09 op const char *tag_name;
677 dc07f76c 2023-01-09 op rt = TAILQ_LAST(&t->repo_tags, repo_tags_head);
678 dc07f76c 2023-01-09 op tag_name = rt->tag_name;
680 dc07f76c 2023-01-09 op if (strncmp(tag_name, "refs/", 5) == 0)
681 dc07f76c 2023-01-09 op tag_name += 5;
683 dc07f76c 2023-01-09 op <div id="tags_title_wrapper">
684 dc07f76c 2023-01-09 op <div id="tags_title">Tag</div>
686 dc07f76c 2023-01-09 op <div id="tags_content">
687 dc07f76c 2023-01-09 op <div id="tag_header_wrapper">
688 dc07f76c 2023-01-09 op <div id="tag_header">
689 dc07f76c 2023-01-09 op <div class="header_commit_title">Commit:</div>
690 dc07f76c 2023-01-09 op <div class="header_commit">
691 dc07f76c 2023-01-09 op {{ rt->commit_id }}
693 dc07f76c 2023-01-09 op <span class="refs_str">({{ tag_name }})</span>
695 dc07f76c 2023-01-09 op <div class="header_author_title">Tagger:</div>
696 dc07f76c 2023-01-09 op <div class="header_author">{{ rt->tagger }}</div>
697 dc07f76c 2023-01-09 op <div class="header_age_title">Date:</div>
698 dc07f76c 2023-01-09 op <div class="header_age">
699 dc07f76c 2023-01-09 op {{ render gotweb_render_age(tp, rt->tagger_time, TM_LONG)}}
701 dc07f76c 2023-01-09 op <div id="header_commit_msg_title">Message:</div>
702 dc07f76c 2023-01-09 op <div id="header_commit_msg">{{ rt->commit_msg }}</div>
704 dc07f76c 2023-01-09 op <div class="dotted_line"></div>
705 dc07f76c 2023-01-09 op <div id="tag_commit">
707 dc07f76c 2023-01-09 op {{ rt->tag_commit }}
713 587550a5 2023-01-10 op {{ define gotweb_render_diff(struct template *tp, FILE *fp) }}
715 587550a5 2023-01-10 op struct request *c = tp->tp_arg;
716 587550a5 2023-01-10 op struct transport *t = c->t;
717 587550a5 2023-01-10 op struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
718 587550a5 2023-01-10 op char *line = NULL;
719 587550a5 2023-01-10 op size_t linesize = 0;
720 587550a5 2023-01-10 op ssize_t linelen;
722 587550a5 2023-01-10 op <div id="diff_title_wrapper">
723 587550a5 2023-01-10 op <div id="diff_title">Commit Diff</div>
725 587550a5 2023-01-10 op <div id="diff_content">
726 587550a5 2023-01-10 op <div id="diff_header_wrapper">
727 587550a5 2023-01-10 op <div id="diff_header">
728 587550a5 2023-01-10 op <div class="header_commit_title">Commit:</div>
729 587550a5 2023-01-10 op <div class="header_commit">{{ rc->commit_id }}</div>
730 49632cd3 2023-01-10 op <div class="header_author_title">From:</div>
731 587550a5 2023-01-10 op <div class="header_author">{{ rc->author }}</div>
732 49632cd3 2023-01-10 op {{ if strcmp(rc->committer, rc->author) != 0 }}
733 49632cd3 2023-01-10 op <div class="header_author_title">Via:</div>
734 49632cd3 2023-01-10 op <div class="header_author">{{ rc->committer }}</div>
736 587550a5 2023-01-10 op <div class="header_age_title">Date:</div>
737 587550a5 2023-01-10 op <div class="header_age">
738 587550a5 2023-01-10 op {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
740 587550a5 2023-01-10 op <div id="header_commit_msg_title">Message</div>
741 587550a5 2023-01-10 op <div id="header_commit_msg">{{ rc->commit_msg }}</div>
744 587550a5 2023-01-10 op <div class="dotted_line"></div>
745 587550a5 2023-01-10 op <div id="diff">
747 587550a5 2023-01-10 op {{ while (linelen = getline(&line, &linesize, fp)) != -1 }}
748 587550a5 2023-01-10 op {{ render diff_line(tp, line) }}
752 587550a5 2023-01-10 op {{ finally }}
753 587550a5 2023-01-10 op {! free(line); !}
756 587550a5 2023-01-10 op {{ define diff_line(struct template *tp, char *line )}}
758 587550a5 2023-01-10 op const char *color = NULL;
761 587550a5 2023-01-10 op if (!strncmp(line, "-", 1))
762 587550a5 2023-01-10 op color = "diff_minus";
763 587550a5 2023-01-10 op else if (!strncmp(line, "+", 1))
764 587550a5 2023-01-10 op color = "diff_plus";
765 587550a5 2023-01-10 op else if (!strncmp(line, "@@", 2))
766 587550a5 2023-01-10 op color = "diff_chunk_header";
767 587550a5 2023-01-10 op else if (!strncmp(line, "commit +", 8) ||
768 587550a5 2023-01-10 op !strncmp(line, "commit -", 8) ||
769 587550a5 2023-01-10 op !strncmp(line, "blob +", 6) ||
770 587550a5 2023-01-10 op !strncmp(line, "blob -", 6) ||
771 587550a5 2023-01-10 op !strncmp(line, "file +", 6) ||
772 587550a5 2023-01-10 op !strncmp(line, "file -", 6))
773 587550a5 2023-01-10 op color = "diff_meta";
774 587550a5 2023-01-10 op else if (!strncmp(line, "from:", 5) || !strncmp(line, "via:", 4))
775 587550a5 2023-01-10 op color = "diff_author";
776 587550a5 2023-01-10 op else if (!strncmp(line, "date:", 5))
777 587550a5 2023-01-10 op color = "diff_date";
779 587550a5 2023-01-10 op nl = strchr(line, '\n');
783 587550a5 2023-01-10 op <div class="diff_line {{ color }}">{{ line }}</div>
786 3ab2c914 2023-01-11 op {{ define gotweb_render_branches(struct template *tp,
787 3ab2c914 2023-01-11 op struct got_reflist_head *refs) }}
789 3ab2c914 2023-01-11 op struct got_reflist_entry *re;
791 3ab2c914 2023-01-11 op <div id="branches_title_wrapper">
792 3ab2c914 2023-01-11 op <div id="branches_title">Branches</div>
794 3ab2c914 2023-01-11 op <div id="branches_content">
795 3ab2c914 2023-01-11 op {{ tailq-foreach re refs entry }}
796 3ab2c914 2023-01-11 op {{ if !got_ref_is_symbolic(re->ref) }}
797 3ab2c914 2023-01-11 op {{ render branch(tp, re) }}
803 3ab2c914 2023-01-11 op {{ define branch(struct template *tp, struct got_reflist_entry *re) }}
805 3ab2c914 2023-01-11 op const struct got_error *err;
806 3ab2c914 2023-01-11 op struct request *c = tp->tp_arg;
807 3ab2c914 2023-01-11 op struct querystring *qs = c->t->qs;
808 3ab2c914 2023-01-11 op const char *refname;
810 3ab2c914 2023-01-11 op struct gotweb_url url = {
811 3ab2c914 2023-01-11 op .action = SUMMARY,
812 3ab2c914 2023-01-11 op .index_page = -1,
814 3ab2c914 2023-01-11 op .path = qs->path,
817 3ab2c914 2023-01-11 op refname = got_ref_get_name(re->ref);
819 cb93ab40 2023-01-22 op err = got_get_repo_age(&age, c, refname);
821 3ab2c914 2023-01-11 op log_warnx("%s: %s", __func__, err->msg);
825 3ab2c914 2023-01-11 op if (strncmp(refname, "refs/heads/", 11) == 0)
826 3ab2c914 2023-01-11 op refname += 11;
828 3ab2c914 2023-01-11 op url.headref = refname;
830 3ab2c914 2023-01-11 op <div class="branches_wrapper">
831 cb93ab40 2023-01-22 op <div class="branches_age">
832 cb93ab40 2023-01-22 op {{ render gotweb_render_age(tp, age, TM_DIFF) }}
834 3ab2c914 2023-01-11 op <div class="branches_space"> </div>
835 3ab2c914 2023-01-11 op <div class="branch">
836 3ab2c914 2023-01-11 op <a href="{{ render gotweb_render_url(c, &url) }}">{{ refname }}</a>
838 3ab2c914 2023-01-11 op <div class="navs_wrapper">
839 3ab2c914 2023-01-11 op <div class="navs">
840 3ab2c914 2023-01-11 op <a href="{{ render gotweb_render_url(c, &url) }}">summary</a>
842 3ab2c914 2023-01-11 op {! url.action = BRIEFS; !}
843 3ab2c914 2023-01-11 op <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
845 3ab2c914 2023-01-11 op {! url.action = COMMITS; !}
846 3ab2c914 2023-01-11 op <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
849 3ab2c914 2023-01-11 op <div class="dotted_line"></div>
853 69525b4e 2023-01-13 op {{ define gotweb_render_summary(struct template *tp,
854 69525b4e 2023-01-13 op struct got_reflist_head *refs) }}
856 69525b4e 2023-01-13 op struct request *c = tp->tp_arg;
857 69525b4e 2023-01-13 op struct server *srv = c->srv;
858 69525b4e 2023-01-13 op struct transport *t = c->t;
860 69525b4e 2023-01-13 op <div id="summary_wrapper">
861 69525b4e 2023-01-13 op {{ if srv->show_repo_description }}
862 69525b4e 2023-01-13 op <div id="description_title">Description:</div>
863 69525b4e 2023-01-13 op <div id="description">{{ t->repo_dir->description }}</div>
865 69525b4e 2023-01-13 op {{ if srv->show_repo_owner }}
866 69525b4e 2023-01-13 op <div id="repo_owner_title">Owner:</div>
867 69525b4e 2023-01-13 op <div id="repo_owner">{{ t->repo_dir->owner }}</div>
869 69525b4e 2023-01-13 op {{ if srv->show_repo_age }}
870 69525b4e 2023-01-13 op <div id="last_change_title">Last Change:</div>
871 cb93ab40 2023-01-22 op <div id="last_change">
872 cb93ab40 2023-01-22 op {{ render gotweb_render_age(tp, t->repo_dir->age, TM_DIFF) }}
875 69525b4e 2023-01-13 op {{ if srv->show_repo_cloneurl }}
876 69525b4e 2023-01-13 op <div id="cloneurl_title">Clone URL:</div>
877 69525b4e 2023-01-13 op <div id="cloneurl">{{ t->repo_dir->url }}</div>
880 69525b4e 2023-01-13 op {{ render gotweb_render_briefs(tp) }}
881 69525b4e 2023-01-13 op {{ render gotweb_render_tags(tp) }}
882 69525b4e 2023-01-13 op {{ render gotweb_render_branches(tp, refs) }}
885 8319855f 2023-01-15 op {{ define gotweb_render_blame(struct template *tp) }}
887 8319855f 2023-01-15 op const struct got_error *err;
888 8319855f 2023-01-15 op struct request *c = tp->tp_arg;
889 8319855f 2023-01-15 op struct transport *t = c->t;
890 8319855f 2023-01-15 op struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
892 8319855f 2023-01-15 op <div id="blame_title_wrapper">
893 8319855f 2023-01-15 op <div id="blame_title">Blame</div>
895 8319855f 2023-01-15 op <div id="blame_content">
896 8319855f 2023-01-15 op <div id="blame_header_wrapper">
897 8319855f 2023-01-15 op <div id="blame_header">
898 8319855f 2023-01-15 op <div class="header_age_title">Date:</div>
899 8319855f 2023-01-15 op <div class="header_age">
900 8319855f 2023-01-15 op {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
902 8319855f 2023-01-15 op <div id="header_commit_msg_title">Message:</div>
903 8319855f 2023-01-15 op <div id="header_commit_msg">{{ rc->commit_msg }}</div>
906 8319855f 2023-01-15 op <div class="dotted_line"></div>
907 8319855f 2023-01-15 op <div id="blame">
910 8319855f 2023-01-15 op err = got_output_file_blame(c, &blame_line);
912 8319855f 2023-01-15 op log_warnx("%s: got_output_file_blame: %s", __func__,
921 8319855f 2023-01-15 op {{ define blame_line(struct template *tp, const char *line,
922 8319855f 2023-01-15 op struct blame_line *bline, int lprec, int lcur) }}
924 8319855f 2023-01-15 op struct request *c = tp->tp_arg;
925 8319855f 2023-01-15 op struct transport *t = c->t;
926 8319855f 2023-01-15 op struct repo_dir *repo_dir = t->repo_dir;
927 8319855f 2023-01-15 op char *committer, *s;
928 8319855f 2023-01-15 op struct gotweb_url url = {
929 8319855f 2023-01-15 op .action = DIFF,
930 8319855f 2023-01-15 op .index_page = -1,
932 8319855f 2023-01-15 op .path = repo_dir->name,
933 8319855f 2023-01-15 op .commit = bline->id_str,
936 8319855f 2023-01-15 op s = strchr(bline->committer, '<');
937 8319855f 2023-01-15 op committer = s ? s + 1 : bline->committer;
939 8319855f 2023-01-15 op s = strchr(committer, '@');
943 8319855f 2023-01-15 op <div class="blame_wrapper">
944 8319855f 2023-01-15 op <div class="blame_number">{{ printf "%.*d", lprec, lcur }}</div>
945 8319855f 2023-01-15 op <div class="blame_hash">
946 8319855f 2023-01-15 op <a href="{{ render gotweb_render_url(c, &url) }}">
947 8319855f 2023-01-15 op {{ printf "%.8s", bline->id_str }}
950 8319855f 2023-01-15 op <div class="blame_date">{{ bline->datebuf }}</div>
951 8319855f 2023-01-15 op <div class="blame_author">{{ printf "%.9s", committer }}</div>
952 8319855f 2023-01-15 op <div class="blame_code">{{ line }}</div>
956 1abb18e1 2022-12-20 op {{ define gotweb_render_rss(struct template *tp) }}
958 1abb18e1 2022-12-20 op struct request *c = tp->tp_arg;
959 1abb18e1 2022-12-20 op struct server *srv = c->srv;
960 1abb18e1 2022-12-20 op struct transport *t = c->t;
961 1abb18e1 2022-12-20 op struct repo_dir *repo_dir = t->repo_dir;
962 1abb18e1 2022-12-20 op struct repo_tag *rt;
963 1abb18e1 2022-12-20 op struct gotweb_url summary = {
964 1abb18e1 2022-12-20 op .action = SUMMARY,
965 1abb18e1 2022-12-20 op .index_page = -1,
967 1abb18e1 2022-12-20 op .path = repo_dir->name,
970 1abb18e1 2022-12-20 op <?xml version="1.0" encoding="UTF-8"?>
971 1abb18e1 2022-12-20 op <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
973 1abb18e1 2022-12-20 op <title>Tags of {{ repo_dir->name }}</title>
976 1abb18e1 2022-12-20 op {{ render gotweb_render_absolute_url(c, &summary) }}
979 1abb18e1 2022-12-20 op {{ if srv->show_repo_description }}
980 1abb18e1 2022-12-20 op <description>{{ repo_dir->description }}</description>
982 1abb18e1 2022-12-20 op {{ tailq-foreach rt &t->repo_tags entry }}
983 1abb18e1 2022-12-20 op {{ render rss_tag_item(tp, rt) }}
989 1abb18e1 2022-12-20 op {{ define rss_tag_item(struct template *tp, struct repo_tag *rt) }}
991 1abb18e1 2022-12-20 op struct request *c = tp->tp_arg;
992 1abb18e1 2022-12-20 op struct transport *t = c->t;
993 1abb18e1 2022-12-20 op struct repo_dir *repo_dir = t->repo_dir;
994 1abb18e1 2022-12-20 op char *tag_name = rt->tag_name;
995 1abb18e1 2022-12-20 op struct gotweb_url tag = {
996 1abb18e1 2022-12-20 op .action = TAG,
997 1abb18e1 2022-12-20 op .index_page = -1,
999 1abb18e1 2022-12-20 op .path = repo_dir->name,
1000 1abb18e1 2022-12-20 op .commit = rt->commit_id,
1003 1abb18e1 2022-12-20 op if (strncmp(tag_name, "refs/tags/", 10) == 0)
1004 1abb18e1 2022-12-20 op tag_name += 10;
1007 1abb18e1 2022-12-20 op <title>{{ repo_dir->name }} {{" "}} {{ tag_name }}</title>
1010 1abb18e1 2022-12-20 op {{ render gotweb_render_absolute_url(c, &tag) }}
1013 1abb18e1 2022-12-20 op <description>
1014 1abb18e1 2022-12-20 op <![CDATA[<pre>{{ rt->tag_commit }}</pre>]]>
1015 1abb18e1 2022-12-20 op </description>
1016 1abb18e1 2022-12-20 op {{ render rss_author(tp, rt->tagger) }}
1017 1abb18e1 2022-12-20 op <guid isPermaLink="false">{{ rt->commit_id }}</guid>
1019 1abb18e1 2022-12-20 op {{ render gotweb_render_age(tp, rt->tagger_time, TM_RFC822) }}
1024 1abb18e1 2022-12-20 op {{ define rss_author(struct template *tp, char *author) }}
1026 1abb18e1 2022-12-20 op char *t, *mail;
1028 1abb18e1 2022-12-20 op /* what to do if the author name contains a paren? */
1029 1abb18e1 2022-12-20 op if (strchr(author, '(') != NULL || strchr(author, ')') != NULL)
1032 1abb18e1 2022-12-20 op t = strchr(author, '<');
1033 1abb18e1 2022-12-20 op if (t == NULL)
1038 1abb18e1 2022-12-20 op while (isspace((unsigned char)*--t))
1041 1abb18e1 2022-12-20 op t = strchr(mail, '>');
1042 1abb18e1 2022-12-20 op if (t == NULL)
1047 1abb18e1 2022-12-20 op {{ mail }} {{" "}} ({{ author }})