hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit b23b546a30df792ad2c8f0cf3ec1be30c53ba34d
parent 43891e39947ee30d6667ad4f8154b8c3d93fdd09
Author: Baptiste Mathus <batmat@batmat.net>
Date:   Wed, 29 Jul 2015 16:11:59 +0200

Asciidoc[tor]: use --no-header-footer option

This simplifies the retrieval of the HTML (no more need to extract the
part within body) and also removes the unwanted "Last Updated" part in
the article.

Diffstat:
Mhelpers/content.go | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/helpers/content.go b/helpers/content.go
@@ -414,7 +414,7 @@ func GetAsciidocContent(content []byte) string {
 	}
 
 	jww.INFO.Println("Rendering with", path, "...")
-	cmd := exec.Command(path, "--safe", "-")
+	cmd := exec.Command(path, "--no-header-footer", "--safe", "-")
 	cmd.Stdin = bytes.NewReader(cleanContent)
 	var out bytes.Buffer
 	cmd.Stdout = &out
@@ -422,13 +422,7 @@ func GetAsciidocContent(content []byte) string {
 		jww.ERROR.Println(err)
 	}
 
-	asciidocLines := strings.Split(out.String(), "\n")
-	for i, line := range asciidocLines {
-		if strings.HasPrefix(line, "<body") {
-			asciidocLines = (asciidocLines[i+1 : len(asciidocLines)-3])
-		}
-	}
-	return strings.Join(asciidocLines, "\n")
+	return out.String()
 }
 
 // GetRstContent calls the Python script rst2html as an external helper