mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-30 01:23:34 -05:00
Remove []byte to string to []byte conversion in Asciidoc
This commit is contained in:
parent
1d7f4413f5
commit
ed5ad12af3
1 changed files with 4 additions and 4 deletions
|
@ -367,7 +367,7 @@ func RenderBytes(ctx *RenderingContext) []byte {
|
||||||
case "markdown":
|
case "markdown":
|
||||||
return markdownRender(ctx)
|
return markdownRender(ctx)
|
||||||
case "asciidoc":
|
case "asciidoc":
|
||||||
return []byte(getAsciidocContent(ctx.Content))
|
return getAsciidocContent(ctx.Content)
|
||||||
case "mmark":
|
case "mmark":
|
||||||
return mmarkRender(ctx)
|
return mmarkRender(ctx)
|
||||||
case "rst":
|
case "rst":
|
||||||
|
@ -460,14 +460,14 @@ func HasAsciidoc() bool {
|
||||||
|
|
||||||
// getAsciidocContent calls asciidoctor or asciidoc as an external helper
|
// getAsciidocContent calls asciidoctor or asciidoc as an external helper
|
||||||
// to convert AsciiDoc content to HTML.
|
// to convert AsciiDoc content to HTML.
|
||||||
func getAsciidocContent(content []byte) string {
|
func getAsciidocContent(content []byte) []byte {
|
||||||
cleanContent := bytes.Replace(content, SummaryDivider, []byte(""), 1)
|
cleanContent := bytes.Replace(content, SummaryDivider, []byte(""), 1)
|
||||||
|
|
||||||
path := getAsciidocExecPath()
|
path := getAsciidocExecPath()
|
||||||
if path == "" {
|
if path == "" {
|
||||||
jww.ERROR.Println("asciidoctor / asciidoc not found in $PATH: Please install.\n",
|
jww.ERROR.Println("asciidoctor / asciidoc not found in $PATH: Please install.\n",
|
||||||
" Leaving AsciiDoc content unrendered.")
|
" Leaving AsciiDoc content unrendered.")
|
||||||
return (string(content))
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
jww.INFO.Println("Rendering with", path, "...")
|
jww.INFO.Println("Rendering with", path, "...")
|
||||||
|
@ -479,7 +479,7 @@ func getAsciidocContent(content []byte) string {
|
||||||
jww.ERROR.Println(err)
|
jww.ERROR.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return out.String()
|
return out.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasRst returns whether rst2html is installed on this computer.
|
// HasRst returns whether rst2html is installed on this computer.
|
||||||
|
|
Loading…
Reference in a new issue