mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
helpers: Use pointer receiver for ContentSpec
This commit is contained in:
@@ -354,7 +354,7 @@ func getMarkdownExtensions(ctx *RenderingContext) int {
|
|||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ContentSpec) markdownRender(ctx *RenderingContext) []byte {
|
func (c *ContentSpec) markdownRender(ctx *RenderingContext) []byte {
|
||||||
if ctx.RenderTOC {
|
if ctx.RenderTOC {
|
||||||
return blackfriday.Markdown(ctx.Content,
|
return blackfriday.Markdown(ctx.Content,
|
||||||
c.getHTMLRenderer(blackfriday.HTML_TOC, ctx),
|
c.getHTMLRenderer(blackfriday.HTML_TOC, ctx),
|
||||||
@@ -420,7 +420,7 @@ func getMmarkExtensions(ctx *RenderingContext) int {
|
|||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ContentSpec) mmarkRender(ctx *RenderingContext) []byte {
|
func (c *ContentSpec) mmarkRender(ctx *RenderingContext) []byte {
|
||||||
return mmark.Parse(ctx.Content, c.getMmarkHTMLRenderer(0, ctx),
|
return mmark.Parse(ctx.Content, c.getMmarkHTMLRenderer(0, ctx),
|
||||||
getMmarkExtensions(ctx)).Bytes()
|
getMmarkExtensions(ctx)).Bytes()
|
||||||
}
|
}
|
||||||
@@ -479,7 +479,7 @@ type RenderingContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RenderBytes renders a []byte.
|
// RenderBytes renders a []byte.
|
||||||
func (c ContentSpec) RenderBytes(ctx *RenderingContext) []byte {
|
func (c *ContentSpec) RenderBytes(ctx *RenderingContext) []byte {
|
||||||
switch ctx.PageFmt {
|
switch ctx.PageFmt {
|
||||||
default:
|
default:
|
||||||
return c.markdownRender(ctx)
|
return c.markdownRender(ctx)
|
||||||
@@ -752,7 +752,7 @@ func getPandocContent(ctx *RenderingContext) []byte {
|
|||||||
return externallyRenderContent(ctx, path, args)
|
return externallyRenderContent(ctx, path, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgRender(ctx *RenderingContext, c ContentSpec) []byte {
|
func orgRender(ctx *RenderingContext, c *ContentSpec) []byte {
|
||||||
config := org.New()
|
config := org.New()
|
||||||
config.Log = jww.WARN
|
config.Log = jww.WARN
|
||||||
config.ReadFile = func(filename string) ([]byte, error) {
|
config.ReadFile = func(filename string) ([]byte, error) {
|
||||||
|
@@ -23,7 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Renders a codeblock using Blackfriday
|
// Renders a codeblock using Blackfriday
|
||||||
func (c ContentSpec) render(input string) string {
|
func (c *ContentSpec) render(input string) string {
|
||||||
ctx := &RenderingContext{Cfg: c.Cfg, Config: c.BlackFriday}
|
ctx := &RenderingContext{Cfg: c.Cfg, Config: c.BlackFriday}
|
||||||
render := c.getHTMLRenderer(0, ctx)
|
render := c.getHTMLRenderer(0, ctx)
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ func (c ContentSpec) render(input string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Renders a codeblock using Mmark
|
// Renders a codeblock using Mmark
|
||||||
func (c ContentSpec) renderWithMmark(input string) string {
|
func (c *ContentSpec) renderWithMmark(input string) string {
|
||||||
ctx := &RenderingContext{Cfg: c.Cfg, Config: c.BlackFriday}
|
ctx := &RenderingContext{Cfg: c.Cfg, Config: c.BlackFriday}
|
||||||
render := c.getMmarkHTMLRenderer(0, ctx)
|
render := c.getMmarkHTMLRenderer(0, ctx)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user