Skip to content

Commit

Permalink
helpers: Add smarter check for asciidoctor
Browse files Browse the repository at this point in the history
  • Loading branch information
miltador committed Jul 18, 2017
1 parent 6ceb0b4 commit 5a9eba1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions helpers/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func getAsciidocContent(ctx *RenderingContext) []byte {
var isAsciidoctor bool
path := getAsciidocExecPath()
if path == "" {
path := getAsciidoctorExecPath()
path = getAsciidoctorExecPath()
if path == "" {
jww.ERROR.Println("asciidoctor / asciidoc not found in $PATH: Please install.\n",
" Leaving AsciiDoc content unrendered.")
Expand All @@ -588,12 +588,13 @@ func getAsciidocContent(ctx *RenderingContext) []byte {
}

jww.INFO.Println("Rendering", ctx.DocumentName, "with", path, "...")
cmd := exec.Command(path, "--no-header-footer", "--safe")
args := []string{"--no-header-footer", "--safe"}
if isAsciidoctor {
// asciidoctor-specific arg to show stack traces on errors
cmd.Args = append(cmd.Args, "--trace")
args = append(args, "--trace")
}
cmd.Args = append(cmd.Args, "-")
args = append(args, "-")
cmd := exec.Command(path, args...)
cmd.Stdin = bytes.NewReader(cleanContent)
var out, cmderr bytes.Buffer
cmd.Stdout = &out
Expand Down Expand Up @@ -692,7 +693,7 @@ func getRstContent(ctx *RenderingContext) []byte {
}
}

return result[bodyStart+7: bodyEnd]
return result[bodyStart+7 : bodyEnd]
}

func orgRender(ctx *RenderingContext, c ContentSpec) []byte {
Expand Down

0 comments on commit 5a9eba1

Please sign in to comment.