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.
This commit is contained in:
Baptiste Mathus 2015-07-29 16:11:59 +02:00 committed by Bjørn Erik Pedersen
parent 43891e3994
commit b23b546a30

View file

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