mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Cleanup formatting - go fmt ./...
Remember to run go fmt ./... before committing. Looks sternly in mirror
This commit is contained in:
parent
4ed43e8076
commit
a792ec09ce
3 changed files with 14 additions and 13 deletions
|
@ -334,7 +334,7 @@ func MakePermalink(domain string, path string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSummaryString(content []byte) ([]byte, bool) {
|
func getSummaryString(content []byte) ([]byte, bool) {
|
||||||
if (bytes.Contains(content, summaryDivider)) {
|
if bytes.Contains(content, summaryDivider) {
|
||||||
return bytes.Split(content, summaryDivider)[0], false
|
return bytes.Split(content, summaryDivider)[0], false
|
||||||
} else {
|
} else {
|
||||||
plainContent := StripHTML(StripShortcodes(string(content)))
|
plainContent := StripHTML(StripShortcodes(string(content)))
|
||||||
|
|
|
@ -121,7 +121,7 @@ func (site *Site) Render() (err error) {
|
||||||
site.timerStep("render pages")
|
site.timerStep("render pages")
|
||||||
if err = site.RenderHomePage(); err != nil {
|
if err = site.RenderHomePage(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.timerStep("render and write homepage")
|
site.timerStep("render and write homepage")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ func (s *Site) initialize() {
|
||||||
|
|
||||||
s.checkDirectories()
|
s.checkDirectories()
|
||||||
|
|
||||||
staticDir := s.Config.GetAbsPath(s.Config.StaticDir+"/")
|
staticDir := s.Config.GetAbsPath(s.Config.StaticDir + "/")
|
||||||
|
|
||||||
walker := func(path string, fi os.FileInfo, err error) error {
|
walker := func(path string, fi os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -212,7 +212,7 @@ func (s *Site) initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
if (path == staticDir) {
|
if path == staticDir {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
site.Directories = append(site.Directories, path)
|
site.Directories = append(site.Directories, path)
|
||||||
|
@ -432,7 +432,7 @@ func inStringArray(arr []string, el string) bool {
|
||||||
func (s *Site) RenderAliases() error {
|
func (s *Site) RenderAliases() error {
|
||||||
for i, p := range s.Pages {
|
for i, p := range s.Pages {
|
||||||
for _, a := range p.Aliases {
|
for _, a := range p.Aliases {
|
||||||
t := "alias";
|
t := "alias"
|
||||||
if strings.HasSuffix(a, ".xhtml") {
|
if strings.HasSuffix(a, ".xhtml") {
|
||||||
t = "alias-xhtml"
|
t = "alias-xhtml"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package hugolib
|
package hugolib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -164,16 +164,17 @@ func TestRenderThingOrDefault(t *testing.T) {
|
||||||
if string(html.Bytes()) != test.expected {
|
if string(html.Bytes()) != test.expected {
|
||||||
t.Errorf("Content does not match. Expected '%s', got '%s'", test.expected, html)
|
t.Errorf("Content does not match. Expected '%s', got '%s'", test.expected, html)
|
||||||
}
|
}
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSetOutFile(t *testing.T) {
|
func TestSetOutFile(t *testing.T) {
|
||||||
s := new(Site)
|
s := new(Site)
|
||||||
p := pageMust(ReadFrom(strings.NewReader(PAGE_URL_SPECIFIED), "content/a/file.md"))
|
p := pageMust(ReadFrom(strings.NewReader(PAGE_URL_SPECIFIED), "content/a/file.md"))
|
||||||
s.setOutFile(p)
|
s.setOutFile(p)
|
||||||
|
|
||||||
expected := "mycategory/my-whatever-content/index.html"
|
expected := "mycategory/my-whatever-content/index.html"
|
||||||
|
|
||||||
if p.OutFile != "mycategory/my-whatever-content/index.html" {
|
if p.OutFile != "mycategory/my-whatever-content/index.html" {
|
||||||
t.Errorf("Outfile does not match. Expected '%s', got '%s'", expected, p.OutFile)
|
t.Errorf("Outfile does not match. Expected '%s', got '%s'", expected, p.OutFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue