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 struct request *c = tp->tp_arg;
246 struct transport *t = c->t;
247 struct querystring *qs = c->t->qs;
248 struct repo_commit *rc;
249 struct repo_dir *repo_dir = t->repo_dir;
250 struct gotweb_url diff_url, tree_url;
253 diff_url = (struct gotweb_url){
257 .path = repo_dir->name,
258 .headref = qs->headref,
260 tree_url = (struct gotweb_url){
264 .path = repo_dir->name,
265 .headref = qs->headref,
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) }}
437 struct request *c = tp->tp_arg;
438 struct transport *t = c->t;
439 struct got_blob_object *blob = t->blob;
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) }}
715 struct request *c = tp->tp_arg;
716 struct transport *t = c->t;
718 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
723 <div id="diff_title_wrapper">
724 <div id="diff_title">Commit Diff</div>
726 <div id="diff_content">
727 <div id="diff_header_wrapper">
728 <div id="diff_header">
729 <div class="header_commit_title">Commit:</div>
730 <div class="header_commit">{{ rc->commit_id }}</div>
731 <div class="header_author_title">From:</div>
732 <div class="header_author">{{ rc->author }}</div>
733 {{ if strcmp(rc->committer, rc->author) != 0 }}
734 <div class="header_author_title">Via:</div>
735 <div class="header_author">{{ rc->committer }}</div>
737 <div class="header_age_title">Date:</div>
738 <div class="header_age">
739 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
741 <div id="header_commit_msg_title">Message:</div>
742 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
745 <div class="dotted_line"></div>
748 {{ while (linelen = getline(&line, &linesize, fp)) != -1 }}
749 {{ render diff_line(tp, line) }}
757 {{ define diff_line(struct template *tp, char *line )}}
759 const char *color = NULL;
762 if (!strncmp(line, "-", 1))
763 color = "diff_minus";
764 else if (!strncmp(line, "+", 1))
766 else if (!strncmp(line, "@@", 2))
767 color = "diff_chunk_header";
768 else if (!strncmp(line, "commit +", 8) ||
769 !strncmp(line, "commit -", 8) ||
770 !strncmp(line, "blob +", 6) ||
771 !strncmp(line, "blob -", 6) ||
772 !strncmp(line, "file +", 6) ||
773 !strncmp(line, "file -", 6))
775 else if (!strncmp(line, "from:", 5) || !strncmp(line, "via:", 4))
776 color = "diff_author";
777 else if (!strncmp(line, "date:", 5))
780 nl = strchr(line, '\n');
784 <div class="diff_line {{ color }}">{{ line }}</div>
787 {{ define gotweb_render_branches(struct template *tp,
788 struct got_reflist_head *refs) }}
790 struct got_reflist_entry *re;
792 <div id="branches_title_wrapper">
793 <div id="branches_title">Branches</div>
795 <div id="branches_content">
796 {{ tailq-foreach re refs entry }}
797 {{ if !got_ref_is_symbolic(re->ref) }}
798 {{ render branch(tp, re) }}
804 {{ define branch(struct template *tp, struct got_reflist_entry *re) }}
806 const struct got_error *err;
807 struct request *c = tp->tp_arg;
808 struct querystring *qs = c->t->qs;
811 struct gotweb_url url = {
818 refname = got_ref_get_name(re->ref);
820 err = got_get_repo_age(&age, c, refname);
822 log_warnx("%s: %s", __func__, err->msg);
826 if (strncmp(refname, "refs/heads/", 11) == 0)
829 url.headref = refname;
831 <div class="branches_wrapper">
832 <div class="branches_age">
833 {{ render gotweb_render_age(tp, age, TM_DIFF) }}
835 <div class="branches_space"> </div>
837 <a href="{{ render gotweb_render_url(c, &url) }}">{{ refname }}</a>
839 <div class="navs_wrapper">
841 <a href="{{ render gotweb_render_url(c, &url) }}">summary</a>
843 {! url.action = BRIEFS; !}
844 <a href="{{ render gotweb_render_url(c, &url) }}">commit briefs</a>
846 {! url.action = COMMITS; !}
847 <a href="{{ render gotweb_render_url(c, &url) }}">commits</a>
850 <div class="dotted_line"></div>
854 {{ define gotweb_render_summary(struct template *tp) }}
856 struct request *c = tp->tp_arg;
857 struct server *srv = c->srv;
858 struct transport *t = c->t;
859 struct got_reflist_head *refs = &t->refs;
861 <div id="summary_wrapper">
862 {{ if srv->show_repo_description }}
863 <div id="description_title">Description:</div>
864 <div id="description">{{ t->repo_dir->description }}</div>
866 {{ if srv->show_repo_owner }}
867 <div id="repo_owner_title">Owner:</div>
868 <div id="repo_owner">{{ t->repo_dir->owner }}</div>
870 {{ if srv->show_repo_age }}
871 <div id="last_change_title">Last Change:</div>
872 <div id="last_change">
873 {{ render gotweb_render_age(tp, t->repo_dir->age, TM_DIFF) }}
876 {{ if srv->show_repo_cloneurl }}
877 <div id="cloneurl_title">Clone URL:</div>
878 <div id="cloneurl">{{ t->repo_dir->url }}</div>
881 {{ render gotweb_render_briefs(tp) }}
882 {{ render gotweb_render_tags(tp) }}
883 {{ render gotweb_render_branches(tp, refs) }}
886 {{ define gotweb_render_blame(struct template *tp) }}
888 const struct got_error *err;
889 struct request *c = tp->tp_arg;
890 struct transport *t = c->t;
891 struct repo_commit *rc = TAILQ_FIRST(&t->repo_commits);
893 <div id="blame_title_wrapper">
894 <div id="blame_title">Blame</div>
896 <div id="blame_content">
897 <div id="blame_header_wrapper">
898 <div id="blame_header">
899 <div class="header_age_title">Date:</div>
900 <div class="header_age">
901 {{ render gotweb_render_age(tp, rc->committer_time, TM_LONG) }}
903 <div id="header_commit_msg_title">Message:</div>
904 <div id="header_commit_msg">{{ rc->commit_msg }}</div>
907 <div class="dotted_line"></div>
911 err = got_output_file_blame(c, &blame_line);
912 if (err && err->code != GOT_ERR_CANCELLED)
913 log_warnx("%s: got_output_file_blame: %s", __func__,
922 {{ define blame_line(struct template *tp, const char *line,
923 struct blame_line *bline, int lprec, int lcur) }}
925 struct request *c = tp->tp_arg;
926 struct transport *t = c->t;
927 struct repo_dir *repo_dir = t->repo_dir;
929 struct gotweb_url url = {
933 .path = repo_dir->name,
934 .commit = bline->id_str,
937 s = strchr(bline->committer, '<');
938 committer = s ? s + 1 : bline->committer;
940 s = strchr(committer, '@');
944 <div class="blame_wrapper">
945 <div class="blame_number">{{ printf "%.*d", lprec, lcur }}</div>
946 <div class="blame_hash">
947 <a href="{{ render gotweb_render_url(c, &url) }}">
948 {{ printf "%.8s", bline->id_str }}
951 <div class="blame_date">{{ bline->datebuf }}</div>
952 <div class="blame_author">{{ printf "%.9s", committer }}</div>
953 <div class="blame_code">{{ line }}</div>
957 {{ define gotweb_render_rss(struct template *tp) }}
959 struct request *c = tp->tp_arg;
960 struct server *srv = c->srv;
961 struct transport *t = c->t;
962 struct repo_dir *repo_dir = t->repo_dir;
964 struct gotweb_url summary = {
968 .path = repo_dir->name,
971 <?xml version="1.0" encoding="UTF-8"?>
972 <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
974 <title>Tags of {{ repo_dir->name }}</title>
977 {{ render gotweb_render_absolute_url(c, &summary) }}
980 {{ if srv->show_repo_description }}
981 <description>{{ repo_dir->description }}</description>
983 {{ tailq-foreach rt &t->repo_tags entry }}
984 {{ render rss_tag_item(tp, rt) }}
990 {{ define rss_tag_item(struct template *tp, struct repo_tag *rt) }}
992 struct request *c = tp->tp_arg;
993 struct transport *t = c->t;
994 struct repo_dir *repo_dir = t->repo_dir;
995 char *tag_name = rt->tag_name;
996 struct gotweb_url tag = {
1000 .path = repo_dir->name,
1001 .commit = rt->commit_id,
1004 if (strncmp(tag_name, "refs/tags/", 10) == 0)
1008 <title>{{ repo_dir->name }} {{" "}} {{ tag_name }}</title>
1011 {{ render gotweb_render_absolute_url(c, &tag) }}
1015 <![CDATA[<pre>{{ rt->tag_commit }}</pre>]]>
1017 {{ render rss_author(tp, rt->tagger) }}
1018 <guid isPermaLink="false">{{ rt->commit_id }}</guid>
1020 {{ render gotweb_render_age(tp, rt->tagger_time, TM_RFC822) }}
1025 {{ define rss_author(struct template *tp, char *author) }}
1029 /* what to do if the author name contains a paren? */
1030 if (strchr(author, '(') != NULL || strchr(author, ')') != NULL)
1033 t = strchr(author, '<');
1039 while (isspace((unsigned char)*--t))
1042 t = strchr(mail, '>');
1048 {{ mail }} {{" "}} ({{ author }})