Execution hangs
The problem is easily reproducible on https://niklasfasching.github.io/go-org/. It's a regression from 1.8.0 to 1.9.0 presumably related to 337f973266484ce9ecde4fc160a2a1a208dd19b7.
Execution hangs when converting this to HTML:
#+TITLE: This is the TITLE
1. This is a sentence.
#+CAPTION: This is the CAPTION
#+NAME: fig:NAME
[[./a.jpg]]
If I remove the NAME keyword it works as expected:
#+TITLE: This is the TITLE
1. This is a sentence.
#+CAPTION: This is the CAPTION
[[./a.jpg]]
test.go
package main
import (
"bytes"
"fmt"
"github.com/niklasfasching/go-org/org"
)
func main() {
s := `
#+TITLE: This is the TITLE
1. This is a sentence.
#+CAPTION: This is the CAPTION
#+NAME: This is the NAME
[[./a.jpg]]
`
config := org.New()
writer := org.NewHTMLWriter()
document := config.Parse(bytes.NewReader([]byte(s)), "")
html, err := document.Write(writer)
if err != nil {
panic(err)
}
fmt.Println(html)
}
I have found another way of breaking it without hanging: If I place two whitespaces after the list element, then it won't hang, but the output will only contain the first list item:
#+TITLE: This is the TITLE
1. Text
#+CAPTION: Caption
#+NAME: fig:my-name
[[./mix-dough.jpg]]
2. More text
Snippet to demonstrate the issue:
Notice how running the following snippet will not hang, but nothing after the first element is outputted in the html.
package main
import (
"bytes"
"fmt"
"github.com/niklasfasching/go-org/org"
)
func main() {
s := `
#+TITLE: This is the TITLE
1. Two spaces between the list and the image block will not hang. However nothnig else apart from this list element will be rendered.
#+CAPTION: This is the CAPTION
#+NAME: This is the NAME
[[./a.jpg]]
2. But this element will not be rendered.
`
config := org.New()
writer := org.NewHTMLWriter()
document := config.Parse(bytes.NewReader([]byte(s)), "")
html, err := document.Write(writer)
if err != nil {
panic(err)
}
fmt.Println(html)
}
Hey! Sorry about this - thanks for the thorough report and the work you've put into this! I'm not finding the time to build a fix right now, just gonna revert that attempt on main and saw hugo already downgraded to the previous version.