summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-01-11 12:36:56 +0000
committerKatolaZ <katolaz@freaknet.org>2018-01-11 12:36:56 +0000
commit4d5afdc2a6dfbb985fe9030cad7b0b8c3fc74819 (patch)
tree092312cb61007bcc31d9aa36b3619fedec2a421f
parent74218fbc7aabf1efe3cacc801bb55e6ae87eaa08 (diff)
split template in a separate file
-rw-r--r--d1pkgweb.go102
-rw-r--r--template.go101
2 files changed, 102 insertions, 101 deletions
diff --git a/d1pkgweb.go b/d1pkgweb.go
index 6aba272..89fa764 100644
--- a/d1pkgweb.go
+++ b/d1pkgweb.go
@@ -8,106 +8,6 @@ import (
"strings"
)
-var templ = `<html>
-<body>
-<title>{{.Name}}-{{.Version}}</title>
-<style type="text/css">
-body {
- margin-top: 10px;
- line-height:1.6;
- font-size:20px;
-}
-
-div.pkgname{
- font-size: 150%;
- margin-top: 40px;
- margin-left: 40px;
-}
-
-div.pkg_suite{
- font-size: 110%;
- margin-top: 15px;
- margin-left: 40px;
- margin-bottom: 60px;
-}
-
-div.description{
- font-size: 100%;
- margin-left: 20px;
- margin-top: 20px;
- margin-bottom: 20px;
- border-bottom: 2px solid #aaaaaa;
-}
-
-div.long_description{
- font-size: 100%;
- width: 600px;
- margin-left: 40px;
-}
-
-div.dep_list{
- margin-top:20px;
- margin-left: 20px;
-
-}
-
-li.dep_item{
- margin-left: 35px;
-}
-
-div.rec_list {
- margin-top:20px;
- margin-left: 20px;
-}
-
-li.rec_item{
- margin-left: 35px;
-}
-
-div.provides{
- margin-bottom: 35px;
- margin-left: 20px;
-}
-
-
-</style>
-<div class="pkgname">{{.Name}} {{.Version}} [{{.Section}} - {{.Priority}}]</div>
-<div class="pkg_suite">[{{.Suite}} - {{.Component}}]</div>
-<div class="description">
-{{.Description}}
-</div>
-<div class="long_description">
-{{.LongDescription}}
-</div>
-
-<hr>
-
-<div class="provides">
-{{range .Provides}}<div class="prov_item">Provides: {{.}}</div>{{end}}
-</div>
-
-<div class="dep_list">
-Depends:
-<ul>
-{{range .Depends}}<li class="dep_item">{{ . }}</li>{{end}}
-</ul>
-</div>
-
-<div class="rec_list">
-Recommends:
-<ul>
-{{range .Recommends}}<li class="rec_item">{{ . }}</li>{{end}}
-</ul>
-</div>
-
-
-<div class="maintainer">
-Maintainer: {{.Maintainer}}
-</div>
-</body>
-</html>
-`
-
func main() {
args := os.Args
@@ -135,7 +35,7 @@ func main() {
if r != nil {
for s, err := deb822.ScanStanza(r); s["Package"] != ""; s, err = deb822.ScanStanza(r) {
if err == nil {
- deb822.Stanza2HtmlPage(s, templ, ".", suite, component)
+ deb822.Stanza2HtmlPage(s, pkgTempl, ".", suite, component)
} else {
fmt.Printf("error: %s\n", err)
}
diff --git a/template.go b/template.go
new file mode 100644
index 0000000..97d8e5d
--- /dev/null
+++ b/template.go
@@ -0,0 +1,101 @@
+package main
+
+var pkgTempl = `<html>
+<body>
+<title>{{.Name}}-{{.Version}}</title>
+<style type="text/css">
+body {
+ margin-top: 10px;
+ line-height:1.6;
+ font-size:20px;
+}
+
+div.pkgname{
+ font-size: 150%;
+ margin-top: 40px;
+ margin-left: 40px;
+}
+
+div.pkg_suite{
+ font-size: 110%;
+ margin-top: 15px;
+ margin-left: 40px;
+ margin-bottom: 60px;
+}
+
+div.description{
+ font-size: 100%;
+ margin-left: 20px;
+ margin-top: 20px;
+ margin-bottom: 20px;
+ border-bottom: 2px solid #aaaaaa;
+}
+
+div.long_description{
+ font-size: 100%;
+ width: 600px;
+ margin-left: 40px;
+}
+
+div.dep_list{
+ margin-top:20px;
+ margin-left: 20px;
+
+}
+
+li.dep_item{
+ margin-left: 35px;
+}
+
+div.rec_list {
+ margin-top:20px;
+ margin-left: 20px;
+}
+
+li.rec_item{
+ margin-left: 35px;
+}
+
+div.provides{
+ margin-bottom: 35px;
+ margin-left: 20px;
+}
+
+
+</style>
+<div class="pkgname">{{.Name}} {{.Version}} [{{.Section}} - {{.Priority}}]</div>
+<div class="pkg_suite">[{{.Suite}} - {{.Component}}]</div>
+<div class="description">
+{{.Description}}
+</div>
+<div class="long_description">
+{{.LongDescription}}
+</div>
+
+<hr>
+
+<div class="provides">
+{{range .Provides}}<div class="prov_item">Provides: {{.}}</div>{{end}}
+</div>
+
+<div class="dep_list">
+Depends:
+<ul>
+{{range .Depends}}<li class="dep_item">{{ . }}</li>{{end}}
+</ul>
+</div>
+
+<div class="rec_list">
+Recommends:
+<ul>
+{{range .Recommends}}<li class="rec_item">{{ . }}</li>{{end}}
+</ul>
+</div>
+
+
+<div class="maintainer">
+Maintainer: {{.Maintainer}}
+</div>
+</body>
+</html>
+`