summaryrefslogtreecommitdiffhomepage
path: root/helpers
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-08-02 21:37:03 +0200
committerBjørn Erik Pedersen <[email protected]>2017-08-02 22:04:38 +0200
commit9891c0fb0eb274b8a95b62c40070a87a6e04088c (patch)
tree16c12115fceda9ef39e43dc3f7c6eee5965dc840 /helpers
parent481924b34d23b0ce435778cce7bce77571b22f9d (diff)
downloadhugo-9891c0fb0eb274b8a95b62c40070a87a6e04088c.tar.gz
hugo-9891c0fb0eb274b8a95b62c40070a87a6e04088c.zip
Remove sourceRelativeLinks
Fixes #3766
Diffstat (limited to 'helpers')
-rw-r--r--helpers/content.go53
-rw-r--r--helpers/content_renderer.go30
-rw-r--r--helpers/content_test.go1
3 files changed, 20 insertions, 64 deletions
diff --git a/helpers/content.go b/helpers/content.go
index d84fe27a8..4c053a84d 100644
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -62,35 +62,31 @@ func NewContentSpec(cfg config.Provider) *ContentSpec {
// Blackfriday holds configuration values for Blackfriday rendering.
type Blackfriday struct {
- Smartypants bool
- SmartypantsQuotesNBSP bool
- AngledQuotes bool
- Fractions bool
- HrefTargetBlank bool
- SmartDashes bool
- LatexDashes bool
- TaskLists bool
- PlainIDAnchors bool
- SourceRelativeLinksEval bool
- SourceRelativeLinksProjectFolder string
- Extensions []string
- ExtensionsMask []string
+ Smartypants bool
+ SmartypantsQuotesNBSP bool
+ AngledQuotes bool
+ Fractions bool
+ HrefTargetBlank bool
+ SmartDashes bool
+ LatexDashes bool
+ TaskLists bool
+ PlainIDAnchors bool
+ Extensions []string
+ ExtensionsMask []string
}
// NewBlackfriday creates a new Blackfriday filled with site config or some sane defaults.
func (c ContentSpec) NewBlackfriday() *Blackfriday {
defaultParam := map[string]interface{}{
- "smartypants": true,
- "angledQuotes": false,
- "smartypantsQuotesNBSP": false,
- "fractions": true,
- "hrefTargetBlank": false,
- "smartDashes": true,
- "latexDashes": true,
- "plainIDAnchors": true,
- "taskLists": true,
- "sourceRelativeLinks": false,
- "sourceRelativeLinksProjectFolder": "/docs/content",
+ "smartypants": true,
+ "angledQuotes": false,
+ "smartypantsQuotesNBSP": false,
+ "fractions": true,
+ "hrefTargetBlank": false,
+ "smartDashes": true,
+ "latexDashes": true,
+ "plainIDAnchors": true,
+ "taskLists": true,
}
ToLowerMap(defaultParam)
@@ -112,13 +108,6 @@ func (c ContentSpec) NewBlackfriday() *Blackfriday {
jww.FATAL.Printf("Failed to get site rendering config\n%s", err.Error())
}
- if combinedConfig.SourceRelativeLinksEval {
- // Remove in Hugo 0.21
- Deprecated("blackfriday", "sourceRelativeLinksEval",
- `There is no replacement for this feature, as no developer has stepped up to the plate and volunteered to maintain this feature`, false)
-
- }
-
return combinedConfig
}
@@ -412,8 +401,6 @@ type RenderingContext struct {
DocumentName string
Config *Blackfriday
RenderTOC bool
- FileResolver FileResolverFunc
- LinkResolver LinkResolverFunc
Cfg config.Provider
}
diff --git a/helpers/content_renderer.go b/helpers/content_renderer.go
index 376351f7a..10d99ec8e 100644
--- a/helpers/content_renderer.go
+++ b/helpers/content_renderer.go
@@ -20,7 +20,6 @@ import (
"github.com/gohugoio/hugo/config"
"github.com/miekg/mmark"
"github.com/russross/blackfriday"
- jww "github.com/spf13/jwalterweatherman"
)
type LinkResolverFunc func(ref string) (string, error)
@@ -43,35 +42,6 @@ func (r *HugoHTMLRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string
}
}
-func (r *HugoHTMLRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
- if r.LinkResolver == nil || bytes.HasPrefix(link, []byte("HAHAHUGOSHORTCODE")) {
- // Use the blackfriday built in Link handler
- r.Renderer.Link(out, link, title, content)
- } else {
- // set by SourceRelativeLinksEval
- newLink, err := r.LinkResolver(string(link))
- if err != nil {
- newLink = string(link)
- jww.ERROR.Printf("LinkResolver: %s", err)
- }
- r.Renderer.Link(out, []byte(newLink), title, content)
- }
-}
-func (r *HugoHTMLRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
- if r.FileResolver == nil || bytes.HasPrefix(link, []byte("HAHAHUGOSHORTCODE")) {
- // Use the blackfriday built in Image handler
- r.Renderer.Image(out, link, title, alt)
- } else {
- // set by SourceRelativeLinksEval
- newLink, err := r.FileResolver(string(link))
- if err != nil {
- newLink = string(link)
- jww.ERROR.Printf("FileResolver: %s", err)
- }
- r.Renderer.Image(out, []byte(newLink), title, alt)
- }
-}
-
// ListItem adds task list support to the Blackfriday renderer.
func (r *HugoHTMLRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) {
if !r.Config.TaskLists {
diff --git a/helpers/content_test.go b/helpers/content_test.go
index e1fe5cebd..b0afb9cbd 100644
--- a/helpers/content_test.go
+++ b/helpers/content_test.go
@@ -188,7 +188,6 @@ func TestGetHTMLRendererAllFlags(t *testing.T) {
ctx.Config.SmartDashes = true
ctx.Config.Smartypants = true
ctx.Config.SmartypantsQuotesNBSP = true
- ctx.Config.SourceRelativeLinksEval = true
renderer := c.getHTMLRenderer(defaultFlags, ctx)
actualFlags := renderer.GetFlags()
var expectedFlags int