commit c5f1031e45f74e649a270359da2a3436e515c346
parent 141f3e19e0a9ba873b0cece6071b1187daa81d8d
Author: spf13 <steve.francia@gmail.com>
Date: Sat, 1 Nov 2014 12:05:37 -0400
Handler WIP
Diffstat:
3 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/hugolib/handler_file.go b/hugolib/handler_file.go
@@ -13,11 +13,23 @@
package hugolib
-import "github.com/spf13/hugo/source"
+import (
+ "fmt"
+ _ "github.com/dchest/cssmin"
+ "github.com/spf13/hugo/source"
+)
-var Filer interface {
- Read(*source.File)
- Render()
- Convert()
- Extensions() []string
+func init() {
+ RegisterHandler(css)
+}
+
+var css = Handle{
+ extensions: []string{"css"},
+ read: func(f *source.File, s *Site, results HandleResults) {
+ results <- HandledResult{file: f}
+ },
+ fileConvert: func(f *source.File, s *Site, results HandleResults) {
+
+ fmt.Println(f.Path())
+ },
}
diff --git a/hugolib/handler_page.go b/hugolib/handler_page.go
@@ -15,11 +15,8 @@ package hugolib
import "github.com/spf13/hugo/source"
-var Pager interface {
- Read(*source.File)
- Render()
- Convert()
- Extensions() []string
+func init() {
+ RegisterHandler(markdown)
}
var markdown = Handle{
@@ -49,7 +46,3 @@ var markdown = Handle{
results <- HandledResult{err: err}
},
}
-
-func init() {
- RegisterHandler(markdown)
-}
diff --git a/hugolib/handlers.go b/hugolib/handlers.go
@@ -16,9 +16,14 @@ package hugolib
import "github.com/spf13/hugo/source"
type Handler interface {
+ // Read the Files in and register
Read(*source.File, *Site, HandleResults)
- //Render()
+
+ // Convert Pages to prepare for templatizing
+ // Convert Files to their final destination
Convert(interface{}, *Site, HandleResults)
+
+ // Extensions to register the handle for
Extensions() []string
}