Group both options under Blackfriday: documentIDAnchor
authorJacob Gillespie <jacobwgillespie@gmail.com>
Mon, 5 Jan 2015 18:18:34 +0000 (12:18 -0600)
committerbep <bjorn.erik.pedersen@gmail.com>
Mon, 5 Jan 2015 20:00:22 +0000 (21:00 +0100)
commands/hugo.go
helpers/content.go

index 6cb153e1bc73db6be2c1f4c4897a8b306abeaa71..e04a8a0d152d35d061bee7301d9bfab5fae3a685 100644 (file)
@@ -123,8 +123,6 @@ func InitializeConfig() {
        viper.SetDefault("BuildDrafts", false)
        viper.SetDefault("BuildFuture", false)
        viper.SetDefault("UglyUrls", false)
-       viper.SetDefault("DisableFootnoteAnchorPrefix", false)
-       viper.SetDefault("DisableHeaderIDSuffix", false)
        viper.SetDefault("Verbose", false)
        viper.SetDefault("CanonifyUrls", false)
        viper.SetDefault("Indexes", map[string]string{"tag": "tags", "category": "categories"})
@@ -138,7 +136,7 @@ func InitializeConfig() {
        viper.SetDefault("FootnoteAnchorPrefix", "")
        viper.SetDefault("FootnoteReturnLinkContents", "")
        viper.SetDefault("NewContentEditor", "")
-       viper.SetDefault("Blackfriday", map[string]bool{"angledQuotes": false})
+       viper.SetDefault("Blackfriday", map[string]bool{"angledQuotes": false, "documentIDAnchor": true})
 
        if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
                viper.Set("BuildDrafts", Draft)
index baccc8574efadbe78928b98df49b9a5d61f304e4..8770c88e7b6ec4259a345c0594372975f2b65058 100644 (file)
@@ -85,11 +85,8 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
                FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
        }
 
-       if len(ctx.DocumentId) != 0 && !viper.GetBool("DisableFootnoteAnchorPrefix") {
+       if m, ok := ctx.ConfigFlags["documentIDAnchor"]; ok && m && len(ctx.DocumentId) != 0 {
                renderParameters.FootnoteAnchorPrefix = ctx.DocumentId + ":" + renderParameters.FootnoteAnchorPrefix
-       }
-
-       if len(ctx.DocumentId) != 0 && !viper.GetBool("DisableHeaderIDSuffix") {
                renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId
        }