1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-22 20:51:24 +01:00

Steps towards Windows compat

This commit is contained in:
Oliver Steele 2017-06-17 00:12:09 -04:00
parent 8a8767e569
commit 8223c9b7d8
3 changed files with 7 additions and 6 deletions

View File

@ -56,7 +56,7 @@ func (c *Collection) IsPosts() bool {
// PathPrefix returns the collection's directory prefix, e.g. "_posts/" // PathPrefix returns the collection's directory prefix, e.g. "_posts/"
func (c *Collection) PathPrefix() string { func (c *Collection) PathPrefix() string {
return "_" + c.Name + "/" return filepath.FromSlash("_" + c.Name + "/")
} }
// Source returns the source directory for pages in the collection. // Source returns the source directory for pages in the collection.

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"path"
"path/filepath" "path/filepath"
"reflect" "reflect"
"regexp" "regexp"
@ -85,13 +86,13 @@ func (p *StaticPage) Write(w io.Writer) error {
// See https://jekyllrb.com/docs/variables/#page-variables // See https://jekyllrb.com/docs/variables/#page-variables
func (p *pageFields) TemplateObject() VariableMap { func (p *pageFields) TemplateObject() VariableMap {
var ( var (
relpath = "/" + p.relpath relpath = "/" + filepath.ToSlash(p.relpath)
base = filepath.Base(relpath) base = path.Base(relpath)
ext = filepath.Ext(relpath) ext = path.Ext(relpath)
) )
return VariableMap{ return VariableMap{
"path": "/" + p.relpath, "path": relpath,
"modified_time": 0, // TODO "modified_time": 0, // TODO
"name": base, "name": base,
"basename": helpers.PathWithoutExtension(base), "basename": helpers.PathWithoutExtension(base),

View File

@ -97,7 +97,7 @@ func (p *pageFields) expandPermalink() (s string, err error) {
} }
return value return value
}) })
return path.Clean(s), nil return path.Clean(filepath.ToSlash(s)), nil
} }
// The permalink is computed once instead of on demand, so that subsequent // The permalink is computed once instead of on demand, so that subsequent