diff --git a/client.go b/client.go index e0671d0..958ef98 100644 --- a/client.go +++ b/client.go @@ -38,11 +38,13 @@ func (ch *CaddyHugo) newEditSession(docName string) (*editSession, error) { return nil, err } + tmpfs := afero.NewCopyOnWriteFs(afero.NewOsFs(), afero.NewMemMapFs()) + es := &editSession{ docname: docName, filename: filename, doc: acedoc.NewString(string(contents)), - tmpfs: afero.NewCopyOnWriteFs(afero.NewOsFs(), afero.NewMemMapFs()), + tmpfs: tmpfs, } err = es.doc.LogToFile(path.Join(ch.Dir, "logs", docName)) diff --git a/http.go b/http.go index 96d83aa..2c5d334 100644 --- a/http.go +++ b/http.go @@ -3,6 +3,7 @@ package caddyhugo import ( "encoding/base64" "fmt" + "io" "net" "net/http" "os" @@ -88,6 +89,10 @@ func (ch *CaddyHugo) ServeHTTPWithNext(next httpserver.Handler, w http.ResponseW if strings.HasPrefix(r.URL.Path, "/media/") { return ch.serveMedia(w, r) } + if strings.HasPrefix(r.URL.Path, "/hugo/fs/") { + printTree(afero.NewOsFs(), w, ch.Dir) + return 200, nil + } return next.ServeHTTP(w, r) } @@ -244,6 +249,70 @@ func (ch *CaddyHugo) serveDraft(w http.ResponseWriter, r *http.Request) (int, er return 200, nil } +func printTree(fs afero.Fs, w io.Writer, dir string) { + const ( + Line = " │ " + Tab = " " + Elbow = " └─" + Tee = " ├─" + ) + + wd, _ := os.Getwd() + fmt.Fprintln(w, wd) + + if dir == "" { + dir = "/" + } + + openDirs := map[string]bool{} + lastFiles := map[string]string{} + + afero.Walk(fs, dir, filepath.WalkFunc(func(p string, info os.FileInfo, err error) error { + if strings.HasPrefix(p, "./") { + p = p[2:] + } + + openDirs[filepath.Dir(p)] = true + lastFiles[filepath.Dir(p)] = filepath.Base(p) + return nil + })) + + afero.Walk(fs, dir, filepath.WalkFunc(func(p string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if strings.HasPrefix(p, "./") { + p = p[2:] + } + + if filepath.Base(p)[0] == '.' && info.IsDir() { + return filepath.SkipDir + } + + entry := Tee + + if lastFiles[filepath.Dir(p)] == filepath.Base(p) { + openDirs[filepath.Dir(p)] = false + entry = Elbow + } + + indent := "" + dirs := strings.Split(p, string(filepath.Separator)) + dirs = dirs[:len(dirs)-1] + for i := range dirs { + if openDirs[filepath.Join(dirs[:i]...)] { + indent += Line + } else { + indent += Tab + } + } + + fmt.Fprintf(w, "%s%s %s (%s)\n", indent, entry, filepath.Base(p), p) + return nil + })) +} + type aferoHTTP struct { afero.Fs } diff --git a/hugo.go b/hugo.go index d4e45f5..4d6e491 100644 --- a/hugo.go +++ b/hugo.go @@ -2,13 +2,18 @@ package caddyhugo import ( "fmt" + "os" "path" + "path/filepath" "time" "github.com/gohugoio/hugo/deps" + "github.com/gohugoio/hugo/hugofs" "github.com/gohugoio/hugo/hugolib" "github.com/spf13/afero" + "github.com/spf13/viper" + "git.stephensearles.com/stephen/caddy-hugo2/theme-additions" "git.stephensearles.com/stephen/idleshut" ) @@ -41,9 +46,42 @@ func buildSite(sites *hugolib.HugoSites) error { return err } +func writeThemeFiles(dir string) error { + for _, asset := range themeadditions.AssetNames() { + err := os.MkdirAll(path.Join(dir, filepath.Dir(asset)), 0755) + if err != nil { + return err + } + fmt.Println("writing", path.Join(dir, asset)) + f, err := os.Create(path.Join(dir, asset)) + if err != nil { + return err + } + b, err := themeadditions.Asset(asset) + if err != nil { + return err + } + + _, err = f.Write(b) + if err != nil { + return err + } + + err = f.Close() + if err != nil { + return err + } + } + + return nil +} + func (ch *CaddyHugo) configWithFs(fs afero.Fs) (*hugolib.HugoSites, *deps.DepsCfg, error) { var err error - cfg := &deps.DepsCfg{} + + hfs := hugofs.NewFrom(fs, &viper.Viper{}) + cfg := &deps.DepsCfg{Fs: hfs} + cfgPath := path.Join(ch.Dir, "config.toml") cfg.Cfg, err = hugolib.LoadConfig(fs, "", cfgPath) if err != nil { @@ -90,7 +128,7 @@ func HugoInternalProcessConfig(ch *CaddyHugo, es *editSession, touchFn func()) ( return err } - err = hugoSites.Build(hugolib.BuildCfg{ResetState: true}) + err = buildSite(hugoSites) if err != nil { return err } diff --git a/setup.go b/setup.go index b65588e..7b5a8ef 100644 --- a/setup.go +++ b/setup.go @@ -5,6 +5,7 @@ import ( "html/template" "os" "path" + "path/filepath" "git.stephensearles.com/stephen/caddy-hugo2/comments" "git.stephensearles.com/stephen/caddy-hugo2/media" @@ -20,7 +21,11 @@ func SetupCaddy(c *caddy.Controller) error { ch := &CaddyHugo{} ch.Site = httpserver.GetConfig(c) - err := ch.Setup(ch.Site.Root) + root, err := filepath.Abs(ch.Site.Root) + if err != nil { + return err + } + err = ch.Setup(root) c.OnShutdown(func() error { return ch.persistAllEdits() @@ -89,6 +94,11 @@ func (ch *CaddyHugo) Setup(dir string) error { return fmt.Errorf("couldn't initialize media: %v", err) } + err = writeThemeFiles(ch.Dir) + if err != nil { + fmt.Println("error installing theme files:", err) + } + err = ch.Publish() if err != nil { fmt.Println("error with initial publish of hugo site:", err) diff --git a/theme-additions/assets.go b/theme-additions/assets.go new file mode 100644 index 0000000..5d96ae8 --- /dev/null +++ b/theme-additions/assets.go @@ -0,0 +1,3 @@ +//go:generate go-bindata -ignore .go -pkg themeadditions ./... + +package themeadditions diff --git a/theme-additions/bindata.go b/theme-additions/bindata.go new file mode 100644 index 0000000..a3c1a0e --- /dev/null +++ b/theme-additions/bindata.go @@ -0,0 +1,337 @@ +// Code generated by go-bindata. +// sources: +// archetypes/gallery.md +// layouts/gallery/single.html +// layouts/partials/gallery.html +// layouts/shortcodes/comments.html +// layouts/shortcodes/thumb.html +// DO NOT EDIT! + +package themeadditions + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _archetypesGalleryMd = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xce\xb1\x0a\xc2\x30\x14\x85\xe1\xfd\x3c\xc5\xe1\xae\x01\x1b\x70\xce\x2c\x0e\x3e\x41\xe9\x70\xb1\xd7\x18\x88\xa6\xa4\xd7\xc1\xb7\x97\x3a\x08\x42\xe7\xf3\xc1\xf9\x43\x08\xf0\xe2\xd5\x98\x28\x02\xd7\xbc\x32\x71\x04\x29\x59\x6b\xb5\xfe\x16\x4c\xb8\xaa\x5b\x6e\xbd\xd8\xde\x38\x77\xbd\x39\x13\xbd\xbf\x0c\x18\x97\x7b\xf3\xb6\x4e\x90\xe1\x61\x73\xd1\xe1\x7c\x39\xc5\x18\x0f\xcb\x33\xcb\xf6\xa1\xcc\xdd\xd4\xf9\x65\xf2\xaf\x8e\x3f\x25\xc0\x56\x86\x4f\x00\x00\x00\xff\xff\x44\xfe\x2f\x04\x9f\x00\x00\x00") + +func archetypesGalleryMdBytes() ([]byte, error) { + return bindataRead( + _archetypesGalleryMd, + "archetypes/gallery.md", + ) +} + +func archetypesGalleryMd() (*asset, error) { + bytes, err := archetypesGalleryMdBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "archetypes/gallery.md", size: 159, mode: os.FileMode(420), modTime: time.Unix(1504974306, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _layoutsGallerySingleHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\x41\x4e\x03\x31\x0c\x45\xf7\x39\x85\x95\x15\x6c\x92\x0b\xa4\x73\x06\xa4\x1e\x00\x99\x89\xcb\x58\x4a\xec\x92\xb8\x95\xaa\xaa\x77\x47\x85\x50\x0d\x83\xd8\x26\xff\x3d\xeb\xff\xeb\x15\x8e\xd8\x8c\xb1\x80\x5f\x08\x73\x58\xac\x16\x0f\x01\x6e\x37\xe7\xd2\x9b\xe6\xcb\xe4\x52\xe6\x33\x70\xde\xf9\x59\xc5\x90\x85\x9a\x9f\x1c\x00\xc0\x16\xa6\xb6\xc6\xef\x89\xd4\x69\x36\x56\xf9\xc2\x2b\xb2\x78\x98\x0b\xf6\xbe\xf3\x7a\xb2\x87\x67\xeb\x7a\xc7\x52\xa8\x5d\xb6\xb2\x11\xe3\x03\xa0\x64\x78\x12\x35\x08\x2f\xd8\xb0\xf6\x20\x3a\x6b\xad\x24\xf6\x0c\x61\xcf\x46\x3f\xef\x99\xfb\xc7\xa9\xef\x17\x6d\x26\x58\x69\x6d\x1a\x36\xa3\x7a\x2c\x68\x04\xfe\x95\xc5\xa8\x09\x96\xf8\x4d\xfd\x73\x9e\x24\x3f\xda\xc5\x51\xef\xef\x1c\x07\x55\xfb\x3d\x47\x8a\x99\xcf\x93\x4b\x71\x8c\x1a\xef\x7f\x93\xfb\x0c\x00\x00\xff\xff\xe9\xea\x1f\x1a\x81\x01\x00\x00") + +func layoutsGallerySingleHtmlBytes() ([]byte, error) { + return bindataRead( + _layoutsGallerySingleHtml, + "layouts/gallery/single.html", + ) +} + +func layoutsGallerySingleHtml() (*asset, error) { + bytes, err := layoutsGallerySingleHtmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "layouts/gallery/single.html", size: 385, mode: os.FileMode(420), modTime: time.Unix(1504974306, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _layoutsPartialsGalleryHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x6d\x93\x9b\x38\x12\xfe\x6c\xff\x8a\x2e\x32\x17\x70\x4d\x10\x38\x6f\x77\x65\x1b\x57\x5d\x66\xef\xb2\xa9\xdb\xcb\xe5\x76\x26\xfb\x65\x6b\x6b\x4b\x03\x32\x28\x11\x12\x91\xc4\xcc\x78\x1d\xfe\xfb\x96\x40\xd8\x80\xb1\x27\x1b\xd7\x54\x8d\x68\xb5\x9e\xee\x7e\xd4\xdd\x12\xac\x94\xde\x32\xb2\x9e\x6e\x68\x5a\x4a\x02\xbb\xe9\x44\x93\x07\xed\x63\x46\x53\xbe\x80\x98\x70\x4d\xe4\x72\x3a\xd9\x30\x81\xf5\x02\x18\xd9\xe8\xe5\x74\x92\x63\x99\x52\xbe\x80\xb0\x1e\x3f\xf8\xf7\x34\xd1\xd9\x02\xe6\x61\xf8\xb7\xe5\x74\xa2\x25\xe6\x8a\x6a\x2a\xb8\x5f\x48\x51\x10\xa9\xb7\x0b\xc8\x08\x4d\x33\x0d\x39\xe5\xbe\x1d\xaa\x18\x33\xb2\x84\x9e\x7e\x52\x4a\x6c\x06\x0b\x98\xab\xe5\xb4\x9a\xa2\xda\x6e\xcc\x08\x96\xc6\xb5\x7a\xb0\x80\x5b\xa1\x33\x33\xbb\x0a\xac\xf3\x2b\x2c\x35\x8d\x19\x81\x98\x61\xa5\x22\xa7\x7d\xb4\xff\x7d\xbd\x2d\x88\x5f\x08\xa5\x1d\xa0\x9a\xe4\x2a\x16\x05\xa9\x47\xc6\xbf\xc8\xb9\x65\x22\xfd\x60\x66\xd7\x53\x00\x80\x55\x42\xef\x06\x48\x3e\xe5\x9c\x48\x3b\x6f\x7e\xbb\x1d\xd0\x0d\xa0\x1b\xaa\x19\x81\xaa\xda\xcb\x57\x19\xc1\x09\x91\xc3\xe5\x8d\xb4\xb3\xbe\xd1\x9d\x0f\xf5\xb4\xc1\x73\x3a\xae\x71\x9c\x13\x67\xbd\xdb\x1d\x4c\xad\x82\x6c\x7e\xc0\x59\x05\x0d\x74\xcf\x33\xc2\x93\x9e\x4f\x23\xf1\xe4\x44\xe3\xa1\x3b\x18\x32\x49\x36\x91\x63\xac\xfd\x4c\xd8\x07\x22\x73\xcc\x28\xff\x0c\x55\xe5\x0c\xd7\x27\x58\x93\xc1\xfa\x1a\x43\xd3\x9c\x80\x99\x34\x83\xc8\x35\x50\x3f\x60\x4d\xd0\xbf\x85\xcc\xb1\x06\xe7\x79\x18\xbe\xf6\xc3\xb9\x1f\x3e\xbf\x99\xbf\x5a\x84\x2f\x17\xe1\x2b\x14\x86\xa1\x1f\xfe\x7d\x11\x86\x0e\x54\x95\xdb\x09\xde\xe0\x7c\x28\x6f\x19\x55\x19\x49\x1a\x16\x4e\x80\x39\x35\x31\xc6\xe6\x20\xa6\x00\xf7\x05\xbb\x1d\x5c\x5c\x53\x4d\x60\x11\x01\xaa\x07\x1d\xa2\x3a\x1b\xfb\x01\x4b\x9c\x2b\x14\x63\x4d\x52\x21\x29\x51\x43\xbd\x2e\xa9\x26\xb3\xfc\x83\xea\x18\x2f\x23\x5b\x60\x17\x6c\x47\xd4\xad\x23\x12\xf3\x94\xc0\x05\x7d\x06\x17\x8d\xc3\x8f\x7a\xd5\x8f\x22\xd5\x70\x41\x21\x3c\xa5\xb4\x52\x05\xe6\xeb\xa7\xa9\x5e\xae\x82\x7a\x78\x0a\x6a\x90\x4f\x3d\x0c\x7c\x2a\x2c\xdf\xa4\x8e\x73\x48\xa9\x9a\x76\xf4\x06\x2b\xf2\xf1\xe7\x9f\xa0\xaa\x82\x43\x14\x81\x99\x26\xf0\x15\x4a\xc9\xe8\x1f\x66\x4b\xea\xcd\xbe\x68\xd2\x1d\xff\x55\xbf\x56\x41\x42\xef\x86\x79\x70\x24\x1a\x5f\x6f\xb7\xbf\xf6\xd5\xb2\x9d\x50\xf5\xa5\x54\xd7\x99\x90\xda\x54\xe3\xb9\x44\xd8\x73\x20\xf2\x9c\x70\x5d\x53\xe0\xdf\x4b\x5c\x8c\xa5\xc4\x99\x72\x7b\xd2\xd8\xfc\x5d\x67\x92\xe0\xe4\xa8\xf8\xba\xf0\xce\xfa\xaa\x79\x52\x47\x4c\x7d\x53\xd0\x03\xa5\xb1\x68\x08\xd7\x72\xdb\x6d\x4a\x76\xe2\x8d\x48\x4c\xf2\x4e\xe0\x28\x5b\x7f\xef\x66\x6b\x91\x09\x2d\xea\x4c\x9d\x4c\xcc\xae\xaa\x82\x51\xcd\xcb\xdc\xe8\xd4\x63\x40\xa5\x64\xe0\x04\x0e\x7c\x05\x46\x38\x7c\x05\x9c\x24\xe0\xcf\xf7\x2b\x6a\xda\x17\x11\x50\x9e\x90\x07\xf0\xfa\x8b\x66\x1d\xc4\x76\x05\xdd\x00\x17\x75\xf2\xd7\x12\x13\x97\x3d\xdf\x6c\x68\x34\xc7\xa9\xe9\xb3\x49\xe4\x6c\x4a\xc6\xfc\x66\xd6\x81\xf5\x74\x32\x99\xac\x68\x9e\x82\x92\x71\xe4\x04\x39\x49\x28\x0e\xf6\x3e\x98\x46\x68\xd6\xec\x76\xf5\xb3\x79\xdc\xed\xe0\x9e\xea\x0c\x10\x66\x1a\xaa\x0a\x33\xdd\xec\xa8\xd1\xdd\xb3\x6d\x3a\x22\xf6\x63\x5c\x98\xb3\xcd\xcc\x23\x3b\xae\x2a\x27\x68\x6c\x6e\x68\x6a\x65\xeb\x3d\xa4\x15\x40\x55\x59\xc4\x3d\xe0\x2a\xe8\xe8\xdb\x08\x83\x26\x88\xf6\xb1\xb3\x91\x87\x43\xd4\x59\xdb\xfd\xae\x69\xb2\xa9\x30\xca\x90\xce\xca\xfc\xf6\x14\x21\x0f\xf3\x30\x3c\xcb\x4a\x4b\x43\x97\x9a\x4e\x0c\x4c\x11\x2b\xe8\x85\xd8\xf8\xe3\x34\x6c\x19\xa8\x1e\xe6\x63\x1c\xf6\x39\x38\x5d\xe2\x8f\x30\x33\x28\x17\x74\x25\xb8\x26\x5c\x8f\xd4\xcc\x64\xa5\x62\x49\x0b\xbd\x9e\x4e\x36\x25\x8f\xeb\x38\x52\xa2\xff\xc5\x88\xa9\xc7\x77\x26\x59\x3d\x2e\x12\x32\x83\x5d\x0f\xf5\x0e\x4b\x9b\xca\x91\xb9\x41\x75\xa7\xee\x33\xca\x08\x78\x50\xaf\x83\x08\xcc\x3f\x54\x48\x72\x47\x45\xa9\x2c\xf0\x35\xbd\x65\x94\xa7\x33\x18\xe2\x9a\x5f\x8d\x7b\x79\xd9\x47\xed\xc7\x2f\x89\x2e\x25\x6f\x34\x0f\x7a\x26\x0d\x6a\xc7\x4c\x65\x40\x04\x89\x88\x4b\x63\x0d\x7d\x29\x89\xdc\x5e\x13\x46\x62\x2d\xa4\xe7\x34\x04\xa3\xa6\x80\x66\x68\x43\xa5\x6a\x23\xbe\xca\x28\x4b\x96\xd3\x49\x3d\x87\x0a\x2c\x09\x6f\xa7\x50\x7d\x51\x43\x39\xe5\x3f\x36\x97\xbf\xa8\x31\x84\x54\x2c\x05\x63\x56\x78\x09\x4e\xf1\xe0\x2c\xa7\x2d\x84\xe0\x4c\xe0\x04\x22\xd8\xd3\xeb\x99\x98\x27\xdf\x68\xc1\x75\x97\xd3\x49\x65\xe0\x4e\x05\x83\xfa\x2d\x6e\x86\x04\x8f\x19\x8d\x3f\xf7\x4c\x92\x3b\x6d\xad\x6e\xea\x07\xa4\xb1\x4c\x89\xf9\x97\xbe\x37\xe9\x1f\x45\x11\x38\xef\xfe\xfb\xd6\x81\xa7\x4f\xa1\x33\xdf\x77\xaf\x4e\xb8\x83\x7e\x53\x5e\x0d\xae\x0d\x47\xc9\x18\x22\x70\x9c\x23\x89\x2d\x3a\x07\x2e\xbb\xf0\xa6\x1c\x14\xd1\xc8\x94\xc7\xf2\xb0\x86\x93\x07\xdd\x4f\x14\x54\xdf\x5d\x6f\xc8\x83\xe1\x64\x04\xc0\x96\x91\xc1\xa8\xa6\xe6\x6f\x15\xb4\x79\x3d\xb8\xee\x9a\x9e\xda\x76\x75\x2e\xb4\x88\xbb\x45\xd1\xde\x88\xf1\x2d\x23\xff\xdb\xd8\xaa\x51\x8f\xdd\x43\xb5\x88\x9d\xb1\x43\xf7\x3a\xc7\x52\xdf\xd4\x16\xea\x8d\x8d\x9c\x84\xaa\x82\xe1\xed\x82\x0b\x4e\x96\x87\xd6\x3a\xbc\x52\xbf\x58\xb7\xa6\x57\x41\xf6\xe2\xb8\x9c\xcf\xf9\xd7\x6f\x00\xc7\xdd\xa3\xd3\x32\x07\x51\x9f\x70\xfd\x00\xdd\x30\xda\x34\xd1\x4c\xeb\x42\x2d\x82\x20\x4e\xf8\x27\x85\x62\x26\xca\x64\xc3\xb0\x24\x28\x16\x79\x80\x3f\xe1\x87\x80\xd1\x5b\x15\x7c\xaa\x93\x35\x78\x81\xe6\x68\x6e\x1f\x90\x62\x34\x37\x39\x8e\x3e\x29\x07\x28\xd7\x24\x95\x54\x6f\x23\x47\x65\xf8\xf9\xab\xd7\x7e\x70\xfd\x4e\xbe\xff\x72\xf7\x8f\xec\xf5\xff\xdf\xfe\xe7\x87\xf2\xbd\xf8\xe9\xed\x3f\x5f\x52\x49\xf4\xe5\xe7\x2d\x51\x57\x9f\x7f\x7c\xfb\xc7\x2f\x1f\x3f\xfe\x12\xaa\x2c\x8e\x1c\x88\xa5\x50\x4a\x48\x9a\x52\x1e\x39\x98\x0b\xbe\xcd\x45\xa9\x4c\x23\x6c\xf7\x7f\xe0\x7e\x9f\x4d\xaf\x2d\x11\x6f\xac\x11\x99\x5e\x72\x61\x52\x24\x82\x0b\xcf\x7d\x32\xa0\xdd\x9d\x2d\x8f\x5b\xd7\x06\x3c\xb3\x02\x31\xc2\x53\x9d\xc1\x1a\xc2\x31\xe0\x3d\xf8\x3d\xe5\x89\xb8\xaf\xf1\x9b\xe1\x6c\x39\x1d\xd5\xde\x97\xb2\xe0\xd7\x75\xbb\xf1\x66\xe3\xb0\x2d\x74\x5c\x4a\x53\xba\x8d\xb2\x31\xd0\xe0\xdb\x66\x75\x23\x0a\x6f\xc4\xfd\x2e\x40\xd6\x44\xdd\x6f\x2f\x90\xcd\x9f\xc1\x50\xf4\xfc\x58\xf4\xe2\x58\xf4\xf2\x58\xf4\xea\x58\xf4\x7a\x8c\xd5\xae\x5b\x34\xa9\x1b\xcc\x69\xa5\x0c\x11\x1c\x67\xde\xa1\xf7\xd1\x67\x70\x74\x7c\x0d\x7f\xa4\x0e\x96\x9c\xb1\x0d\x76\x77\x09\x12\x9b\x8d\x22\xda\x9b\x21\x2d\x0a\xf0\x61\x1e\xc2\x2a\xea\xd3\xfd\x98\xb5\x1a\xcb\xc4\x41\x10\xd6\x5a\x7a\x2e\x4d\xce\x85\x0d\x47\xc7\x5f\x6f\xe6\x11\xc2\x70\xac\xe9\x5d\x1d\x9f\xc9\xcb\x0d\xe5\x89\xe7\x62\xd4\x48\xcf\x59\x35\xc1\x36\x5a\x6d\x32\x47\x11\xcc\xcd\xf9\x60\xa5\xe4\x8b\x17\xce\x6c\x00\xe6\x2d\xc0\x9d\x19\x0d\xf7\x89\x0b\x97\x40\x93\x59\x7b\x46\x6b\x59\x92\x13\x49\x6d\x7e\x2d\xd8\x5f\xdf\x33\xb3\x5f\x48\x92\x5c\xdc\x91\x2b\xd3\x90\x3d\xb7\x0d\x0a\xa9\xe6\xd4\x50\x9e\x5b\x32\x77\x86\x32\x9a\x90\x73\xe9\x7e\x8e\xc2\x2e\x6b\xbf\x36\x2f\x3b\x36\x42\xb8\x04\xd7\xf9\xcd\x9d\xd9\x43\x52\x7d\xe4\x9a\xb2\xb1\x36\xf1\xdd\xc1\xc5\xe6\x32\x22\x09\xf7\x5c\xec\xce\x10\x4e\x92\x47\xe2\x54\x99\xb8\xff\x9e\x38\xab\xf1\xed\x69\x5b\x86\xe0\x9e\xdb\xb4\x0d\xf7\xd9\xbe\xff\x9c\x80\xba\xf0\xda\x7b\x8a\xd9\x1b\x9c\x6c\xcf\x77\xd8\x31\x96\xf7\x8c\x7a\x2e\xa3\xee\xcc\x8a\xbf\x69\x23\x0f\xcd\xf1\xb4\xce\xfe\x1e\x75\xb8\xe6\xaa\x37\xdb\xab\xf6\x6a\xe3\xb9\x9d\x63\xdd\x9d\xfd\x1a\xfe\x66\x6f\x65\xf6\xec\xb6\x77\xb2\x51\x1a\x47\xac\xf6\xeb\xb6\x9a\x75\x3d\x3b\x3e\xa3\x3a\x87\xf3\xf0\x74\xb6\x07\xb3\xc6\x69\xff\xbc\xdf\x08\xa1\x8f\xbf\xd5\x35\xd2\xe1\xc7\xb1\x92\x1d\x5d\x5d\x70\xea\x33\xba\xff\x6a\xd8\xfd\xed\xdf\x86\x4f\x99\xde\xc3\x32\x7a\x0a\xd6\x37\xef\xdb\x27\xbe\x0d\x1d\x7f\x75\xd9\xaf\x3a\xf7\xd5\xa5\xaa\x02\xe3\x48\x50\xbf\x89\x0d\xbf\xb6\xa0\x93\x9f\x78\xc6\xbe\xc0\xac\x02\x46\x47\xe3\x1e\x7b\xe1\x0a\x4a\xd6\xfd\x62\xd9\x10\x7c\xea\xa2\xd5\xb9\x85\xed\x76\x50\x98\x00\x31\x03\x87\xe3\x3b\x94\xe9\x9c\x39\x8d\xa3\xab\xc0\x46\xbe\x9e\xfe\x19\x00\x00\xff\xff\x4f\x1b\xc7\xfc\xc2\x16\x00\x00") + +func layoutsPartialsGalleryHtmlBytes() ([]byte, error) { + return bindataRead( + _layoutsPartialsGalleryHtml, + "layouts/partials/gallery.html", + ) +} + +func layoutsPartialsGalleryHtml() (*asset, error) { + bytes, err := layoutsPartialsGalleryHtmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "layouts/partials/gallery.html", size: 5826, mode: os.FileMode(420), modTime: time.Unix(1504974306, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _layoutsShortcodesCommentsHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x93\xc1\x6e\xe2\x30\x10\x86\xef\x79\x0a\xcb\x7b\x48\x22\x21\x73\x5f\x12\x2e\xbb\xab\x45\x15\x94\xaa\xe4\xd0\x6b\x9a\x4c\xc0\x52\xb0\xc3\x78\x6c\x82\x50\xde\xbd\x02\x11\x50\x09\x0d\xad\xaa\xfe\x47\x6b\xc6\xff\xcc\x7c\x33\x91\xc9\x50\x56\x34\xf6\xd8\x95\xb6\x52\xe5\x7a\x2b\xb4\x2a\x75\x9a\xb3\x98\x15\x56\x65\x24\xb5\x62\x41\xc8\xf6\x9d\xe8\x56\x08\x05\x82\x59\xfd\xd1\xeb\x35\x28\x32\x41\x38\xea\x84\x36\x23\xaf\xf3\x76\xfe\xbc\x93\xdf\xe3\xe5\x52\x64\xf5\x0a\x59\xcc\x14\x6c\xd9\xcb\x6c\x3a\x21\xaa\x9e\x61\x63\xc1\xd0\x2d\xe3\x56\xf5\x0a\x85\xae\x40\x05\xfc\xff\xbf\x84\x0f\x18\x17\xc3\xec\xe4\xc7\xef\xa5\x7d\x6d\x1a\xad\x72\x9d\xd9\xc3\xff\x62\x63\x01\x77\x0b\x28\x21\x23\x8d\x01\xff\x75\xf1\x15\x52\x29\xc0\x49\x32\x9b\xb2\xf8\x68\x85\x60\x2a\xad\x0c\x24\x50\xd3\xc7\x45\x35\xfd\xf5\x1a\x50\xf9\x4d\x06\x5d\x04\x27\xde\xc6\xbe\xae\x25\x9d\xe6\xff\xae\x51\x70\xd4\xd7\x2b\x38\x12\x15\x82\x03\x45\x7f\xa1\x48\x6d\xd9\xcb\xe0\xdb\xec\xfc\xa7\xf9\x22\xf1\x07\xcc\xbf\xc0\xf3\x07\x8c\xd0\xc2\x9d\xec\xe3\x48\x1e\x16\xf3\x47\x61\x08\xa5\x5a\xca\x62\x17\xec\x39\x41\x4d\xfc\xf7\xb1\x09\x4a\x71\x09\xd7\xa8\xfc\x43\x40\x8a\x90\xfa\xa1\x70\x69\x69\xa1\x09\x7f\x66\x55\x3e\x71\x40\xad\x9a\x1b\x58\xa3\x61\x7b\xcf\x51\x2e\x1d\x93\x79\xcc\xcf\x3b\x36\x8e\x86\xb9\x74\x63\xcf\x7b\x0b\x00\x00\xff\xff\xe4\x8c\x03\x32\xf4\x03\x00\x00") + +func layoutsShortcodesCommentsHtmlBytes() ([]byte, error) { + return bindataRead( + _layoutsShortcodesCommentsHtml, + "layouts/shortcodes/comments.html", + ) +} + +func layoutsShortcodesCommentsHtml() (*asset, error) { + bytes, err := layoutsShortcodesCommentsHtmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "layouts/shortcodes/comments.html", size: 1012, mode: os.FileMode(420), modTime: time.Unix(1504974306, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _layoutsShortcodesThumbHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x90\xc1\x6a\xec\x30\x0c\x45\xf7\xf9\x0a\xa1\xd5\x7b\x8b\x99\x4c\xf7\x49\xb6\xfd\x8c\xa2\x26\x8a\x2d\xea\xb8\x69\x22\x98\x82\xd0\xbf\x17\xa7\x66\x98\x0e\xed\xc6\x20\x38\xe7\xfa\x72\xbb\xb5\x31\x03\x99\x81\x3f\xe0\xdf\xf9\x99\x15\x90\x92\x84\x8c\xff\x01\x13\xcf\x8a\xe0\x3e\x26\xda\xf7\xfe\x38\x65\x09\x68\xc6\x69\xe7\xe2\x3c\x0a\x9b\x84\xa8\x78\x13\x8e\xb3\x1a\x79\x82\x93\x7b\x33\x74\x04\x71\xe3\xb9\xc7\x76\xe1\x49\xa8\x35\x83\xef\x90\x59\x12\x67\x5a\x18\xdd\x11\x94\xb6\xc0\xda\xe3\xcb\x6b\xa2\xfc\x86\x43\x27\x4b\x80\x7d\x1b\x6f\x5a\x63\x76\x82\xab\x68\xac\xf6\x55\x26\x8d\xe8\x6e\x76\x2e\x4f\x29\xe8\xfe\x74\xb9\x1c\x3f\xbb\x7f\x9a\xdd\xc1\x91\x6b\xcf\x1f\x74\x45\x7f\x69\x54\x9a\x63\x99\xe9\x2e\x63\xa4\x55\xe5\x3d\x97\x79\x54\x34\x71\x8f\x47\x18\xd6\x94\xbf\x69\x4a\xfa\xc8\xb6\x43\xd7\xd2\xd0\x74\xed\x3a\x34\x5f\x01\x00\x00\xff\xff\x52\x23\x84\xaa\x90\x01\x00\x00") + +func layoutsShortcodesThumbHtmlBytes() ([]byte, error) { + return bindataRead( + _layoutsShortcodesThumbHtml, + "layouts/shortcodes/thumb.html", + ) +} + +func layoutsShortcodesThumbHtml() (*asset, error) { + bytes, err := layoutsShortcodesThumbHtmlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "layouts/shortcodes/thumb.html", size: 400, mode: os.FileMode(420), modTime: time.Unix(1504974306, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "archetypes/gallery.md": archetypesGalleryMd, + "layouts/gallery/single.html": layoutsGallerySingleHtml, + "layouts/partials/gallery.html": layoutsPartialsGalleryHtml, + "layouts/shortcodes/comments.html": layoutsShortcodesCommentsHtml, + "layouts/shortcodes/thumb.html": layoutsShortcodesThumbHtml, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} +var _bintree = &bintree{nil, map[string]*bintree{ + "archetypes": &bintree{nil, map[string]*bintree{ + "gallery.md": &bintree{archetypesGalleryMd, map[string]*bintree{}}, + }}, + "layouts": &bintree{nil, map[string]*bintree{ + "gallery": &bintree{nil, map[string]*bintree{ + "single.html": &bintree{layoutsGallerySingleHtml, map[string]*bintree{}}, + }}, + "partials": &bintree{nil, map[string]*bintree{ + "gallery.html": &bintree{layoutsPartialsGalleryHtml, map[string]*bintree{}}, + }}, + "shortcodes": &bintree{nil, map[string]*bintree{ + "comments.html": &bintree{layoutsShortcodesCommentsHtml, map[string]*bintree{}}, + "thumb.html": &bintree{layoutsShortcodesThumbHtml, map[string]*bintree{}}, + }}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} +