helpers: Rename getMmarkHtmlRenderer to getMmarkHTMLRenderer

To be consistent with the changes made in commit 67df33f, see #959.
This commit is contained in:
Anthony Fok 2016-03-21 15:16:39 +08:00
parent bec1ac7b33
commit d45b55bdd4
3 changed files with 8 additions and 9 deletions

View file

@ -249,8 +249,8 @@ func markdownRenderWithTOC(ctx *RenderingContext) []byte {
getMarkdownExtensions(ctx))
}
// getMmarkHtmlRenderer returns markdown html renderer.
func getMmarkHtmlRenderer(defaultFlags int, ctx *RenderingContext) mmark.Renderer {
// getMmarkHTMLRenderer creates a new mmark HTML Renderer with the given configuration.
func getMmarkHTMLRenderer(defaultFlags int, ctx *RenderingContext) mmark.Renderer {
renderParameters := mmark.HtmlRendererParameters{
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
@ -271,7 +271,6 @@ func getMmarkHtmlRenderer(defaultFlags int, ctx *RenderingContext) mmark.Rendere
}
}
// getMmarkExtensions returns markdown extensions.
func getMmarkExtensions(ctx *RenderingContext) int {
flags := 0
flags |= mmark.EXTENSION_TABLES
@ -296,9 +295,8 @@ func getMmarkExtensions(ctx *RenderingContext) int {
return flags
}
// mmarkRender renders markdowns.
func mmarkRender(ctx *RenderingContext) []byte {
return mmark.Parse(ctx.Content, getMmarkHtmlRenderer(0, ctx),
return mmark.Parse(ctx.Content, getMmarkHTMLRenderer(0, ctx),
getMmarkExtensions(ctx)).Bytes()
}

View file

@ -15,9 +15,10 @@ package helpers
import (
"bytes"
"github.com/spf13/viper"
"regexp"
"testing"
"github.com/spf13/viper"
)
// Renders a codeblock using Blackfriday
@ -33,7 +34,7 @@ func render(input string) string {
// Renders a codeblock using Mmark
func renderWithMmark(input string) string {
ctx := &RenderingContext{}
render := getMmarkHtmlRenderer(0, ctx)
render := getMmarkHTMLRenderer(0, ctx)
buf := &bytes.Buffer{}
render.BlockCode(buf, []byte(input), "html", []byte(""), false, false)

View file

@ -194,12 +194,12 @@ func TestGetHTMLRendererAnchors(t *testing.T) {
}
}
func TestGetMmarkHtmlRenderer(t *testing.T) {
func TestGetMmarkHTMLRenderer(t *testing.T) {
ctx := &RenderingContext{}
ctx.DocumentID = "testid"
ctx.Config = ctx.getConfig()
ctx.Config.PlainIDAnchors = false
actualRenderer := getMmarkHtmlRenderer(0, ctx)
actualRenderer := getMmarkHTMLRenderer(0, ctx)
headerBuffer := &bytes.Buffer{}
footnoteBuffer := &bytes.Buffer{}