Do some minor code cleaning of Site

* Unexport some methods/fields
* Add some godoc

Still plenty to do here.
This commit is contained in:
Bjørn Erik Pedersen 2016-03-23 09:43:04 +01:00
parent 626874b94c
commit faf2e50685

View file

@ -1,4 +1,4 @@
// Copyright 2015 The Hugo Authors. All rights reserved. // Copyright 2016 The Hugo Authors. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -14,7 +14,6 @@
package hugolib package hugolib
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"html/template" "html/template"
@ -53,7 +52,7 @@ var _ = transform.AbsURL
// used to indicate if run as a test. // used to indicate if run as a test.
var testMode bool var testMode bool
var DefaultTimer *nitro.B var defaultTimer *nitro.B
var distinctErrorLogger = helpers.NewDistinctErrorLogger() var distinctErrorLogger = helpers.NewDistinctErrorLogger()
@ -395,12 +394,12 @@ func (s *Site) Running() bool {
} }
func init() { func init() {
DefaultTimer = nitro.Initalize() defaultTimer = nitro.Initalize()
} }
func (s *Site) timerStep(step string) { func (s *Site) timerStep(step string) {
if s.timer == nil { if s.timer == nil {
s.timer = DefaultTimer s.timer = defaultTimer
} }
s.timer.Step(step) s.timer.Step(step)
} }
@ -592,9 +591,9 @@ func (s *Site) ReBuild(events []fsnotify.Event) error {
} }
return nil return nil
} else {
return err
} }
return err
} }
func (s *Site) Analyze() error { func (s *Site) Analyze() error {
@ -1885,6 +1884,8 @@ func (s *Site) RenderRobotsTXT() error {
return err return err
} }
// Stats prints Hugo builds stats to the console.
// This is what you see after a successful hugo build.
func (s *Site) Stats() { func (s *Site) Stats() {
jww.FEEDBACK.Println(s.draftStats()) jww.FEEDBACK.Println(s.draftStats())
jww.FEEDBACK.Println(s.futureStats()) jww.FEEDBACK.Println(s.futureStats())
@ -2064,11 +2065,6 @@ func (s *Site) renderThing(d interface{}, layout string, w io.Writer) error {
} }
func (s *Site) NewXMLBuffer() *bytes.Buffer {
header := "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n"
return bytes.NewBufferString(header)
}
func (s *Site) pageTarget() target.Output { func (s *Site) pageTarget() target.Output {
s.initTargetList() s.initTargetList()
return s.targets.page return s.targets.page