mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-26 21:34:45 +01:00
Remove . imports
This commit is contained in:
parent
20cde62eff
commit
aa35dbf1c5
8
build.go
8
build.go
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
)
|
||||
|
||||
// Clean the destination. Remove files that aren't in keep_files, and resulting empty diretories.
|
||||
@ -31,7 +31,7 @@ func (s *Site) Clean() error {
|
||||
if err := filepath.Walk(s.Destination, removeFiles); err != nil {
|
||||
return err
|
||||
}
|
||||
return RemoveEmptyDirectories(s.Destination)
|
||||
return helpers.RemoveEmptyDirectories(s.Destination)
|
||||
}
|
||||
|
||||
// Build cleans the destination and create files in it.
|
||||
@ -67,8 +67,8 @@ func (s *Site) WritePage(page Page) error {
|
||||
case page.Static() && options.useHardLinks:
|
||||
return os.Link(from, to)
|
||||
case page.Static():
|
||||
return CopyFileContents(to, from, 0644)
|
||||
return helpers.CopyFileContents(to, from, 0644)
|
||||
default:
|
||||
return VisitCreatedFile(to, page.Write)
|
||||
return helpers.VisitCreatedFile(to, page.Write)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
"github.com/russross/blackfriday"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
@ -68,7 +68,7 @@ func (p *DynamicPage) TemplateObject() VariableMap {
|
||||
var (
|
||||
relpath = p.relpath
|
||||
ext = filepath.Ext(relpath)
|
||||
root = PathWithoutExtension(p.relpath)
|
||||
root = helpers.PathWithoutExtension(p.relpath)
|
||||
base = filepath.Base(root)
|
||||
)
|
||||
|
||||
@ -128,7 +128,7 @@ func (p *DynamicPage) DebugVariables() VariableMap {
|
||||
|
||||
// Write applies Liquid and Markdown, as appropriate.
|
||||
func (p *DynamicPage) Write(w io.Writer) (err error) {
|
||||
body, err := ParseAndApplyTemplate(p.Content, p.TemplateVariables())
|
||||
body, err := helpers.ParseAndApplyTemplate(p.Content, p.TemplateVariables())
|
||||
if err != nil {
|
||||
err = &os.PathError{Op: "Liquid Error", Path: p.Source(), Err: err}
|
||||
return
|
||||
|
@ -17,7 +17,7 @@ func VisitCreatedFile(name string, w func(io.Writer) error) error {
|
||||
close := true
|
||||
defer func() {
|
||||
if close {
|
||||
_ = f.Close()
|
||||
_ = f.Close() // nolint: gas
|
||||
}
|
||||
}()
|
||||
if err := w(f); err != nil {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
|
||||
"github.com/acstech/liquid"
|
||||
)
|
||||
@ -59,7 +59,7 @@ func (p *DynamicPage) applyLayout(frontMatter VariableMap, body []byte) ([]byte,
|
||||
"content": body,
|
||||
"layout": frontMatter,
|
||||
})
|
||||
body, err = RenderTemplate(template, vars)
|
||||
body, err = helpers.RenderTemplate(template, vars)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
4
main.go
4
main.go
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
|
||||
@ -22,7 +22,7 @@ var options struct {
|
||||
const configurationFileLabel = "Configuration file:"
|
||||
|
||||
func printSetting(label string, value string) {
|
||||
fmt.Printf("%s %s\n", LeftPad(label, len(configurationFileLabel)), value)
|
||||
fmt.Printf("%s %s\n", helpers.LeftPad(label, len(configurationFileLabel)), value)
|
||||
}
|
||||
|
||||
func printPathSetting(label string, name string) {
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
)
|
||||
|
||||
// IsMarkdown returns a boolean indicating whether the file is a Markdown file, according to the current project.
|
||||
@ -16,5 +16,5 @@ func (s *Site) IsMarkdown(name string) bool {
|
||||
// MarkdownExtensions returns a set of markdown extension, without the final dots.
|
||||
func (s *Site) MarkdownExtensions() map[string]bool {
|
||||
extns := strings.SplitN(s.config.MarkdownExt, `,`, -1)
|
||||
return StringArrayToMap(extns)
|
||||
return helpers.StringArrayToMap(extns)
|
||||
}
|
||||
|
6
page.go
6
page.go
@ -8,7 +8,7 @@ import (
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -49,7 +49,7 @@ func (p *pageFields) Site() *Site { return p.site }
|
||||
|
||||
// ReadPage reads a Page from a file, using defaults as the default front matter.
|
||||
func ReadPage(site *Site, relpath string, defaults VariableMap) (p Page, err error) {
|
||||
magic, err := ReadFileMagic(filepath.Join(site.Source, relpath))
|
||||
magic, err := helpers.ReadFileMagic(filepath.Join(site.Source, relpath))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -93,7 +93,7 @@ func (p *pageFields) TemplateObject() VariableMap {
|
||||
"path": "/" + p.relpath,
|
||||
"modified_time": 0, // TODO
|
||||
"name": base,
|
||||
"basename": PathWithoutExtension(base),
|
||||
"basename": helpers.PathWithoutExtension(base),
|
||||
"extname": ext,
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
)
|
||||
|
||||
// PermalinkStyles defines built-in styles from https://jekyllrb.com/docs/permalinks/#builtinpermalinkstyles
|
||||
@ -42,7 +42,7 @@ func (p *pageFields) permalinkTemplateVariables() map[string]string {
|
||||
path = p.relpath
|
||||
ext = filepath.Ext(path)
|
||||
outputExt = ext
|
||||
root = PathWithoutExtension(path)
|
||||
root = helpers.PathWithoutExtension(path)
|
||||
name = filepath.Base(root)
|
||||
title = p.frontMatter.String("title", name)
|
||||
)
|
||||
@ -62,10 +62,10 @@ func (p *pageFields) permalinkTemplateVariables() map[string]string {
|
||||
}
|
||||
vs := map[string]string{
|
||||
"collection": collectionName,
|
||||
"name": Slugify(name),
|
||||
"name": helpers.Slugify(name),
|
||||
"path": "/" + root,
|
||||
"title": title,
|
||||
"slug": Slugify(name),
|
||||
"slug": helpers.Slugify(name),
|
||||
// TODO categories
|
||||
// The following isn't documented, but is evident
|
||||
"output_ext": outputExt,
|
||||
|
4
sass.go
4
sass.go
@ -9,7 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
|
||||
libsass "github.com/wellington/go-libsass"
|
||||
)
|
||||
@ -55,7 +55,7 @@ func (s *Site) CopySassFileIncludes() {
|
||||
panic(err)
|
||||
}
|
||||
to := filepath.Join(dst, strings.TrimPrefix(rel, "_"))
|
||||
return CopyFileContents(to, from, 0644)
|
||||
return helpers.CopyFileContents(to, from, 0644)
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
6
site.go
6
site.go
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/osteele/gojekyll/helpers"
|
||||
"github.com/osteele/gojekyll/helpers"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
@ -133,8 +133,8 @@ func (s *Site) GetFileURL(path string) (string, bool) {
|
||||
// Exclude returns a boolean indicating that the site excludes a file.
|
||||
func (s *Site) Exclude(path string) bool {
|
||||
// TODO exclude based on glob, not exact match
|
||||
inclusionMap := StringArrayToMap(s.config.Include)
|
||||
exclusionMap := StringArrayToMap(s.config.Exclude)
|
||||
inclusionMap := helpers.StringArrayToMap(s.config.Include)
|
||||
exclusionMap := helpers.StringArrayToMap(s.config.Exclude)
|
||||
base := filepath.Base(path)
|
||||
switch {
|
||||
case inclusionMap[path]:
|
||||
|
Loading…
Reference in New Issue
Block a user