3 * Copyright (c) 2022 Omar Polo <op@openbsd.org>
4 * Copyright (c) 2016, 2019, 2020-2022 Tracey Emery <tracey@traceyemery.net>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #include "got_compat.h"
21 #include <sys/types.h>
22 #include <sys/queue.h>
33 #include "got_error.h"
34 #include "got_object.h"
35 #include "got_reference.h"
42 static int gotweb_render_blob_line(struct template *, const char *, size_t);
43 static int gotweb_render_tree_item(struct template *, struct got_tree_entry *);
44 static int blame_line(struct template *, const char *, struct blame_line *,
47 static inline int gotweb_render_more(struct template *, int);
49 static inline int diff_line(struct template *, char *);
50 static inline int tag_item(struct template *, struct repo_tag *);
51 static inline int branch(struct template *, struct got_reflist_entry *);
52 static inline int rss_tag_item(struct template *, struct repo_tag *);
53 static inline int rss_author(struct template *, char *);
57 {{ define gotweb_render_page(struct template *tp,
58 int (*body)(struct template *)) }}
60 struct request *c = tp->tp_arg;
61 struct server *srv = c->srv;
62 struct querystring *qs = c->t->qs;
63 struct gotweb_url u_path;
64 const char *prfx = c->document_uri;
65 const char *css = srv->custom_css;
67 memset(&u_path, 0, sizeof(u_path));
68 u_path.index_page = -1;
70 u_path.action = SUMMARY;
75 <meta charset="utf-8" />
76 <title>{{ srv->site_name }}</title>
77 <meta name="viewport" content="initial-scale=.75" />
78 <meta name="msapplication-TileColor" content="#da532c" />
79 <meta name="theme-color" content="#ffffff"/>
80 <link rel="apple-touch-icon" sizes="180x180" href="{{ prfx }}apple-touch-icon.png" />
81 <link rel="icon" type="image/png" sizes="32x32" href="{{ prfx }}favicon-32x32.png" />
82 <link rel="icon" type="image/png" sizes="16x16" href="{{ prfx }}favicon-16x16.png" />
83 <link rel="manifest" href="{{ prfx }}site.webmanifest"/>
84 <link rel="mask-icon" href="{{ prfx }}safari-pinned-tab.svg" />
85 <link rel="stylesheet" type="text/css" href="{{ prfx }}{{ css }}" />
91 <a href="{{ srv->logo_url }}" target="_blank">
92 <img src="{{ prfx }}{{ srv->logo }}" />
98 <a href="?index_page={{ printf "%d", qs->index_page }}">
102 {! u_path.path = qs->path; !}
104 <a href="{{ render gotweb_render_url(tp->tp_arg, &u_path)}}">
108 {{ if qs->action != INDEX }}
109 {{ " / " }}{{ gotweb_action_name(qs->action) }}
114 {{ render body(tp) }}
115 <div id="site_owner_wrapper">
116 <div id="site_owner">
117 {{ if srv->show_site_owner }}
118 {{ srv->site_owner }}
128 {{ define gotweb_render_error(struct template *tp) }}
130 struct request *c = tp->tp_arg;
131 struct transport *t = c->t;
133 <div id="err_content">
137 See daemon logs for details
142 {{ define gotweb_render_repo_table_hdr(struct template *tp) }}
144 struct request *c = tp->tp_arg;
145 struct server *srv = c->srv;
147 <div id="index_header">
148 <div id="index_header_project">
151 {{ if srv->show_repo_description }}
152 <div id="index_header_description">
156 {{ if srv->show_repo_owner }}
157 <div id="index_header_owner">
161 {{ if srv->show_repo_age }}
162 <div id="index_header_age">
169 {{ define gotweb_render_repo_fragment(struct template *tp, struct repo_dir *repo_dir) }}
171 struct request *c = tp->tp_arg;
172 struct server *srv = c->srv;
173 struct gotweb_url summary = {
177 .path = repo_dir->name,
182 .path = repo_dir->name,
187 .path = repo_dir->name,
192 .path = repo_dir->name,
197 .path = repo_dir->name,
202 .path = repo_dir->name,
205 <div class="index_wrapper">
206 <div class="index_project">
207 <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">{{ repo_dir->name }}</a>
209 {{ if srv->show_repo_description }}
210 <div class="index_project_description">
211 {{ repo_dir->description }}
214 {{ if srv->show_repo_owner }}
215 <div class="index_project_owner">
216 {{ repo_dir->owner }}
219 {{ if srv->show_repo_age }}
220 <div class="index_project_age">
221 {{ render gotweb_render_age(tp, repo_dir->age, TM_DIFF) }}
224 <div class="navs_wrapper">
226 <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">summary</a>
228 <a href="{{ render gotweb_render_url(tp->tp_arg, &briefs) }}">briefs</a>
230 <a href="{{ render gotweb_render_url(tp->tp_arg, &commits) }}">commits</a>
232 <a href="{{ render gotweb_render_url(tp->tp_arg, &tags) }}">tags</a>
234 <a href="{{ render gotweb_render_url(tp->tp_arg, &tree) }}">tree</a>
236 <a href="{{ render gotweb_render_url(tp->tp_arg, &rss) }}">rss</a>
238 <div class="dotted_line"></div>
243 {{ define gotweb_render_briefs(struct template *tp) }}
245 const struct got_error *error;
246 struct request *c = tp->tp_arg;
247 struct server *srv = c->srv;
248 struct transport *t = c->t;
249 struct querystring *qs = c->t->qs;
250 struct repo_commit *rc;
251 struct repo_dir *repo_dir = t->repo_dir;
252 struct gotweb_url diff_url, tree_url;
255 diff_url = (struct gotweb_url){
259 .path = repo_dir->name,
260 .headref = qs->headref,
262 tree_url = (struct gotweb_url){
266 .path = repo_dir->name,
267 .headref = qs->headref,
270 if (qs->action == SUMMARY) {
272 error = got_get_repo_commits(c, D_MAXSLCOMMDISP);
274 error = got_get_repo_commits(c, srv->max_commits_display);
278 <div id="briefs_title_wrapper">
279 <div id="briefs_title">Commit Briefs</div>
281 <div id="briefs_content">
282 {{ tailq-foreach rc &t->repo_commits entry }}
284 diff_url.commit = rc->commit_id;
285 tree_url.commit = rc->commit_id;
287 tmp = strchr(rc->committer, '<');
291 tmp = strchr(rc->commit_msg, '\n');
295 <div class="briefs_age">
296 {{ render gotweb_render_age(tp, rc->committer_time, TM_DIFF) }}
298 <div class="briefs_author">
301 <div class="briefs_log">
302 <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
305 {{ if rc->refs_str }}
306 {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
310 <div class="navs_wrapper">
312 <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">diff</a>
314 <a href="{{ render gotweb_render_url(tp->tp_arg, &tree_url) }}">tree</a>
317 <div class="dotted_line"></div>
319 {{ render gotweb_render_more(tp, BRIEFS) }}
323 {{ define gotweb_render_more(struct template *tp, int action) }}
325 struct request *c = tp->tp_arg;
326 struct transport *t = c->t;
327 struct querystring *qs = t->qs;
328 struct gotweb_url more = {
332 .commit = t->more_id,
333 .headref = qs->headref,
337 <div id="np_wrapper">
339 <a href="{{ render gotweb_render_url(c, &more) }}">
347 {{ define gotweb_render_navs(struct template *tp) }}
349 struct request *c = tp->tp_arg;
350 struct transport *t = c->t;
351 struct gotweb_url prev, next;
352 int have_prev, have_next;
354 gotweb_get_navs(c, &prev, &have_prev, &next, &have_next);
356 <div id="np_wrapper">
359 <a href="{{ render gotweb_render_url(c, &prev) }}">
366 <a href="{{ render gotweb_render_url(c, &next) }}">
381 {{ define gotweb_render_commits(struct template *tp) }}
383 struct request *c = tp->tp_arg;
384 struct transport *t = c->t;
385 struct repo_dir *repo_dir = t->repo_dir;
386 struct repo_commit *rc;
387 struct gotweb_url diff, tree;
389 diff = (struct gotweb_url){
393 .path = repo_dir->name,
395 tree = (struct gotweb_url){
399 .path = repo_dir->name,
402 <div class="commits_title_wrapper">
403 <div class="commits_title">Commits</div>
405 <div class="commits_content">
406 {{ tailq-foreach rc &t->repo_commits entry }}
408 diff.commit = rc->commit_id;
409 tree.commit = rc->commit_id;
411 <div class="commits_header_wrapper">
412 <div class="commits_header">
413 <div class="header_commit_title">Commit:</div>
414 <div class="header_commit">{{ rc->commit_id }}</div>
415 <div class="header_author_title">From:</div>
416 <div class="header_author">{{ rc->author }}</div>
417 {{ if strcmp(rc->committer, rc->author) != 0 }}
418 <div class="header_author_title">Via:</div>
419 <div class="header_author">{{ rc->committer }}</div>
421 <div class="header_age_title">Date:</div>
422 <div class="header_age">
423 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
427 <div class="dotted_line"></div>
432 <div class="navs_wrapper">
434 <a href="{{ render gotweb_render_url(c, &diff) }}">diff</a>
436 <a href="{{ render gotweb_render_url(c, &tree) }}">tree</a>
439 <div class="dotted_line"></div>
441 {{ render gotweb_render_more(tp, COMMITS) }}
445 {{ define gotweb_render_blob(struct template *tp) }}
447 struct request *c = tp->tp_arg;
448 struct transport *t = c->t;
449 struct got_blob_object *blob = t->blob;
450 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
452 <div id="blob_title_wrapper">
453 <div id="blob_title">Blob</div>
455 <div id="blob_content">
456 <div id="blob_header_wrapper">
457 <div id="blob_header">
458 <div class="header_age_title">Date:</div>
459 <div class="header_age">
460 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
462 <div id="header_commit_msg_title">Message:</div>
463 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
466 <div class="dotted_line"></div>
469 {{ render got_output_blob_by_lines(tp, blob, gotweb_render_blob_line) }}
475 {{ define gotweb_render_blob_line(struct template *tp, const char *line,
481 r = snprintf(lineno, sizeof(lineno), "%zu", no);
482 if (r < 0 || (size_t)r >= sizeof(lineno))
485 <div class="blob_line" id="line{{ lineno }}">
486 <div class="blob_number">
487 <a href="#line{{ lineno }}">{{ lineno }}</a>
489 <div class="blob_code">{{ line }}</div>
493 {{ define gotweb_render_tree(struct template *tp) }}
495 struct request *c = tp->tp_arg;
496 struct transport *t = c->t;
497 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
499 <div id="tree_title_wrapper">
500 <div id="tree_title">Tree</div>
502 <div id="tree_content">
503 <div id="tree_header_wrapper">
504 <div id="tree_header">
505 <div id="header_tree_title">Tree:</div>
506 <div id="header_tree">{{ rc->tree_id }}</div>
507 <div class="header_age_title">Date:</div>
508 <div class="header_age">
509 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
511 <div id="header_commit_msg_title">Message:</div>
512 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
515 <div class="dotted_line"></div>
517 {{ render got_output_repo_tree(c, gotweb_render_tree_item) }}
522 {{ define gotweb_render_tree_item(struct template *tp,
523 struct got_tree_entry *te) }}
525 struct request *c = tp->tp_arg;
526 struct transport *t = c->t;
527 struct querystring *qs = t->qs;
528 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
529 const char *modestr = "";
534 struct gotweb_url url = {
537 .commit = rc->commit_id,
541 name = got_tree_entry_get_name(te);
542 mode = got_tree_entry_get_mode(te);
544 folder = qs->folder ? qs->folder : "";
546 if (asprintf(&dir, "%s/%s", folder, name) == -1)
557 if (got_object_tree_entry_is_submodule(te))
559 else if (S_ISLNK(mode))
561 else if (S_ISDIR(mode))
563 else if (mode & S_IXUSR)
566 <div class="tree_wrapper">
567 {{ if S_ISDIR(mode) }}
568 <div class="tree_line">
569 <a href="{{ render gotweb_render_url(c, &url) }}">
570 {{ name }}{{ modestr }}
573 <div class="tree_line_blank"> </div>
575 <div class="tree_line">
576 <a href="{{ render gotweb_render_url(c, &url) }}">
577 {{ name }}{{ modestr }}
580 <div class="tree_line_blank">
581 {! url.action = COMMITS; !}
582 <a href="{{ render gotweb_render_url(c, &url) }}">
586 {! url.action = BLAME; !}
587 <a href="{{ render gotweb_render_url(c, &url) }}">
599 {{ define gotweb_render_tags(struct template *tp) }}
601 struct request *c = tp->tp_arg;
602 struct transport *t = c->t;
603 struct querystring *qs = t->qs;
607 commit_found = qs->commit == NULL;
609 <div id="tags_title_wrapper">
610 <div id="tags_title">Tags</div>
612 <div id="tags_content">
613 {{ if t->tag_count == 0 }}
614 <div id="err_content">
615 This repository contains no tags
618 {{ tailq-foreach rt &t->repo_tags entry }}
619 {{ if commit_found || !strcmp(qs->commit, rt->commit_id) }}
620 {! commit_found = 1; !}
621 {{ render tag_item(tp, rt) }}
624 {{ if t->next_id || t->prev_id }}
625 {! qs->action = TAGS; !}
626 {{ render gotweb_render_navs(tp) }}
632 {{ define tag_item(struct template *tp, struct repo_tag *rt) }}
634 struct request *c = tp->tp_arg;
635 struct transport *t = c->t;
636 struct repo_dir *repo_dir = t->repo_dir;
637 char *tag_name = rt->tag_name;
638 char *msg = rt->tag_commit;
640 struct gotweb_url url = {
644 .path = repo_dir->name,
645 .commit = rt->commit_id,
648 if (strncmp(tag_name, "refs/tags/", 10) == 0)
652 nl = strchr(msg, '\n');
657 <div class="tag_age">
658 {{ render gotweb_render_age(tp, rt->tagger_time, TM_DIFF) }}
660 <div class="tag">{{ tag_name }}</div>
661 <div class="tag_log">
662 <a href="{{ render gotweb_render_url(c, &url) }}">
666 <div class="navs_wrapper">
668 <a href="{{ render gotweb_render_url(c, &url) }}">tag</a>
670 {! url.action = BRIEFS; !}
671 <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
673 {! url.action = COMMITS; !}
674 <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
677 <div class="dotted_line"></div>
680 {{ define gotweb_render_tag(struct template *tp) }}
682 struct request *c = tp->tp_arg;
683 struct transport *t = c->t;
685 const char *tag_name;
687 rt = TAILQ_LAST(&t->repo_tags, repo_tags_head);
688 tag_name = rt->tag_name;
690 if (strncmp(tag_name, "refs/", 5) == 0)
693 <div id="tags_title_wrapper">
694 <div id="tags_title">Tag</div>
696 <div id="tags_content">
697 <div id="tag_header_wrapper">
698 <div id="tag_header">
699 <div class="header_commit_title">Commit:</div>
700 <div class="header_commit">
703 <span class="refs_str">({{ tag_name }})</span>
705 <div class="header_author_title">Tagger:</div>
706 <div class="header_author">{{ rt->tagger }}</div>
707 <div class="header_age_title">Date:</div>
708 <div class="header_age">
709 {{ render gotweb_render_age(tp, rt->tagger_time, TM_LONG)}}
711 <div id="header_commit_msg_title">Message:</div>
712 <div id="header_commit_msg">{{ rt->commit_msg }}</div>
714 <div class="dotted_line"></div>
715 <div id="tag_commit">
723 {{ define gotweb_render_diff(struct template *tp) }}
725 struct request *c = tp->tp_arg;
726 struct transport *t = c->t;
728 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
733 <div id="diff_title_wrapper">
734 <div id="diff_title">Commit Diff</div>
736 <div id="diff_content">
737 <div id="diff_header_wrapper">
738 <div id="diff_header">
739 <div class="header_commit_title">Commit:</div>
740 <div class="header_commit">{{ rc->commit_id }}</div>
741 <div class="header_author_title">From:</div>
742 <div class="header_author">{{ rc->author }}</div>
743 {{ if strcmp(rc->committer, rc->author) != 0 }}
744 <div class="header_author_title">Via:</div>
745 <div class="header_author">{{ rc->committer }}</div>
747 <div class="header_age_title">Date:</div>
748 <div class="header_age">
749 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
751 <div id="header_commit_msg_title">Message:</div>
752 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
755 <div class="dotted_line"></div>
758 {{ while (linelen = getline(&line, &linesize, fp)) != -1 }}
759 {{ render diff_line(tp, line) }}
767 {{ define diff_line(struct template *tp, char *line )}}
769 const char *color = NULL;
772 if (!strncmp(line, "-", 1))
773 color = "diff_minus";
774 else if (!strncmp(line, "+", 1))
776 else if (!strncmp(line, "@@", 2))
777 color = "diff_chunk_header";
778 else if (!strncmp(line, "commit +", 8) ||
779 !strncmp(line, "commit -", 8) ||
780 !strncmp(line, "blob +", 6) ||
781 !strncmp(line, "blob -", 6) ||
782 !strncmp(line, "file +", 6) ||
783 !strncmp(line, "file -", 6))
785 else if (!strncmp(line, "from:", 5) || !strncmp(line, "via:", 4))
786 color = "diff_author";
787 else if (!strncmp(line, "date:", 5))
790 nl = strchr(line, '\n');
794 <div class="diff_line {{ color }}">{{ line }}</div>
797 {{ define gotweb_render_branches(struct template *tp,
798 struct got_reflist_head *refs) }}
800 struct got_reflist_entry *re;
802 <div id="branches_title_wrapper">
803 <div id="branches_title">Branches</div>
805 <div id="branches_content">
806 {{ tailq-foreach re refs entry }}
807 {{ if !got_ref_is_symbolic(re->ref) }}
808 {{ render branch(tp, re) }}
814 {{ define branch(struct template *tp, struct got_reflist_entry *re) }}
816 const struct got_error *err;
817 struct request *c = tp->tp_arg;
818 struct querystring *qs = c->t->qs;
821 struct gotweb_url url = {
828 refname = got_ref_get_name(re->ref);
830 err = got_get_repo_age(&age, c, refname);
832 log_warnx("%s: %s", __func__, err->msg);
836 if (strncmp(refname, "refs/heads/", 11) == 0)
839 url.headref = refname;
841 <div class="branches_wrapper">
842 <div class="branches_age">
843 {{ render gotweb_render_age(tp, age, TM_DIFF) }}
845 <div class="branches_space"> </div>
847 <a href="{{ render gotweb_render_url(c, &url) }}">{{ refname }}</a>
849 <div class="navs_wrapper">
851 <a href="{{ render gotweb_render_url(c, &url) }}">summary</a>
853 {! url.action = BRIEFS; !}
854 <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
856 {! url.action = COMMITS; !}
857 <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
860 <div class="dotted_line"></div>
864 {{ define gotweb_render_summary(struct template *tp) }}
866 struct request *c = tp->tp_arg;
867 struct server *srv = c->srv;
868 struct transport *t = c->t;
869 struct got_reflist_head *refs = &t->refs;
871 <div id="summary_wrapper">
872 {{ if srv->show_repo_description }}
873 <div id="description_title">Description:</div>
874 <div id="description">{{ t->repo_dir->description }}</div>
876 {{ if srv->show_repo_owner }}
877 <div id="repo_owner_title">Owner:</div>
878 <div id="repo_owner">{{ t->repo_dir->owner }}</div>
880 {{ if srv->show_repo_age }}
881 <div id="last_change_title">Last Change:</div>
882 <div id="last_change">
883 {{ render gotweb_render_age(tp, t->repo_dir->age, TM_DIFF) }}
886 {{ if srv->show_repo_cloneurl }}
887 <div id="cloneurl_title">Clone URL:</div>
888 <div id="cloneurl">{{ t->repo_dir->url }}</div>
891 {{ render gotweb_render_briefs(tp) }}
892 {{ render gotweb_render_tags(tp) }}
893 {{ render gotweb_render_branches(tp, refs) }}
896 {{ define gotweb_render_blame(struct template *tp) }}
898 const struct got_error *err;
899 struct request *c = tp->tp_arg;
900 struct transport *t = c->t;
901 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
903 <div id="blame_title_wrapper">
904 <div id="blame_title">Blame</div>
906 <div id="blame_content">
907 <div id="blame_header_wrapper">
908 <div id="blame_header">
909 <div class="header_age_title">Date:</div>
910 <div class="header_age">
911 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
913 <div id="header_commit_msg_title">Message:</div>
914 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
917 <div class="dotted_line"></div>
921 err = got_output_file_blame(c, &blame_line);
923 log_warnx("%s: got_output_file_blame: %s", __func__,
932 {{ define blame_line(struct template *tp, const char *line,
933 struct blame_line *bline, int lprec, int lcur) }}
935 struct request *c = tp->tp_arg;
936 struct transport *t = c->t;
937 struct repo_dir *repo_dir = t->repo_dir;
939 struct gotweb_url url = {
943 .path = repo_dir->name,
944 .commit = bline->id_str,
947 s = strchr(bline->committer, '<');
948 committer = s ? s + 1 : bline->committer;
950 s = strchr(committer, '@');
954 <div class="blame_wrapper">
955 <div class="blame_number">{{ printf "%.*d", lprec, lcur }}</div>
956 <div class="blame_hash">
957 <a href="{{ render gotweb_render_url(c, &url) }}">
958 {{ printf "%.8s", bline->id_str }}
961 <div class="blame_date">{{ bline->datebuf }}</div>
962 <div class="blame_author">{{ printf "%.9s", committer }}</div>
963 <div class="blame_code">{{ line }}</div>
967 {{ define gotweb_render_rss(struct template *tp) }}
969 struct request *c = tp->tp_arg;
970 struct server *srv = c->srv;
971 struct transport *t = c->t;
972 struct repo_dir *repo_dir = t->repo_dir;
974 struct gotweb_url summary = {
978 .path = repo_dir->name,
981 <?xml version="1.0" encoding="UTF-8"?>
982 <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
984 <title>Tags of {{ repo_dir->name }}</title>
987 {{ render gotweb_render_absolute_url(c, &summary) }}
990 {{ if srv->show_repo_description }}
991 <description>{{ repo_dir->description }}</description>
993 {{ tailq-foreach rt &t->repo_tags entry }}
994 {{ render rss_tag_item(tp, rt) }}
1000 {{ define rss_tag_item(struct template *tp, struct repo_tag *rt) }}
1002 struct request *c = tp->tp_arg;
1003 struct transport *t = c->t;
1004 struct repo_dir *repo_dir = t->repo_dir;
1005 char *tag_name = rt->tag_name;
1006 struct gotweb_url tag = {
1010 .path = repo_dir->name,
1011 .commit = rt->commit_id,
1014 if (strncmp(tag_name, "refs/tags/", 10) == 0)
1018 <title>{{ repo_dir->name }} {{" "}} {{ tag_name }}</title>
1021 {{ render gotweb_render_absolute_url(c, &tag) }}
1025 <![CDATA[<pre>{{ rt->tag_commit }}</pre>]]>
1027 {{ render rss_author(tp, rt->tagger) }}
1028 <guid isPermaLink="false">{{ rt->commit_id }}</guid>
1030 {{ render gotweb_render_age(tp, rt->tagger_time, TM_RFC822) }}
1035 {{ define rss_author(struct template *tp, char *author) }}
1039 /* what to do if the author name contains a paren? */
1040 if (strchr(author, '(') != NULL || strchr(author, ')') != NULL)
1043 t = strchr(author, '<');
1049 while (isspace((unsigned char)*--t))
1052 t = strchr(mail, '>');
1058 {{ mail }} {{" "}} ({{ author }})