diff --git a/hugolib/handler_page.go b/hugolib/handler_page.go index 75bf91a23..c897b6ae8 100644 --- a/hugolib/handler_page.go +++ b/hugolib/handler_page.go @@ -16,10 +16,11 @@ package hugolib 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()) @@ -46,3 +47,31 @@ var markdown = Handle{ 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} + }, +}