diff options
Diffstat (limited to 'commands/convert.go')
-rw-r--r-- | commands/convert.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/commands/convert.go b/commands/convert.go index 79c3c75e8..c24282550 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -21,11 +21,8 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/spf13/hugo/helpers" "github.com/spf13/hugo/hugolib" "github.com/spf13/hugo/parser" - jww "github.com/spf13/jwalterweatherman" - "github.com/spf13/viper" ) var outputDir string @@ -86,7 +83,7 @@ func convertContents(mark rune) error { return err } - h, err := hugolib.NewHugoSitesFromConfiguration(cfg) + h, err := hugolib.NewHugoSites(*cfg) if err != nil { return err } @@ -104,10 +101,10 @@ func convertContents(mark rune) error { return errors.New("No source files found") } - contentDir := helpers.AbsPathify(viper.GetString("contentDir")) - jww.FEEDBACK.Println("processing", len(site.Source.Files()), "content files") + contentDir := site.PathSpec.AbsPathify(site.Cfg.GetString("contentDir")) + site.Log.FEEDBACK.Println("processing", len(site.Source.Files()), "content files") for _, file := range site.Source.Files() { - jww.INFO.Println("Attempting to convert", file.LogicalName()) + site.Log.INFO.Println("Attempting to convert", file.LogicalName()) page, err := site.NewPage(file.LogicalName()) if err != nil { return err @@ -115,12 +112,12 @@ func convertContents(mark rune) error { psr, err := parser.ReadFrom(file.Contents) if err != nil { - jww.ERROR.Println("Error processing file:", file.Path()) + site.Log.ERROR.Println("Error processing file:", file.Path()) return err } metadata, err := psr.Metadata() if err != nil { - jww.ERROR.Println("Error processing file:", file.Path()) + site.Log.ERROR.Println("Error processing file:", file.Path()) return err } @@ -139,7 +136,7 @@ func convertContents(mark rune) error { page.SetDir(filepath.Join(contentDir, file.Dir())) page.SetSourceContent(psr.Content()) if err = page.SetSourceMetaData(metadata, mark); err != nil { - jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err) + site.Log.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err) continue } @@ -153,7 +150,7 @@ func convertContents(mark rune) error { return fmt.Errorf("Failed to save file %q: %s", page.FullFilePath(), err) } } else { - jww.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path") + site.Log.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path") } } } |