factored the single object types out into their own sources
[webgit] / src / object.c
1 /*
2     cehtehs git web frontend
3
4   Copyright (C)
5     2007, 2008          Christian Thaeter <ct@pipapo.org>
6
7   This program is free software; you can redistribute it and/or
8   modify it under the terms of the GNU General Public License as
9   published by the Free Software Foundation; either version 2 of the
10   License, or (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software
19   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "object.h"
23
24 Html
25 webgit_object_link (struct webgit_query* query,
26                     const char* repo,
27                     int repo_len,
28                     const char* object,
29                     int object_len,
30                     const char* path,
31                     const char* action,
32                     Html text)
33 {
34   return html (
35                html_tag ("a",
36                          html_attr ("href", html (
37                                                   html_fmt ("%s?repo=%.*s&object=%.*s",
38                                                             query->request->script_name,
39                                                             repo_len, repo,
40                                                             object_len, object),
41                                                   path ? html_fmt ("&path=%s", path) : html (),
42                                                   action ? html_fmt ("&action=%s", action) : html ()
43                                                   )
44                                     )
45                          ),
46                text
47                );
48 }