curiouslychase / _goorgeous

[DEPRECATED] A go org syntax parser to html
MIT License
160 stars 28 forks source link

Four consecutive lines beginning with '#' crash hugo #53

Closed mgmart closed 5 years ago

mgmart commented 7 years ago

I'm using goorgeous with hugo. Tried to create a post with an example config file.

#+BEGIN_EXAMPLE
# Create custom menu entries by defining a label and a link for
# them. Since you can also link posts, you've the option the
# place the links before or after them.
#
# E.g.: "Home" appears before all linked posts in the menu
# and "Tags" / "Categories" after them.
#+END_EXAMPLE

And got a panic.

Further tests show that regardless of the ****_EXAMPLEstatements, the error occurs if there are four consecutive lines starting with # in the Org file.

#
#
#
#

results in:

goroutine 37 [running]:
github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous.OrgOptions(0xc420309900, 0x11fa, 0x1300, 0x1b3d840, 0xc4207968e0, 0x0, 0x0, 0x0)
    /Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:75 +0x26db
github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous.Org(0xc420309900, 0x11fa, 0x1300, 0x1b3d840, 0xc4207968e0, 0x1b39b40, 0xc420354300, 0x100)
    /Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/chaseadamsio/goorgeous/goorgeous.go:50 +0x53
github.com/gohugoio/hugo/helpers.orgRender(0xc4201c3600, 0xc42026f470, 0x0, 0x0, 0xc42019561c, 0x3, 0x1b39b40, 0xc420354300, 0x10115e8, 0x80, ...)
    /Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:681 +0x1de
github.com/gohugoio/hugo/helpers.ContentSpec.RenderBytes(0xc42026f470, 0x0, 0x0, 0xc42019561c, 0x3, 0x1b39b40, 0xc420354300, 0xc4201c3600, 0xc4207966c0, 0x1, ...)
    /Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:427 +0x15e
github.com/gohugoio/hugo/hugolib.(*Page).renderContent(0xc42079c000, 0xc420307300, 0x11fa, 0x1300, 0xc420307300, 0x11fa, 0x1300)
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/page.go:639 +0x28d
github.com/gohugoio/hugo/hugolib.commonConvert(0xc42079c000, 0xc420031658, 0x16307a1, 0x16d8660, 0xc420770730)
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_page.go:144 +0x24f
github.com/gohugoio/hugo/hugolib.orgHandler.PageConvert(0x0, 0x0, 0x0, 0xc42079c000, 0x15cd548, 0xc42010ff07, 0x3, 0x17bcfb3)
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_page.go:122 +0x2b
github.com/gohugoio/hugo/hugolib.(*orgHandler).PageConvert(0xc4201fc160, 0xc42079c000, 0xc4201fc160, 0xc420031708, 0x15cd428, 0x1b375e0)
    <autogenerated>:785 +0x69
github.com/gohugoio/hugo/hugolib.(*MetaHandle).Convert(0xc420796360, 0x17b8e00, 0xc42079c000, 0xc42007c280, 0xc420722360)
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/handler_meta.go:77 +0xa7
github.com/gohugoio/hugo/hugolib.pageConverter(0xc4207223c0, 0xc420722360, 0xc42070ca60)
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/site.go:1409 +0xfa
created by github.com/gohugoio/hugo/hugolib.(*Site).convertSource
    /Users/bep/go/src/github.com/gohugoio/hugo/hugolib/site.go:1337 +0x18c

Three lines

#
#
#

are processed without error.

curiouslychase commented 5 years ago

I had a branch I was getting ready to PR into Hugo this week that fixed this, but it looks like @niklasfasching PR'ed a new org parser, so I'm closing all the issues here, deprecating and archiving goorgeous.