hugolib: Fix possible .Content cut

There have been one report of a site with truncated `.Content` after the Hugo `0.40.1` release.

This commit fixes this so that race should not be possible anymore. It also adds a stress test with focus on content rendering and multiple output formats.

Fixes #4706
This commit is contained in:
Bjørn Erik Pedersen
2018-05-08 10:10:13 +02:00
parent c2bb62d63e
commit 086ae81a98
8 changed files with 191 additions and 56 deletions

View File

@@ -559,14 +559,22 @@ func (h *HugoSites) setupTranslations() {
}
}
func (s *Site) preparePagesForRender(start bool) {
func (s *Site) preparePagesForRender(start bool) error {
for _, p := range s.Pages {
p.setContentInit(start)
if err := p.initMainOutputFormat(); err != nil {
return err
}
}
for _, p := range s.headlessPages {
p.setContentInit(start)
if err := p.initMainOutputFormat(); err != nil {
return err
}
}
return nil
}
// Pages returns all pages for all sites.