karlicoss / orgparse

Python module for reading Emacs org-mode files
https://orgparse.readthedocs.org
BSD 2-Clause "Simplified" License
371 stars 43 forks source link

wrong parsing org file #1

Closed boykov closed 5 years ago

boykov commented 9 years ago

I use

root = loads("""
* H1
** H2
*** H3
* H4
** H5
""")

for node in root[1]:
   print str(node)

and get

* H1
** H2
*** H3
** H5

instead of

* H1
** H2
*** H3

H5 is not a child of H1, but it shows up in root[1]

karlicoss commented 5 years ago

Wonder if this is somehow related to that.

boykov commented 5 years ago

These are two different cases. That case: Node 1 is the single 1-level node in the hierarchy. My case: there are two 1-level nodes: H1 and H4. root[0] is all of them, but root[1] should be only H1 related, not H4 (H5 is a child of H4). root[4] is H4 related. root[1:] is iterable object which includes H4 as 1-level node. It is correct.

karlicoss commented 5 years ago

Should be fixed now, turned out to be trivial. Thanks, let me know if you have any other issues!