// better handling of dates in formats that don't have support for them
if mark == parser.FormatToLeadRune("json") || mark == parser.FormatToLeadRune("yaml") || mark == parser.FormatToLeadRune("toml") {
- newmetadata := cast.ToStringMap(metadata)
- for k, v := range newmetadata {
+ newMetadata := cast.ToStringMap(metadata)
+ for k, v := range newMetadata {
switch vv := v.(type) {
case time.Time:
- newmetadata[k] = vv.Format(time.RFC3339)
+ newMetadata[k] = vv.Format(time.RFC3339)
}
}
- metadata = newmetadata
+ metadata = newMetadata
}
page.SetDir(filepath.Join(contentDir, file.Dir()))
// See the License for the specific language governing permissions and
// limitations under the License.
-// Package helpers implements general utility functions that work with
-// and on content. The helper functions defined here lay down the
-// foundation of how Hugo works with files and filepaths, and perform
-// string operations on content.
package config
// Provider provides the configuration settings for Hugo.
translationProvider ResourceProvider
}
-// Used to create and refresh, and clone resources needed.
+// ResourceProvider is used to create and refresh, and clone resources needed.
type ResourceProvider interface {
Update(deps *Deps) error
Clone(deps *Deps) error
return newFs(fs, cfg)
}
-// NewDefault creates a new Fs with the MemMapFs
+// NewMem creates a new Fs with the MemMapFs
// as source and destination file systems.
// Useful for testing.
func NewMem(cfg config.Provider) *Fs {
var newPages Pages
for _, s := range h.Sites {
-
if s.isEnabled(KindHome) {
// home pages
home := s.findPagesByKind(KindHome)
type Pages []*Page
-func (p Pages) String() string {
- return fmt.Sprintf("Pages(%d)", len(p))
+func (ps Pages) String() string {
+ return fmt.Sprintf("Pages(%d)", len(ps))
}
func (ps Pages) FindPagePosByFilePath(inPath string) int {
for i, c := range pagesParamsTemplate {
p, err := s.NewPageFrom(strings.NewReader(c), "content/post/params.md")
require.NoError(t, err, "err during parse", "#%d", i)
- for key, _ := range wantedMap {
+ for key := range wantedMap {
assert.Equal(t, wantedMap[key], p.Params[key], "#%d", key)
}
}
// reBuild partially rebuilds a site given the filesystem events.
// It returns whetever the content source was changed.
func (s *Site) reProcess(events []fsnotify.Event) (whatChanged, error) {
-
s.Log.DEBUG.Printf("Rebuild for events %q", events)
s.timerStep("initialize rebuild")
if err != nil {
return nil
}
+
t.Log.DEBUG.Println("Template path", path)
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
link, err := filepath.EvalSymlinks(absPath)
t.Log.ERROR.Printf("Cannot read symbolic link '%s', error was: %s", absPath, err)
return nil
}
+
linkfi, err := t.Fs.Source.Stat(link)
if err != nil {
t.Log.ERROR.Printf("Cannot stat '%s', error was: %s", link, err)
return nil
}
+
if !linkfi.Mode().IsRegular() {
t.Log.ERROR.Printf("Symbolic links for directories not supported, skipping '%s'", absPath)
}