mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
Convert the rest to new page parser code paths
And remove some now unused code. See #5324
This commit is contained in:
@@ -36,7 +36,6 @@ import (
|
||||
"github.com/gohugoio/hugo/resource"
|
||||
|
||||
"github.com/gohugoio/hugo/output"
|
||||
"github.com/gohugoio/hugo/parser"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
|
||||
"html/template"
|
||||
@@ -485,6 +484,7 @@ func (p *Page) MediaType() media.Type {
|
||||
return media.OctetType
|
||||
}
|
||||
|
||||
// TODO(bep) 2errors remove
|
||||
type Source struct {
|
||||
Frontmatter []byte
|
||||
Content []byte
|
||||
@@ -1725,36 +1725,6 @@ func (p *Page) SetSourceContent(content []byte) {
|
||||
p.Source.Content = content
|
||||
}
|
||||
|
||||
func (p *Page) SetSourceMetaData(in interface{}, mark rune) (err error) {
|
||||
// See https://github.com/gohugoio/hugo/issues/2458
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
var ok bool
|
||||
err, ok = r.(error)
|
||||
if !ok {
|
||||
err = fmt.Errorf("error from marshal: %v", r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
buf := bp.GetBuffer()
|
||||
defer bp.PutBuffer(buf)
|
||||
|
||||
err = parser.InterfaceToFrontMatter(in, mark, buf)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = buf.WriteRune('\n')
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.Source.Frontmatter = buf.Bytes()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (p *Page) SafeSaveSourceAs(path string) error {
|
||||
return p.saveSourceAs(path, true)
|
||||
}
|
||||
|
Reference in New Issue
Block a user