diff options
author | Chase Adams <realchaseadams@gmail.com> | 2017-02-20 23:46:03 -0800 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-02-21 08:46:03 +0100 |
commit | 86e8dd62f0b1c8adf14e9369b089d209317aaf2d (patch) | |
tree | abd50df60bd2486cf71268bd15aacd24ccec3a78 /helpers/content.go | |
parent | a3af4fe46e1e1d184538a83bc8375154a9669316 (diff) |
all: Add org-mode support
Fixes #1483
See #936
Diffstat (limited to 'helpers/content.go')
-rw-r--r-- | helpers/content.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/helpers/content.go b/helpers/content.go index 0eb687af6..7b529304d 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -24,12 +24,12 @@ import ( "unicode" "unicode/utf8" - "github.com/spf13/hugo/config" - + "github.com/chaseadamsio/goorgeous" "github.com/miekg/mmark" "github.com/mitchellh/mapstructure" "github.com/russross/blackfriday" bp "github.com/spf13/hugo/bufferpool" + "github.com/spf13/hugo/config" jww "github.com/spf13/jwalterweatherman" "strings" @@ -415,6 +415,8 @@ func (c ContentSpec) RenderBytes(ctx *RenderingContext) []byte { return c.mmarkRender(ctx) case "rst": return getRstContent(ctx) + case "org": + return orgRender(ctx, c) } } @@ -663,3 +665,10 @@ func getRstContent(ctx *RenderingContext) []byte { return result[bodyStart+7 : bodyEnd] } + +func orgRender(ctx *RenderingContext, c ContentSpec) []byte { + content := ctx.Content + cleanContent := bytes.Replace(content, []byte("# more"), []byte(""), 1) + return goorgeous.Org(cleanContent, + c.getHTMLRenderer(blackfriday.HTML_TOC, ctx)) +} |