aboutsummaryrefslogtreecommitdiffstats
path: root/exporter
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-06-12 16:59:04 -0700
committerAdam Mathes <adam@trenchant.org>2018-06-12 16:59:04 -0700
commitf06192a98a2f8e8dae3148cda59b6b57968160ae (patch)
tree86ced9e042563f9a218819b4099fb05b3b5de119 /exporter
parentc2e10f09732ff96a7b185aa4e0a8896750d5c32d (diff)
downloadneko-f06192a98a2f8e8dae3148cda59b6b57968160ae.tar.gz
neko-f06192a98a2f8e8dae3148cda59b6b57968160ae.tar.bz2
neko-f06192a98a2f8e8dae3148cda59b6b57968160ae.zip
remove runtime static file dependencies, use rice boxes
Diffstat (limited to 'exporter')
-rw-r--r--exporter/exporter.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/exporter/exporter.go b/exporter/exporter.go
index 8e7ff12..04ced0b 100644
--- a/exporter/exporter.go
+++ b/exporter/exporter.go
@@ -1,14 +1,12 @@
package exporter
import (
- "adammathes.com/neko/config"
"adammathes.com/neko/models/feed"
"encoding/json"
"encoding/xml"
"fmt"
"html/template"
"os"
- "path"
)
func ExportFeeds(format string) {
@@ -37,9 +35,21 @@ func ExportFeeds(format string) {
fmt.Printf("%s\n", js)
case "html":
- tmplFile := path.Join(config.Config.StaticDir, "feeds.tmpl")
- feedsTmpl := template.Must(template.ParseFiles(tmplFile))
- err := feedsTmpl.Execute(os.Stdout, feeds)
+ htmlTemplateString := `<html>
+<head>
+<title>neko exported feeds</title>
+</head>
+<body>
+<h1>neko exported feeds</h1>
+<ul>
+{{ range . }}
+<li><a href="{{.WebUrl}}">{{.Title}}</a> | <a href="{{.Url}}">xml</a></li>
+{{ end }}
+</ul>
+</body>
+</html>`
+ htmlTemplate, err := template.New("feeds").Parse(htmlTemplateString)
+ err = htmlTemplate.Execute(os.Stdout, feeds)
if err != nil {
panic(err)
}