helpers: Apply GoLint rules

This commit is contained in:
digitalcraftsman 2016-03-24 23:16:18 +01:00
parent 7fa2cec906
commit 5d3705df16
5 changed files with 18 additions and 18 deletions

View file

@ -200,7 +200,7 @@ func getHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
}
return &HugoHtmlRenderer{
return &HugoHTMLRenderer{
FileResolver: ctx.FileResolver,
LinkResolver: ctx.LinkResolver,
Renderer: blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters),
@ -266,7 +266,7 @@ func getMmarkHTMLRenderer(defaultFlags int, ctx *RenderingContext) mmark.Rendere
htmlFlags := defaultFlags
htmlFlags |= mmark.HTML_FOOTNOTE_RETURN_LINKS
return &HugoMmarkHtmlRenderer{
return &HugoMmarkHTMLRenderer{
mmark.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters),
}
}

View file

@ -26,15 +26,15 @@ import (
type LinkResolverFunc func(ref string) (string, error)
type FileResolverFunc func(ref string) (string, error)
// Wraps a blackfriday.Renderer, typically a blackfriday.Html
// HugoHTMLRenderer wraps a blackfriday.Renderer, typically a blackfriday.Html
// Enabling Hugo to customise the rendering experience
type HugoHtmlRenderer struct {
type HugoHTMLRenderer struct {
FileResolver FileResolverFunc
LinkResolver LinkResolverFunc
blackfriday.Renderer
}
func (renderer *HugoHtmlRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
func (renderer *HugoHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
if viper.GetBool("PygmentsCodeFences") {
opts := viper.GetString("PygmentsOptions")
str := html.UnescapeString(string(text))
@ -44,7 +44,7 @@ func (renderer *HugoHtmlRenderer) BlockCode(out *bytes.Buffer, text []byte, lang
}
}
func (renderer *HugoHtmlRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
func (renderer *HugoHTMLRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
if renderer.LinkResolver == nil || bytes.HasPrefix(link, []byte("{#{#HUGOSHORTCODE")) {
// Use the blackfriday built in Link handler
renderer.Renderer.Link(out, link, title, content)
@ -57,7 +57,7 @@ func (renderer *HugoHtmlRenderer) Link(out *bytes.Buffer, link []byte, title []b
renderer.Renderer.Link(out, []byte(newLink), title, content)
}
}
func (renderer *HugoHtmlRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
func (renderer *HugoHTMLRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
if renderer.FileResolver == nil || bytes.HasPrefix(link, []byte("{#{#HUGOSHORTCODE")) {
// Use the blackfriday built in Image handler
renderer.Renderer.Image(out, link, title, alt)
@ -71,13 +71,13 @@ func (renderer *HugoHtmlRenderer) Image(out *bytes.Buffer, link []byte, title []
}
}
// Wraps a mmark.Renderer, typically a mmark.html
// HugoMmarkHTMLRenderer wraps a mmark.Renderer, typically a mmark.html
// Enabling Hugo to customise the rendering experience
type HugoMmarkHtmlRenderer struct {
type HugoMmarkHTMLRenderer struct {
mmark.Renderer
}
func (renderer *HugoMmarkHtmlRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string, caption []byte, subfigure bool, callouts bool) {
func (renderer *HugoMmarkHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string, caption []byte, subfigure bool, callouts bool) {
if viper.GetBool("PygmentsCodeFences") {
str := html.UnescapeString(string(text))
out.WriteString(Highlight(str, lang, ""))

View file

@ -103,7 +103,7 @@ func doBenchmarkEmoji(b *testing.B, f func(in []byte) []byte) {
{"No smiles for you or " + strings.Repeat("you ", 1000), "No smiles for you or " + strings.Repeat("you ", 1000)},
}
var in []input = make([]input, b.N*len(data))
var in = make([]input, b.N*len(data))
var cnt = 0
for i := 0; i < b.N; i++ {
for _, this := range data {

View file

@ -17,12 +17,12 @@ import (
"fmt"
)
// The Hugo version number.
// HugoVersionNumber represents the current build version.
// This should be the only one
const HugoVersionNumber = 0.16
// This is the suffix used in the Hugo version string.
// This will be blank for release versions.
// HugoVersionSuffix is the suffix used in the Hugo version string.
// It will be blank for release versions.
const HugoVersionSuffix = "-DEV" // blank this when doing a release
// HugoVersion returns the current Hugo version. It will include

View file

@ -97,7 +97,7 @@ func SanitizeURLKeepTrailingSlash(in string) string {
return sanitizeURLWithFlags(in, purell.FlagsSafe|purell.FlagRemoveDotSegments|purell.FlagRemoveDuplicateSlashes|purell.FlagRemoveUnnecessaryHostDots|purell.FlagRemoveEmptyPortSeparator)
}
// Similar to MakePath, but with Unicode handling
// URLize is similar to MakePath, but with Unicode handling
// Example:
// uri: Vim (text editor)
// urlize: vim-text-editor
@ -105,16 +105,16 @@ func URLize(uri string) string {
sanitized := MakePathSanitized(uri)
// escape unicode letters
parsedUri, err := url.Parse(sanitized)
parsedURI, err := url.Parse(sanitized)
if err != nil {
// if net/url can not parse URL it's meaning Sanitize works incorrect
panic(err)
}
x := parsedUri.String()
x := parsedURI.String()
return x
}
// Combines base URL with content path to create full URL paths.
// MakePermalink combines base URL with content path to create full URL paths.
// Example
// base: http://spf13.com/
// path: post/how-i-blog