mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
Correct initialisms as suggested by golint
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
This commit is contained in:
@@ -41,7 +41,7 @@ var SummaryDivider = []byte("<!--more-->")
|
||||
type Blackfriday struct {
|
||||
AngledQuotes bool
|
||||
Fractions bool
|
||||
PlainIdAnchors bool
|
||||
PlainIDAnchors bool
|
||||
Extensions []string
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func NewBlackfriday() *Blackfriday {
|
||||
return &Blackfriday{
|
||||
AngledQuotes: false,
|
||||
Fractions: true,
|
||||
PlainIdAnchors: false,
|
||||
PlainIDAnchors: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,17 +113,17 @@ func BytesToHTML(b []byte) template.HTML {
|
||||
}
|
||||
|
||||
// GetHtmlRenderer creates a new Renderer with the given configuration.
|
||||
func GetHtmlRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
|
||||
func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
|
||||
renderParameters := blackfriday.HtmlRendererParameters{
|
||||
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
|
||||
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
|
||||
}
|
||||
|
||||
b := len(ctx.DocumentId) != 0
|
||||
b := len(ctx.DocumentID) != 0
|
||||
|
||||
if b && !ctx.getConfig().PlainIdAnchors {
|
||||
renderParameters.FootnoteAnchorPrefix = ctx.DocumentId + ":" + renderParameters.FootnoteAnchorPrefix
|
||||
renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId
|
||||
if b && !ctx.getConfig().PlainIDAnchors {
|
||||
renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix
|
||||
renderParameters.HeaderIDSuffix = ":" + ctx.DocumentID
|
||||
}
|
||||
|
||||
htmlFlags := defaultFlags
|
||||
@@ -158,13 +158,13 @@ func getMarkdownExtensions(ctx *RenderingContext) int {
|
||||
}
|
||||
|
||||
func markdownRender(ctx *RenderingContext) []byte {
|
||||
return blackfriday.Markdown(ctx.Content, GetHtmlRenderer(0, ctx),
|
||||
return blackfriday.Markdown(ctx.Content, GetHTMLRenderer(0, ctx),
|
||||
getMarkdownExtensions(ctx))
|
||||
}
|
||||
|
||||
func markdownRenderWithTOC(ctx *RenderingContext) []byte {
|
||||
return blackfriday.Markdown(ctx.Content,
|
||||
GetHtmlRenderer(blackfriday.HTML_TOC, ctx),
|
||||
GetHTMLRenderer(blackfriday.HTML_TOC, ctx),
|
||||
getMarkdownExtensions(ctx))
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func ExtractTOC(content []byte) (newcontent []byte, toc []byte) {
|
||||
type RenderingContext struct {
|
||||
Content []byte
|
||||
PageFmt string
|
||||
DocumentId string
|
||||
DocumentID string
|
||||
Config *Blackfriday
|
||||
configInit sync.Once
|
||||
}
|
||||
|
Reference in New Issue
Block a user