From 39c9ae3108fa1a36f0e2581e6235058ebdea6137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 12 Apr 2016 18:11:24 +0200 Subject: Revert "Use Node.ID for anchor ID" This reverts commit cd558958a0c0ecd06f7560a38e27334fe983e0de. --- helpers/content.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'helpers/content.go') diff --git a/helpers/content.go b/helpers/content.go index 3ac91b360..f60349055 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -23,10 +23,6 @@ import ( "os/exec" "unicode/utf8" - "fmt" - "strings" - "sync" - "github.com/miekg/mmark" "github.com/mitchellh/mapstructure" "github.com/russross/blackfriday" @@ -34,6 +30,9 @@ import ( bp "github.com/spf13/hugo/bufferpool" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/viper" + + "strings" + "sync" ) // SummaryLength is the length of the summary that Hugo extracts from a content. @@ -168,11 +167,11 @@ func getHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"), } - b := ctx.DocumentID != 0 + b := len(ctx.DocumentID) != 0 if b && !ctx.getConfig().PlainIDAnchors { - renderParameters.FootnoteAnchorPrefix = fmt.Sprintf("%d:%s", ctx.DocumentID, renderParameters.FootnoteAnchorPrefix) - renderParameters.HeaderIDSuffix = fmt.Sprintf(":%d", ctx.DocumentID) + renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix + renderParameters.HeaderIDSuffix = ":" + ctx.DocumentID } htmlFlags := defaultFlags @@ -259,10 +258,10 @@ func getMmarkHTMLRenderer(defaultFlags int, ctx *RenderingContext) mmark.Rendere FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"), } - b := ctx.DocumentID != 0 + b := len(ctx.DocumentID) != 0 if b && !ctx.getConfig().PlainIDAnchors { - renderParameters.FootnoteAnchorPrefix = fmt.Sprintf("%d:%s", ctx.DocumentID, renderParameters.FootnoteAnchorPrefix) + renderParameters.FootnoteAnchorPrefix = ctx.DocumentID + ":" + renderParameters.FootnoteAnchorPrefix // renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId } @@ -344,7 +343,7 @@ func ExtractTOC(content []byte) (newcontent []byte, toc []byte) { type RenderingContext struct { Content []byte PageFmt string - DocumentID int + DocumentID string Config *Blackfriday FileResolver FileResolverFunc LinkResolver LinkResolverFunc -- cgit v1.2.3