URI: 
       Allow forward slashes in Hugo new on Windows - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit be3a3506c48d4f6a54ad179488e496656625fca0
   DIR parent be72f234f8cf8ab4723248c1306fb2e0b7ad5252
  HTML Author: bep <bjorn.erik.pedersen@gmail.com>
       Date:   Tue, 12 May 2015 18:12:58 +0200
       
       Allow forward slashes in Hugo new on Windows
       
       Fixes  #1133
       
       Diffstat:
         M commands/new.go                     |      18 ++++++++++++++----
         A commands/new_test.go                |      14 ++++++++++++++
       
       2 files changed, 28 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/commands/new.go b/commands/new.go
       @@ -92,10 +92,7 @@ func NewContent(cmd *cobra.Command, args []string) {
        
                var kind string
        
       -        // assume the first directory is the section (kind)
       -        if strings.Contains(createpath[1:], helpers.FilePathSeparator) {
       -                kind = helpers.GuessSection(createpath)
       -        }
       +        createpath, kind = newContentPathSection(createpath)
        
                if contentType != "" {
                        kind = contentType
       @@ -251,6 +248,19 @@ min_version = 0.13
                return nil
        }
        
       +func newContentPathSection(path string) (string, string) {
       +        // Forward slashes is used in all examples. Convert if needed.
       +        // Issue #1133
       +        createpath := strings.Replace(path, "/", helpers.FilePathSeparator, -1)
       +        var section string
       +        // assume the first directory is the section (kind)
       +        if strings.Contains(createpath[1:], helpers.FilePathSeparator) {
       +                section = helpers.GuessSection(createpath)
       +        }
       +
       +        return createpath, section
       +}
       +
        func createConfig(inpath string, kind string) (err error) {
                in := map[string]string{
                        "baseurl":      "http://replace-this-with-your-hugo-site.com/",
   DIR diff --git a/commands/new_test.go b/commands/new_test.go
       @@ -0,0 +1,14 @@
       +package commands
       +
       +import (
       +        "github.com/stretchr/testify/assert"
       +        "path/filepath"
       +        "testing"
       +)
       +
       +// Issue #1133
       +func TestNewContentPathSectionWithForwardSlashes(t *testing.T) {
       +        p, s := newContentPathSection("/post/new.md")
       +        assert.Equal(t, filepath.FromSlash("/post/new.md"), p)
       +        assert.Equal(t, "post", s)
       +}