Use s everywhere for consistency
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
This commit is contained in:
parent
b268e639ba
commit
0a9dc705f3
1 changed files with 39 additions and 41 deletions
|
@ -63,73 +63,73 @@ func (s *Site) timerStep(step string) {
|
||||||
s.timer.Step(step)
|
s.timer.Step(step)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Build() (err error) {
|
func (s *Site) Build() (err error) {
|
||||||
if err = site.Process(); err != nil {
|
if err = s.Process(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = site.Render(); err != nil {
|
if err = s.Render(); err != nil {
|
||||||
fmt.Printf("Error rendering site: %s\n", err)
|
fmt.Printf("Error rendering site: %s\n", err)
|
||||||
fmt.Printf("Available templates:")
|
fmt.Printf("Available templates:")
|
||||||
for _, template := range site.Tmpl.Templates() {
|
for _, template := range s.Tmpl.Templates() {
|
||||||
fmt.Printf("\t%s\n", template.Name())
|
fmt.Printf("\t%s\n", template.Name())
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.Write()
|
s.Write()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Analyze() {
|
func (s *Site) Analyze() {
|
||||||
site.Process()
|
s.Process()
|
||||||
site.checkDescriptions()
|
s.checkDescriptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Process() (err error) {
|
func (s *Site) Process() (err error) {
|
||||||
site.initialize()
|
s.initialize()
|
||||||
site.prepTemplates()
|
s.prepTemplates()
|
||||||
site.timerStep("initialize & template prep")
|
s.timerStep("initialize & template prep")
|
||||||
site.CreatePages()
|
s.CreatePages()
|
||||||
site.setupPrevNext()
|
s.setupPrevNext()
|
||||||
site.timerStep("import pages")
|
s.timerStep("import pages")
|
||||||
if err = site.BuildSiteMeta(); err != nil {
|
if err = s.BuildSiteMeta(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.timerStep("build indexes")
|
s.timerStep("build indexes")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Render() (err error) {
|
func (s *Site) Render() (err error) {
|
||||||
site.RenderAliases()
|
s.RenderAliases()
|
||||||
site.timerStep("render and write aliases")
|
s.timerStep("render and write aliases")
|
||||||
site.ProcessShortcodes()
|
s.ProcessShortcodes()
|
||||||
site.timerStep("render shortcodes")
|
s.timerStep("render shortcodes")
|
||||||
site.AbsUrlify()
|
s.AbsUrlify()
|
||||||
site.timerStep("absolute URLify")
|
s.timerStep("absolute URLify")
|
||||||
if err = site.RenderIndexes(); err != nil {
|
if err = s.RenderIndexes(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.RenderIndexesIndexes()
|
s.RenderIndexesIndexes()
|
||||||
site.timerStep("render and write indexes")
|
s.timerStep("render and write indexes")
|
||||||
site.RenderLists()
|
s.RenderLists()
|
||||||
site.timerStep("render and write lists")
|
s.timerStep("render and write lists")
|
||||||
if err = site.RenderPages(); err != nil {
|
if err = s.RenderPages(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.timerStep("render pages")
|
s.timerStep("render pages")
|
||||||
if err = site.RenderHomePage(); err != nil {
|
if err = s.RenderHomePage(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
site.timerStep("render and write homepage")
|
s.timerStep("render and write homepage")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Write() {
|
func (s *Site) Write() {
|
||||||
site.WritePages()
|
s.WritePages()
|
||||||
site.timerStep("write pages")
|
s.timerStep("write pages")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) checkDescriptions() {
|
func (s *Site) checkDescriptions() {
|
||||||
for _, p := range site.Pages {
|
for _, p := range s.Pages {
|
||||||
if len(p.Description) < 60 {
|
if len(p.Description) < 60 {
|
||||||
fmt.Print(p.FileName + " ")
|
fmt.Print(p.FileName + " ")
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,6 @@ func (s *Site) primeTemplates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) initialize() {
|
func (s *Site) initialize() {
|
||||||
site := s
|
|
||||||
|
|
||||||
s.checkDirectories()
|
s.checkDirectories()
|
||||||
|
|
||||||
staticDir := s.Config.GetAbsPath(s.Config.StaticDir + "/")
|
staticDir := s.Config.GetAbsPath(s.Config.StaticDir + "/")
|
||||||
|
@ -217,7 +215,7 @@ func (s *Site) initialize() {
|
||||||
if ignoreDotFile(path) {
|
if ignoreDotFile(path) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
site.Files = append(site.Files, path)
|
s.Files = append(s.Files, path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue