import "github.com/spf13/hugo/source"
func init() {
- RegisterHandler(markdown)
+ RegisterHandler(markdownHandler)
+ RegisterHandler(htmlHandler)
}
-var markdown = Handle{
+var markdownHandler = Handle{
extensions: []string{"mdown", "markdown", "md"},
read: func(f *source.File, s *Site, results HandleResults) {
page, err := NewPage(f.Path())
results <- HandledResult{err: err}
},
}
+
+var htmlHandler = Handle{
+ extensions: []string{"html", "htm"},
+ read: func(f *source.File, s *Site, results HandleResults) {
+ page, err := NewPage(f.Path())
+ if err != nil {
+ results <- HandledResult{file: f, err: err}
+ }
+
+ if err := page.ReadFrom(f.Contents); err != nil {
+ results <- HandledResult{file: f, err: err}
+ }
+
+ page.Site = &s.Info
+ page.Tmpl = s.Tmpl
+
+ results <- HandledResult{file: f, page: page, err: err}
+ },
+ pageConvert: func(p *Page, s *Site, results HandleResults) {
+ p.ProcessShortcodes(s.Tmpl)
+ err := p.Convert()
+ if err != nil {
+ results <- HandledResult{err: err}
+ }
+
+ results <- HandledResult{err: err}
+ },
+}