X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=list.go;h=f38eab35f83b2f1d8bfde9a995ba1aa313a70bce;hb=d60620f2889f65356a5b1be2dc44eed6ed3599de;hp=9c4c2912cb65e0d133df894441fa7145087e8b09;hpb=371b9da450b741c6dc50cf5427fcbdec4335d0fc;p=gocheese.git diff --git a/list.go b/list.go index 9c4c291..f38eab3 100644 --- a/list.go +++ b/list.go @@ -19,6 +19,7 @@ package main import ( "bytes" + _ "embed" "encoding/hex" "errors" "fmt" @@ -37,33 +38,14 @@ import ( // https://warehouse.pypa.io/api-reference/legacy.html var ( - HTMLRootTmpl = template.Must(template.New("root").Parse(` - - - - Simple index - - {{$Refresh := .RefreshURLPath}}{{range .Packages}} - {{.}}
-{{- end}} - - -`)) - HTMLReleasesTmpl = template.Must(template.New("list").Parse(` - - - - Links for {{.PkgName}} - - {{$Refresh := .RefreshURLPath}}{{$PkgName := .PkgName}}{{range .Releases}} - {{.Filename}}
-{{- end}} - - -`)) - KnownExts = []string{".tar.bz2", ".tar.gz", ".whl", ".zip", ".egg", + //go:embed root.tmpl + HTMLRootTmplRaw string + HTMLRootTmpl = template.Must(template.New("root").Parse(HTMLRootTmplRaw)) + + //go:embed list.tmpl + HTMLReleasesTmplRaw string + HTMLReleasesTmpl = template.Must(template.New("list").Parse(HTMLReleasesTmplRaw)) + KnownExts = []string{".tar.bz2", ".tar.gz", ".whl", ".zip", ".egg", ".exe", ".dmg", ".msi", ".rpm", ".deb", ".tgz"} )