PoiScript / orgize

A Rust library for parsing org-mode files.
https://poiscript.github.io/orgize/
MIT License
278 stars 34 forks source link

Property drawer parsing edge cases #9

Closed calmofthestorm closed 4 years ago

calmofthestorm commented 4 years ago

Hi,

I believe I have identified a bug in parsing properties drawer. I'm not sure exactly what it is, but I have several bad strings which when parsed and written out are very different. It may be related to properties which have no value, as per https://orgmode.org/worg/dev/org-syntax.html#Node_Properties

https://gist.github.com/calmofthestorm/08d0afeef571312d778958a5a5c2ad69

I have also observed that just :DRAWER: or :END: occurring in a node body will result in an :END: being added. This is still incorrect in my opinion -- a property drawer that cannot be properly parsed should be treated as body text -- but is much more understandable, especially since Org mode can identify and suggest fixing unclosed drawers.

This is a drawback of Org's permissive structure where every string is a valid Org mode file.

PoiScript commented 4 years ago

I apologize for not answering sooner! I just got a new macbook and it's harder than I thought to setup a rust environment on it. =)

This bug's caused by these lines where the parser doesn't check if :END: is present. I'm working for a fix right now.

PoiScript commented 4 years ago

This bug is fixed and out with v0.8.1 now.

calmofthestorm commented 4 years ago

Thanks!