var markdown = Handle{
extensions: []string{"mdown", "markdown", "md"},
- readrun: func(f *source.File, results HandleResults) {
+ readrun: func(f *source.File, s *Site, results HandleResults) {
page, err := NewPage(f.Path())
if err != nil {
results <- HandledResult{file: f, err: err}
results <- HandledResult{file: f, err: err}
}
+ page.Site = &s.Info
+ page.Tmpl = s.Tmpl
+
results <- HandledResult{file: f, page: page, err: err}
},
}
import "github.com/spf13/hugo/source"
type Handler interface {
- Read(*source.File, HandleResults)
+ Read(*source.File, *Site, HandleResults)
//Render()
//Convert()
Extensions() []string
type HandleResults chan<- HandledResult
-type ReadFunc func(*source.File, HandleResults)
+type ReadFunc func(*source.File, *Site, HandleResults)
type Handle struct {
extensions []string
return h.extensions
}
-func (h Handle) Read(s *source.File, results HandleResults) {
- h.readrun(s, results)
+func (h Handle) Read(f *source.File, s *Site, results HandleResults) {
+ h.readrun(f, s, results)
}
func RegisterHandler(h Handler) {
for file := range files {
h := FindHandler(file.Extension())
if h != nil {
- h.Read(file, results)
+ h.Read(file, s, results)
} else {
jww.ERROR.Println("Unsupported File Type", file.Path())
}
-
- // TODO: Figure out Site stuff
- //page.Site = &s.Info
- //page.Tmpl = s.Tmpl
}
}