func readData(f *source.File) (interface{}, error) { switch f.Extension() { case "yaml", "yml": return parser.HandleYAMLMetaData(f.Bytes()) case "json": return parser.HandleJSONMetaData(f.Bytes()) case "toml": return parser.HandleTOMLMetaData(f.Bytes()) default: jww.WARN.Printf("Data not supported for extension '%s'", f.Extension()) return nil, nil } }
func (b basicPageHandler) Read(f *source.File, s *Site) HandledResult { page, err := NewPage(f.Path()) if err != nil { return HandledResult{file: f, err: err} } if _, err := page.ReadFrom(f.Contents); err != nil { return HandledResult{file: f, err: err} } page.Site = &s.Info page.Tmpl = s.Tmpl return HandledResult{file: f, page: page, err: err} }
func (h cssHandler) FileConvert(f *source.File, s *Site) HandledResult { x := cssmin.Minify(f.Bytes()) s.WriteDestFile(f.Path(), helpers.BytesToReader(x)) return HandledResult{file: f} }
func (h defaultHandler) FileConvert(f *source.File, s *Site) HandledResult { s.WriteDestFile(f.Path(), f.Contents) return HandledResult{file: f} }