mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-12 20:13:59 +02:00
Register rstHandler to restore experimental reST support
(Experimental) reStructuredText support was working in v0.12, but was no longer handled after some refactoring in v0.13-DEV. That experimental support is now restored. Furthermore, check for both rst2html and rst2html.py in the PATH, and execute whichever is found. See #472 for more information.
This commit is contained in:
@@ -252,7 +252,17 @@ func TruncateWordsToWholeSentence(s string, max int) string {
|
||||
func GetRstContent(content []byte) string {
|
||||
cleanContent := bytes.Replace(content, SummaryDivider, []byte(""), 1)
|
||||
|
||||
cmd := exec.Command("rst2html.py", "--leave-comments")
|
||||
path, err := exec.LookPath("rst2html")
|
||||
if err != nil {
|
||||
path, err = exec.LookPath("rst2html.py")
|
||||
if err != nil {
|
||||
jww.ERROR.Println("rst2html / rst2html.py not found in $PATH: Please install.\n",
|
||||
" Leaving reStructuredText content unrendered.")
|
||||
return(string(content))
|
||||
}
|
||||
}
|
||||
|
||||
cmd := exec.Command(path, "--leave-comments")
|
||||
cmd.Stdin = bytes.NewReader(cleanContent)
|
||||
var out bytes.Buffer
|
||||
cmd.Stdout = &out
|
||||
|
Reference in New Issue
Block a user