author | Lars Hjemli <hjemli@gmail.com> | 2007-07-22 23:42:49 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-07-22 23:42:49 (UTC) |
commit | 43291e418ab6c736168effc017f9548bacb84e5e (patch) (unidiff) | |
tree | f6b4e4139d02f3c24e390eaabef5d2ae21fe5829 | |
parent | f405d0bf75427c627778027e9900359335d6774e (diff) | |
download | cgit-43291e418ab6c736168effc017f9548bacb84e5e.zip cgit-43291e418ab6c736168effc017f9548bacb84e5e.tar.gz cgit-43291e418ab6c736168effc017f9548bacb84e5e.tar.bz2 |
Make ui-tag.c generate valid xhtml
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-tag.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1,74 +1,74 @@ | |||
1 | /* ui-tag.c: display a tag | 1 | /* ui-tag.c: display a tag |
2 | * | 2 | * |
3 | * Copyright (C) 2007 Lars Hjemli | 3 | * Copyright (C) 2007 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | 11 | ||
12 | static void print_tag_content(char *buf) | 12 | static void print_tag_content(char *buf) |
13 | { | 13 | { |
14 | char *p; | 14 | char *p; |
15 | 15 | ||
16 | if (!buf) | 16 | if (!buf) |
17 | return; | 17 | return; |
18 | 18 | ||
19 | html("<div class='commit-subject'>"); | 19 | html("<div class='commit-subject'>"); |
20 | p = strchr(buf, '\n'); | 20 | p = strchr(buf, '\n'); |
21 | if (p) | 21 | if (p) |
22 | *p = '\0'; | 22 | *p = '\0'; |
23 | html_txt(buf); | 23 | html_txt(buf); |
24 | html("</div>"); | 24 | html("</div>"); |
25 | if (p) { | 25 | if (p) { |
26 | html("<div class='commit-msg'>"); | 26 | html("<div class='commit-msg'>"); |
27 | html_txt(++p); | 27 | html_txt(++p); |
28 | html("</div>"); | 28 | html("</div>"); |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | void cgit_print_tag(char *revname) | 32 | void cgit_print_tag(char *revname) |
33 | { | 33 | { |
34 | unsigned char sha1[20]; | 34 | unsigned char sha1[20]; |
35 | struct object *obj; | 35 | struct object *obj; |
36 | struct tag *tag; | 36 | struct tag *tag; |
37 | struct taginfo *info; | 37 | struct taginfo *info; |
38 | 38 | ||
39 | if (get_sha1(revname, sha1)) { | 39 | if (get_sha1(revname, sha1)) { |
40 | cgit_print_error(fmt("Bad tag reference: %s", revname)); | 40 | cgit_print_error(fmt("Bad tag reference: %s", revname)); |
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | obj = parse_object(sha1); | 43 | obj = parse_object(sha1); |
44 | if (!obj) { | 44 | if (!obj) { |
45 | cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1))); | 45 | cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1))); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | if (obj->type == OBJ_TAG) { | 48 | if (obj->type == OBJ_TAG) { |
49 | tag = lookup_tag(sha1); | 49 | tag = lookup_tag(sha1); |
50 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { | 50 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { |
51 | cgit_print_error(fmt("Bad tag object: %s", revname)); | 51 | cgit_print_error(fmt("Bad tag object: %s", revname)); |
52 | return; | 52 | return; |
53 | } | 53 | } |
54 | html("<table class='commit-info'>\n"); | 54 | html("<table class='commit-info'>\n"); |
55 | htmlf("<tr><td>Tag name</td><td>%s (%s)</td></tr>\n", | 55 | htmlf("<tr><td>Tag name</td><td>%s (%s)</td></tr>\n", |
56 | revname, sha1_to_hex(sha1)); | 56 | revname, sha1_to_hex(sha1)); |
57 | if (info->tagger_date > 0) { | 57 | if (info->tagger_date > 0) { |
58 | html("<tr><td>Tag date</td><td>"); | 58 | html("<tr><td>Tag date</td><td>"); |
59 | cgit_print_date(info->tagger_date, FMT_LONGDATE); | 59 | cgit_print_date(info->tagger_date, FMT_LONGDATE); |
60 | html("</td><tr>\n"); | 60 | html("</td></tr>\n"); |
61 | } | 61 | } |
62 | if (info->tagger) { | 62 | if (info->tagger) { |
63 | html("<tr><td>Tagged by</td><td>"); | 63 | html("<tr><td>Tagged by</td><td>"); |
64 | html_txt(info->tagger); | 64 | html_txt(info->tagger); |
65 | html("</td></tr>\n"); | 65 | html("</td></tr>\n"); |
66 | } | 66 | } |
67 | html("<tr><td>Tagged object</td><td>"); | 67 | html("<tr><td>Tagged object</td><td>"); |
68 | cgit_object_link(tag->tagged); | 68 | cgit_object_link(tag->tagged); |
69 | html("</td></tr>\n"); | 69 | html("</td></tr>\n"); |
70 | html("</table>\n"); | 70 | html("</table>\n"); |
71 | print_tag_content(info->msg); | 71 | print_tag_content(info->msg); |
72 | } | 72 | } |
73 | return; | 73 | return; |
74 | } | 74 | } |