From 9abd396789d007193145db9246d5daf1640bbb8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 4 Nov 2019 10:57:11 +0100 Subject: [PATCH] helpers: Use pointer receiver for ContentSpec --- helpers/content.go | 8 ++++---- helpers/content_renderer_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/helpers/content.go b/helpers/content.go index 591403cb040..fe96ce7d2f7 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -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), @@ -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() } @@ -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) @@ -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) { diff --git a/helpers/content_renderer_test.go b/helpers/content_renderer_test.go index 1a60d6d7097..40acd89e158 100644 --- a/helpers/content_renderer_test.go +++ b/helpers/content_renderer_test.go @@ -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) @@ -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)