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 <sys/types.h>
20 #include <sys/queue.h>
32 #include "got_error.h"
33 #include "got_object.h"
34 #include "got_reference.h"
41 static int gotweb_render_blob_line(struct template *, const char *, size_t);
42 static int gotweb_render_tree_item(struct template *, struct got_tree_entry *);
43 static int blame_line(struct template *, const char *, struct blame_line *,
46 static inline int gotweb_render_more(struct template *, int);
48 static inline int diff_line(struct template *, char *);
49 static inline int tag_item(struct template *, struct repo_tag *);
50 static inline int branch(struct template *, struct got_reflist_entry *);
51 static inline int rss_tag_item(struct template *, struct repo_tag *);
52 static inline int rss_author(struct template *, char *);
56 {{ define gotweb_render_header(struct template *tp) }}
58 struct request *c = tp->tp_arg;
59 struct server *srv = c->srv;
60 struct querystring *qs = c->t->qs;
61 struct gotweb_url u_path;
62 const char *prfx = c->document_uri;
63 const char *css = srv->custom_css;
65 memset(&u_path, 0, sizeof(u_path));
66 u_path.index_page = -1;
68 u_path.action = SUMMARY;
73 <meta charset="utf-8" />
74 <title>{{ srv->site_name }}</title>
75 <meta name="viewport" content="initial-scale=.75" />
76 <meta name="msapplication-TileColor" content="#da532c" />
77 <meta name="theme-color" content="#ffffff"/>
78 <link rel="apple-touch-icon" sizes="180x180" href="{{ prfx }}apple-touch-icon.png" />
79 <link rel="icon" type="image/png" sizes="32x32" href="{{ prfx }}favicon-32x32.png" />
80 <link rel="icon" type="image/png" sizes="16x16" href="{{ prfx }}favicon-16x16.png" />
81 <link rel="manifest" href="{{ prfx }}site.webmanifest"/>
82 <link rel="mask-icon" href="{{ prfx }}safari-pinned-tab.svg" />
83 <link rel="stylesheet" type="text/css" href="{{ prfx }}{{ css }}" />
89 <a href="{{ srv->logo_url }}" target="_blank">
90 <img src="{{ prfx }}{{ srv->logo }}" />
96 <a href="?index_page={{ printf "%d", qs->index_page }}">
100 {! u_path.path = qs->path; !}
102 <a href="{{ render gotweb_render_url(tp->tp_arg, &u_path)}}">
106 {{ if qs->action != INDEX }}
107 {{ " / " }}{{ gotweb_action_name(qs->action) }}
114 {{ define gotweb_render_footer(struct template *tp) }}
116 struct request *c = tp->tp_arg;
117 struct server *srv = c->srv;
119 <div id="site_owner_wrapper">
120 <div id="site_owner">
121 {{ if srv->show_site_owner }}
122 {{ srv->site_owner }}
132 {{ define gotweb_render_repo_table_hdr(struct template *tp) }}
134 struct request *c = tp->tp_arg;
135 struct server *srv = c->srv;
137 <div id="index_header">
138 <div id="index_header_project">
141 {{ if srv->show_repo_description }}
142 <div id="index_header_description">
146 {{ if srv->show_repo_owner }}
147 <div id="index_header_owner">
151 {{ if srv->show_repo_age }}
152 <div id="index_header_age">
159 {{ define gotweb_render_repo_fragment(struct template *tp, struct repo_dir *repo_dir) }}
161 struct request *c = tp->tp_arg;
162 struct server *srv = c->srv;
163 struct gotweb_url summary = {
167 .path = repo_dir->name,
172 .path = repo_dir->name,
177 .path = repo_dir->name,
182 .path = repo_dir->name,
187 .path = repo_dir->name,
192 .path = repo_dir->name,
195 <div class="index_wrapper">
196 <div class="index_project">
197 <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">{{ repo_dir->name }}</a>
199 {{ if srv->show_repo_description }}
200 <div class="index_project_description">
201 {{ repo_dir->description }}
204 {{ if srv->show_repo_owner }}
205 <div class="index_project_owner">
206 {{ repo_dir->owner }}
209 {{ if srv->show_repo_age }}
210 <div class="index_project_age">
211 {{ render gotweb_render_age(tp, repo_dir->age, TM_DIFF) }}
214 <div class="navs_wrapper">
216 <a href="{{ render gotweb_render_url(tp->tp_arg, &summary) }}">summary</a>
218 <a href="{{ render gotweb_render_url(tp->tp_arg, &briefs) }}">briefs</a>
220 <a href="{{ render gotweb_render_url(tp->tp_arg, &commits) }}">commits</a>
222 <a href="{{ render gotweb_render_url(tp->tp_arg, &tags) }}">tags</a>
224 <a href="{{ render gotweb_render_url(tp->tp_arg, &tree) }}">tree</a>
226 <a href="{{ render gotweb_render_url(tp->tp_arg, &rss) }}">rss</a>
228 <div class="dotted_line"></div>
233 {{ define gotweb_render_briefs(struct template *tp) }}
235 const struct got_error *error;
236 struct request *c = tp->tp_arg;
237 struct server *srv = c->srv;
238 struct transport *t = c->t;
239 struct querystring *qs = c->t->qs;
240 struct repo_commit *rc;
241 struct repo_dir *repo_dir = t->repo_dir;
242 struct gotweb_url diff_url, tree_url;
245 diff_url = (struct gotweb_url){
249 .path = repo_dir->name,
250 .headref = qs->headref,
252 tree_url = (struct gotweb_url){
256 .path = repo_dir->name,
257 .headref = qs->headref,
260 if (qs->action == SUMMARY) {
262 error = got_get_repo_commits(c, D_MAXSLCOMMDISP);
264 error = got_get_repo_commits(c, srv->max_commits_display);
268 <div id="briefs_title_wrapper">
269 <div id="briefs_title">Commit Briefs</div>
271 <div id="briefs_content">
272 {{ tailq-foreach rc &t->repo_commits entry }}
274 diff_url.commit = rc->commit_id;
275 tree_url.commit = rc->commit_id;
277 tmp = strchr(rc->committer, '<');
281 tmp = strchr(rc->commit_msg, '\n');
285 <div class="briefs_age">
286 {{ render gotweb_render_age(tp, rc->committer_time, TM_DIFF) }}
288 <div class="briefs_author">
291 <div class="briefs_log">
292 <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
295 {{ if rc->refs_str }}
296 {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
300 <div class="navs_wrapper">
302 <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">diff</a>
304 <a href="{{ render gotweb_render_url(tp->tp_arg, &tree_url) }}">tree</a>
307 <div class="dotted_line"></div>
309 {{ render gotweb_render_more(tp, BRIEFS) }}
313 {{ define gotweb_render_more(struct template *tp, int action) }}
315 struct request *c = tp->tp_arg;
316 struct transport *t = c->t;
317 struct querystring *qs = t->qs;
318 struct gotweb_url more = {
322 .commit = t->more_id,
323 .headref = qs->headref,
327 <div id="np_wrapper">
329 <a href="{{ render gotweb_render_url(c, &more) }}">
337 {{ define gotweb_render_navs(struct template *tp) }}
339 struct request *c = tp->tp_arg;
340 struct transport *t = c->t;
341 struct gotweb_url prev, next;
342 int have_prev, have_next;
344 gotweb_get_navs(c, &prev, &have_prev, &next, &have_next);
346 <div id="np_wrapper">
349 <a href="{{ render gotweb_render_url(c, &prev) }}">
356 <a href="{{ render gotweb_render_url(c, &next) }}">
371 {{ define gotweb_render_commits(struct template *tp) }}
373 struct request *c = tp->tp_arg;
374 struct transport *t = c->t;
375 struct repo_dir *repo_dir = t->repo_dir;
376 struct repo_commit *rc;
377 struct gotweb_url diff, tree;
379 diff = (struct gotweb_url){
383 .path = repo_dir->name,
385 tree = (struct gotweb_url){
389 .path = repo_dir->name,
392 <div class="commits_title_wrapper">
393 <div class="commits_title">Commits</div>
395 <div class="commits_content">
396 {{ tailq-foreach rc &t->repo_commits entry }}
398 diff.commit = rc->commit_id;
399 tree.commit = rc->commit_id;
401 <div class="commits_header_wrapper">
402 <div class="commits_header">
403 <div class="header_commit_title">Commit:</div>
404 <div class="header_commit">{{ rc->commit_id }}</div>
405 <div class="header_author_title">From:</div>
406 <div class="header_author">{{ rc->author }}</div>
407 {{ if strcmp(rc->committer, rc->author) != 0 }}
408 <div class="header_author_title">Via:</div>
409 <div class="header_author">{{ rc->committer }}</div>
411 <div class="header_age_title">Date:</div>
412 <div class="header_age">
413 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
417 <div class="dotted_line"></div>
422 <div class="navs_wrapper">
424 <a href="{{ render gotweb_render_url(c, &diff) }}">diff</a>
426 <a href="{{ render gotweb_render_url(c, &tree) }}">tree</a>
429 <div class="dotted_line"></div>
431 {{ render gotweb_render_more(tp, COMMITS) }}
435 {{ define gotweb_render_blob(struct template *tp,
436 struct got_blob_object *blob) }}
438 struct request *c = tp->tp_arg;
439 struct transport *t = c->t;
440 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
442 <div id="blob_title_wrapper">
443 <div id="blob_title">Blob</div>
445 <div id="blob_content">
446 <div id="blob_header_wrapper">
447 <div id="blob_header">
448 <div class="header_age_title">Date:</div>
449 <div class="header_age">
450 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
452 <div id="header_commit_msg_title">Message:</div>
453 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
456 <div class="dotted_line"></div>
459 {{ render got_output_blob_by_lines(tp, blob, gotweb_render_blob_line) }}
465 {{ define gotweb_render_blob_line(struct template *tp, const char *line,
471 r = snprintf(lineno, sizeof(lineno), "%zu", no);
472 if (r < 0 || (size_t)r >= sizeof(lineno))
475 <div class="blob_line" id="line{{ lineno }}">
476 <div class="blob_number">
477 <a href="#line{{ lineno }}">{{ lineno }}</a>
479 <div class="blob_code">{{ line }}</div>
483 {{ define gotweb_render_tree(struct template *tp) }}
485 struct request *c = tp->tp_arg;
486 struct transport *t = c->t;
487 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
489 <div id="tree_title_wrapper">
490 <div id="tree_title">Tree</div>
492 <div id="tree_content">
493 <div id="tree_header_wrapper">
494 <div id="tree_header">
495 <div id="header_tree_title">Tree:</div>
496 <div id="header_tree">{{ rc->tree_id }}</div>
497 <div class="header_age_title">Date:</div>
498 <div class="header_age">
499 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
501 <div id="header_commit_msg_title">Message:</div>
502 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
505 <div class="dotted_line"></div>
507 {{ render got_output_repo_tree(c, gotweb_render_tree_item) }}
512 {{ define gotweb_render_tree_item(struct template *tp,
513 struct got_tree_entry *te) }}
515 struct request *c = tp->tp_arg;
516 struct transport *t = c->t;
517 struct querystring *qs = t->qs;
518 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
519 const char *modestr = "";
524 struct gotweb_url url = {
527 .commit = rc->commit_id,
531 name = got_tree_entry_get_name(te);
532 mode = got_tree_entry_get_mode(te);
534 folder = qs->folder ? qs->folder : "";
536 if (asprintf(&dir, "%s/%s", folder, name) == -1)
547 if (got_object_tree_entry_is_submodule(te))
549 else if (S_ISLNK(mode))
551 else if (S_ISDIR(mode))
553 else if (mode & S_IXUSR)
556 <div class="tree_wrapper">
557 {{ if S_ISDIR(mode) }}
558 <div class="tree_line">
559 <a href="{{ render gotweb_render_url(c, &url) }}">
560 {{ name }}{{ modestr }}
563 <div class="tree_line_blank"> </div>
565 <div class="tree_line">
566 <a href="{{ render gotweb_render_url(c, &url) }}">
567 {{ name }}{{ modestr }}
570 <div class="tree_line_blank">
571 {! url.action = COMMITS; !}
572 <a href="{{ render gotweb_render_url(c, &url) }}">
576 {! url.action = BLAME; !}
577 <a href="{{ render gotweb_render_url(c, &url) }}">
589 {{ define gotweb_render_tags(struct template *tp) }}
591 struct request *c = tp->tp_arg;
592 struct transport *t = c->t;
593 struct querystring *qs = t->qs;
597 commit_found = qs->commit == NULL;
599 <div id="tags_title_wrapper">
600 <div id="tags_title">Tags</div>
602 <div id="tags_content">
603 {{ if t->tag_count == 0 }}
604 <div id="err_content">
605 This repository contains no tags
608 {{ tailq-foreach rt &t->repo_tags entry }}
609 {{ if commit_found || !strcmp(qs->commit, rt->commit_id) }}
610 {! commit_found = 1; !}
611 {{ render tag_item(tp, rt) }}
614 {{ if t->next_id || t->prev_id }}
615 {! qs->action = TAGS; !}
616 {{ render gotweb_render_navs(tp) }}
622 {{ define tag_item(struct template *tp, struct repo_tag *rt) }}
624 struct request *c = tp->tp_arg;
625 struct transport *t = c->t;
626 struct repo_dir *repo_dir = t->repo_dir;
627 char *tag_name = rt->tag_name;
628 char *msg = rt->tag_commit;
630 struct gotweb_url url = {
634 .path = repo_dir->name,
635 .commit = rt->commit_id,
638 if (strncmp(tag_name, "refs/tags/", 10) == 0)
642 nl = strchr(msg, '\n');
647 <div class="tag_age">
648 {{ render gotweb_render_age(tp, rt->tagger_time, TM_DIFF) }}
650 <div class="tag">{{ tag_name }}</div>
651 <div class="tag_log">
652 <a href="{{ render gotweb_render_url(c, &url) }}">
656 <div class="navs_wrapper">
658 <a href="{{ render gotweb_render_url(c, &url) }}">tag</a>
660 {! url.action = BRIEFS; !}
661 <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
663 {! url.action = COMMITS; !}
664 <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
667 <div class="dotted_line"></div>
670 {{ define gotweb_render_tag(struct template *tp) }}
672 struct request *c = tp->tp_arg;
673 struct transport *t = c->t;
675 const char *tag_name;
677 rt = TAILQ_LAST(&t->repo_tags, repo_tags_head);
678 tag_name = rt->tag_name;
680 if (strncmp(tag_name, "refs/", 5) == 0)
683 <div id="tags_title_wrapper">
684 <div id="tags_title">Tag</div>
686 <div id="tags_content">
687 <div id="tag_header_wrapper">
688 <div id="tag_header">
689 <div class="header_commit_title">Commit:</div>
690 <div class="header_commit">
693 <span class="refs_str">({{ tag_name }})</span>
695 <div class="header_author_title">Tagger:</div>
696 <div class="header_author">{{ rt->tagger }}</div>
697 <div class="header_age_title">Date:</div>
698 <div class="header_age">
699 {{ render gotweb_render_age(tp, rt->tagger_time, TM_LONG)}}
701 <div id="header_commit_msg_title">Message:</div>
702 <div id="header_commit_msg">{{ rt->commit_msg }}</div>
704 <div class="dotted_line"></div>
705 <div id="tag_commit">
713 {{ define gotweb_render_diff(struct template *tp, FILE *fp) }}
715 struct request *c = tp->tp_arg;
716 struct transport *t = c->t;
717 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
722 <div id="diff_title_wrapper">
723 <div id="diff_title">Commit Diff</div>
725 <div id="diff_content">
726 <div id="diff_header_wrapper">
727 <div id="diff_header">
728 <div class="header_commit_title">Commit:</div>
729 <div class="header_commit">{{ rc->commit_id }}</div>
730 <div class="header_author_title">From:</div>
731 <div class="header_author">{{ rc->author }}</div>
732 {{ if strcmp(rc->committer, rc->author) != 0 }}
733 <div class="header_author_title">Via:</div>
734 <div class="header_author">{{ rc->committer }}</div>
736 <div class="header_age_title">Date:</div>
737 <div class="header_age">
738 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
740 <div id="header_commit_msg_title">Message</div>
741 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
744 <div class="dotted_line"></div>
747 {{ while (linelen = getline(&line, &linesize, fp)) != -1 }}
748 {{ render diff_line(tp, line) }}
756 {{ define diff_line(struct template *tp, char *line )}}
758 const char *color = NULL;
761 if (!strncmp(line, "-", 1))
762 color = "diff_minus";
763 else if (!strncmp(line, "+", 1))
765 else if (!strncmp(line, "@@", 2))
766 color = "diff_chunk_header";
767 else if (!strncmp(line, "commit +", 8) ||
768 !strncmp(line, "commit -", 8) ||
769 !strncmp(line, "blob +", 6) ||
770 !strncmp(line, "blob -", 6) ||
771 !strncmp(line, "file +", 6) ||
772 !strncmp(line, "file -", 6))
774 else if (!strncmp(line, "from:", 5) || !strncmp(line, "via:", 4))
775 color = "diff_author";
776 else if (!strncmp(line, "date:", 5))
779 nl = strchr(line, '\n');
783 <div class="diff_line {{ color }}">{{ line }}</div>
786 {{ define gotweb_render_branches(struct template *tp,
787 struct got_reflist_head *refs) }}
789 struct got_reflist_entry *re;
791 <div id="branches_title_wrapper">
792 <div id="branches_title">Branches</div>
794 <div id="branches_content">
795 {{ tailq-foreach re refs entry }}
796 {{ if !got_ref_is_symbolic(re->ref) }}
797 {{ render branch(tp, re) }}
803 {{ define branch(struct template *tp, struct got_reflist_entry *re) }}
805 const struct got_error *err;
806 struct request *c = tp->tp_arg;
807 struct querystring *qs = c->t->qs;
810 struct gotweb_url url = {
817 refname = got_ref_get_name(re->ref);
819 err = got_get_repo_age(&age, c, refname);
821 log_warnx("%s: %s", __func__, err->msg);
825 if (strncmp(refname, "refs/heads/", 11) == 0)
828 url.headref = refname;
830 <div class="branches_wrapper">
831 <div class="branches_age">
832 {{ render gotweb_render_age(tp, age, TM_DIFF) }}
834 <div class="branches_space"> </div>
836 <a href="{{ render gotweb_render_url(c, &url) }}">{{ refname }}</a>
838 <div class="navs_wrapper">
840 <a href="{{ render gotweb_render_url(c, &url) }}">summary</a>
842 {! url.action = BRIEFS; !}
843 <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
845 {! url.action = COMMITS; !}
846 <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
849 <div class="dotted_line"></div>
853 {{ define gotweb_render_summary(struct template *tp,
854 struct got_reflist_head *refs) }}
856 struct request *c = tp->tp_arg;
857 struct server *srv = c->srv;
858 struct transport *t = c->t;
860 <div id="summary_wrapper">
861 {{ if srv->show_repo_description }}
862 <div id="description_title">Description:</div>
863 <div id="description">{{ t->repo_dir->description }}</div>
865 {{ if srv->show_repo_owner }}
866 <div id="repo_owner_title">Owner:</div>
867 <div id="repo_owner">{{ t->repo_dir->owner }}</div>
869 {{ if srv->show_repo_age }}
870 <div id="last_change_title">Last Change:</div>
871 <div id="last_change">
872 {{ render gotweb_render_age(tp, t->repo_dir->age, TM_DIFF) }}
875 {{ if srv->show_repo_cloneurl }}
876 <div id="cloneurl_title">Clone URL:</div>
877 <div id="cloneurl">{{ t->repo_dir->url }}</div>
880 {{ render gotweb_render_briefs(tp) }}
881 {{ render gotweb_render_tags(tp) }}
882 {{ render gotweb_render_branches(tp, refs) }}
885 {{ define gotweb_render_blame(struct template *tp) }}
887 const struct got_error *err;
888 struct request *c = tp->tp_arg;
889 struct transport *t = c->t;
890 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
892 <div id="blame_title_wrapper">
893 <div id="blame_title">Blame</div>
895 <div id="blame_content">
896 <div id="blame_header_wrapper">
897 <div id="blame_header">
898 <div class="header_age_title">Date:</div>
899 <div class="header_age">
900 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
902 <div id="header_commit_msg_title">Message:</div>
903 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
906 <div class="dotted_line"></div>
910 err = got_output_file_blame(c, &blame_line);
912 log_warnx("%s: got_output_file_blame: %s", __func__,
921 {{ define blame_line(struct template *tp, const char *line,
922 struct blame_line *bline, int lprec, int lcur) }}
924 struct request *c = tp->tp_arg;
925 struct transport *t = c->t;
926 struct repo_dir *repo_dir = t->repo_dir;
928 struct gotweb_url url = {
932 .path = repo_dir->name,
933 .commit = bline->id_str,
936 s = strchr(bline->committer, '<');
937 committer = s ? s + 1 : bline->committer;
939 s = strchr(committer, '@');
943 <div class="blame_wrapper">
944 <div class="blame_number">{{ printf "%.*d", lprec, lcur }}</div>
945 <div class="blame_hash">
946 <a href="{{ render gotweb_render_url(c, &url) }}">
947 {{ printf "%.8s", bline->id_str }}
950 <div class="blame_date">{{ bline->datebuf }}</div>
951 <div class="blame_author">{{ printf "%.9s", committer }}</div>
952 <div class="blame_code">{{ line }}</div>
956 {{ define gotweb_render_rss(struct template *tp) }}
958 struct request *c = tp->tp_arg;
959 struct server *srv = c->srv;
960 struct transport *t = c->t;
961 struct repo_dir *repo_dir = t->repo_dir;
963 struct gotweb_url summary = {
967 .path = repo_dir->name,
970 <?xml version="1.0" encoding="UTF-8"?>
971 <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
973 <title>Tags of {{ repo_dir->name }}</title>
976 {{ render gotweb_render_absolute_url(c, &summary) }}
979 {{ if srv->show_repo_description }}
980 <description>{{ repo_dir->description }}</description>
982 {{ tailq-foreach rt &t->repo_tags entry }}
983 {{ render rss_tag_item(tp, rt) }}
989 {{ define rss_tag_item(struct template *tp, struct repo_tag *rt) }}
991 struct request *c = tp->tp_arg;
992 struct transport *t = c->t;
993 struct repo_dir *repo_dir = t->repo_dir;
994 char *tag_name = rt->tag_name;
995 struct gotweb_url tag = {
999 .path = repo_dir->name,
1000 .commit = rt->commit_id,
1003 if (strncmp(tag_name, "refs/tags/", 10) == 0)
1007 <title>{{ repo_dir->name }} {{" "}} {{ tag_name }}</title>
1010 {{ render gotweb_render_absolute_url(c, &tag) }}
1014 <![CDATA[<pre>{{ rt->tag_commit }}</pre>]]>
1016 {{ render rss_author(tp, rt->tagger) }}
1017 <guid isPermaLink="false">{{ rt->commit_id }}</guid>
1019 {{ render gotweb_render_age(tp, rt->tagger_time, TM_RFC822) }}
1024 {{ define rss_author(struct template *tp, char *author) }}
1028 /* what to do if the author name contains a paren? */
1029 if (strchr(author, '(') != NULL || strchr(author, ')') != NULL)
1032 t = strchr(author, '<');
1038 while (isspace((unsigned char)*--t))
1041 t = strchr(mail, '>');
1047 {{ mail }} {{" "}} ({{ author }})