forked from Ivasoft/opds-proxy
init
This commit is contained in:
11
html/feed.html
Normal file
11
html/feed.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{define "content"}}
|
||||
{{range .Feed.Links}}
|
||||
{{template "link" .}}
|
||||
<a href="{{.Href}}">{{.Title}}</a>
|
||||
{{end}}
|
||||
|
||||
{{range .Feed.Entries}}
|
||||
{{$link := index .Links 0}}
|
||||
<a href="{{$link.Href}}">{{.Title}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
27
html/html.go
Normal file
27
html/html.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package html
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
"github.com/opds-community/libopds2-go/opds1"
|
||||
)
|
||||
|
||||
var (
|
||||
feed = parse("feed.html")
|
||||
)
|
||||
|
||||
func parse(file string) *template.Template {
|
||||
return template.Must(template.New("layout.html").ParseFiles("html/layout.html", "html/" + file))
|
||||
}
|
||||
|
||||
type FeedParams struct {
|
||||
Feed *opds1.Feed
|
||||
}
|
||||
|
||||
func Feed(w io.Writer, p FeedParams, partial string) error {
|
||||
if (partial == "" ) {
|
||||
partial = "layout.html"
|
||||
}
|
||||
|
||||
return feed.ExecuteTemplate(w, partial, p)
|
||||
}
|
||||
11
html/layout.html
Normal file
11
html/layout.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{block "title" .}}Kobo OPDS Proxy{{end}}</title>
|
||||
<link rel="stylesheet" href="./static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
{{block "content" .}}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user