From 4951ff998c69c3216ae42a7178cb953a4368df35 Mon Sep 17 00:00:00 2001 From: tycho garen Date: Tue, 9 Jul 2013 08:16:29 -0400 Subject: [PATCH] rst: fixing rst output processing --- docs/content/doc/rst.rst | 14 -------------- hugolib/page.go | 12 +++++++++--- 2 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 docs/content/doc/rst.rst diff --git a/docs/content/doc/rst.rst b/docs/content/doc/rst.rst deleted file mode 100644 index 37e1357cb..000000000 --- a/docs/content/doc/rst.rst +++ /dev/null @@ -1,14 +0,0 @@ ---- -Markup: 'rst' ---- - - -============== -This is a Test -============== - - -Really ------- - -text *here* and **HERE**. diff --git a/hugolib/page.go b/hugolib/page.go index c21c1c357..01a8545cf 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -409,9 +409,9 @@ func (page *Page) convertMarkdown(lines []string) { func (page *Page) convertRestructuredText(lines []string) { - page.RawMarkdown = strings.Join(lines, " ") + page.RawMarkdown = strings.Join(lines, "\n") - cmd := exec.Command("rst2html.py", "--template=/tmp/template.txt") + cmd := exec.Command("rst2html.py") cmd.Stdin = strings.NewReader(page.RawMarkdown) var out bytes.Buffer cmd.Stdout = &out @@ -419,7 +419,13 @@ func (page *Page) convertRestructuredText(lines []string) { fmt.Println(err) } - content := out.String() + rstLines := strings.Split(out.String(), "\n") + for i, line := range rstLines { + if strings.HasPrefix(line, "") { + rstLines = (rstLines[i+1:len(rstLines)-3]) + } + } + content := strings.Join(rstLines, "\n") page.Content = template.HTML(content) page.Summary = template.HTML(TruncateWordsToWholeSentence(StripHTML(StripShortcodes(content)), summaryLength)) }