-
Notifications
You must be signed in to change notification settings - Fork 8
/
views.go
43 lines (38 loc) · 978 Bytes
/
views.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2013, Chandra Sekar S. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the README.md file.
package main
import "html/template"
var (
indexTmpl = template.Must(template.New("index").Parse(indexView))
pkgTmpl = template.Must(template.New("pkg").Parse(pkgView))
)
const indexView = `
<html>
<head>
<title>gorepos - Packages</title>
</head>
<body>
<h1>Available Packages</h1>
<ul>
{{$host := .host}}
{{range .pkgs}}
<li><a href="{{.Path}}">{{$host}}{{.Path}}</a></li>
{{end}}
</ul>
</body>
</html>
`
const pkgView = `
<html>
<head>
<meta name="go-import" content="{{.host}}{{.pkg.Path}} {{.pkg.Vcs}} {{.pkg.Repo}}">
<title>gorepos - go.tuxychandru.com:9090/goaes</title>
</head>
<body>
<h1>{{.host}}{{.pkg.Path}}</h1>
<span style="font-weight: bold">VCS:</span> {{.pkg.Vcs}}<br>
<span style="font-weight: bold">Repo-Root:</span> {{.pkg.Repo}}
</body>
</html>
`