Make Blackfriday smart fractions to really default to true

Fix my own bug in Pull Request #829,
commit eb686352b1
This commit is contained in:
Anthony Fok 2015-01-24 13:49:17 -07:00 committed by bep
parent eb686352b1
commit f6c0b472e9

View file

@ -95,10 +95,11 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
htmlFlags := defaultFlags htmlFlags := defaultFlags
htmlFlags |= blackfriday.HTML_USE_XHTML htmlFlags |= blackfriday.HTML_USE_XHTML
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
var angledQuotes, fractions bool var angledQuotes bool
if m, ok := ctx.ConfigFlags["angledQuotes"]; ok { if m, ok := ctx.ConfigFlags["angledQuotes"]; ok {
angledQuotes = m angledQuotes = m
@ -108,12 +109,8 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
} }
if m, ok := ctx.ConfigFlags["fractions"]; ok { if m, ok := ctx.ConfigFlags["fractions"]; ok && !m {
fractions = m htmlFlags &^= blackfriday.HTML_SMARTYPANTS_FRACTIONS
}
if fractions {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
} }
return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters) return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)