Skip to content

Commit

Permalink
helpers: Use pointer receiver for ContentSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Nov 4, 2019
1 parent ad4c56b commit 9abd396
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions helpers/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func getMarkdownExtensions(ctx *RenderingContext) int {
return flags
}

func (c ContentSpec) markdownRender(ctx *RenderingContext) []byte {
func (c *ContentSpec) markdownRender(ctx *RenderingContext) []byte {
if ctx.RenderTOC {
return blackfriday.Markdown(ctx.Content,
c.getHTMLRenderer(blackfriday.HTML_TOC, ctx),
Expand Down Expand Up @@ -420,7 +420,7 @@ func getMmarkExtensions(ctx *RenderingContext) int {
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),
getMmarkExtensions(ctx)).Bytes()
}
Expand Down Expand Up @@ -479,7 +479,7 @@ type RenderingContext struct {
}

// RenderBytes renders a []byte.
func (c ContentSpec) RenderBytes(ctx *RenderingContext) []byte {
func (c *ContentSpec) RenderBytes(ctx *RenderingContext) []byte {
switch ctx.PageFmt {
default:
return c.markdownRender(ctx)
Expand Down Expand Up @@ -752,7 +752,7 @@ func getPandocContent(ctx *RenderingContext) []byte {
return externallyRenderContent(ctx, path, args)
}

func orgRender(ctx *RenderingContext, c ContentSpec) []byte {
func orgRender(ctx *RenderingContext, c *ContentSpec) []byte {
config := org.New()
config.Log = jww.WARN
config.ReadFile = func(filename string) ([]byte, error) {
Expand Down
4 changes: 2 additions & 2 deletions helpers/content_renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

// 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}
render := c.getHTMLRenderer(0, ctx)

Expand All @@ -33,7 +33,7 @@ func (c ContentSpec) render(input string) string {
}

// 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}
render := c.getMmarkHTMLRenderer(0, ctx)

Expand Down

0 comments on commit 9abd396

Please sign in to comment.