hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit d1364ffb684a2a7d26a71027f1464a052405fd01
parent f264076f669ccb696e052d1707e87ea7917017ca
Author: Naoya Inada <naoina@kuune.org>
Date:   Sun,  1 Feb 2015 02:24:00 +0900

Fix defaults for Blackfriday

Diffstat:
Mcommands/hugo.go | 2+-
Mhelpers/content.go | 15+++++++++++----
Mhugolib/page.go | 2+-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/commands/hugo.go b/commands/hugo.go
@@ -138,7 +138,7 @@ func InitializeConfig() {
 	viper.SetDefault("NewContentEditor", "")
 	viper.SetDefault("Paginate", 10)
 	viper.SetDefault("PaginatePath", "page")
-	viper.SetDefault("Blackfriday", new(helpers.Blackfriday))
+	viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
 
 	if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
 		viper.Set("BuildDrafts", Draft)
diff --git a/helpers/content.go b/helpers/content.go
@@ -44,6 +44,14 @@ type Blackfriday struct {
 	Extensions     []string
 }
 
+func NewBlackfriday() *Blackfriday {
+	return &Blackfriday{
+		AngledQuotes:   false,
+		Fractions:      true,
+		PlainIdAnchors: false,
+	}
+}
+
 var blackfridayExtensionMap = map[string]int{
 	"noIntraEmphasis":        blackfriday.EXTENSION_NO_INTRA_EMPHASIS,
 	"tables":                 blackfriday.EXTENSION_TABLES,
@@ -120,7 +128,6 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
 	htmlFlags := defaultFlags
 	htmlFlags |= blackfriday.HTML_USE_XHTML
 	htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
-	htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
 	htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
 	htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
 
@@ -128,8 +135,8 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
 		htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
 	}
 
-	if !ctx.getConfig().Fractions {
-		htmlFlags &^= blackfriday.HTML_SMARTYPANTS_FRACTIONS
+	if ctx.getConfig().Fractions {
+		htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
 	}
 
 	return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
@@ -207,7 +214,7 @@ type RenderingContext struct {
 func (c *RenderingContext) getConfig() *Blackfriday {
 	c.configInit.Do(func() {
 		if c.Config == nil {
-			c.Config = new(Blackfriday)
+			c.Config = NewBlackfriday()
 		}
 	})
 	return c.Config
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -211,7 +211,7 @@ func (p *Page) getRenderingConfig() *helpers.Blackfriday {
 				combinedParam[key] = value
 			}
 		}
-		p.renderingConfig = new(helpers.Blackfriday)
+		p.renderingConfig = helpers.NewBlackfriday()
 		if err := mapstructure.Decode(combinedParam, p.renderingConfig); err != nil {
 			jww.FATAL.Printf("Failed to get rendering config for %s:\n%s", p.BaseFileName(), err.Error())
 		}