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

Logbook drawer tags are not removed from body text #59

Open j3soon opened 1 year ago

j3soon commented 1 year ago

This issue is also mentioned in #38, but haven't been resolved in the latest version 36b31d8151e45ac6701822864816b48446d3dcad.

Test case (repeated task), modified from doctest:

>>> from orgparse import loads
>>> node = loads('''
... * TODO Pay the rent
...   DEADLINE: <2005-10-01 Sat +1m>
...   :LOGBOOK:
...   - State "DONE"  from "TODO"  [2005-09-01 Thu 16:10]
...   - State "DONE"  from "TODO"  [2005-08-01 Mon 19:44]
...   - State "DONE"  from "TODO"  [2005-07-01 Fri 17:27]
...   :END:
... ''').children[0]
>>> print(node.body)
  :LOGBOOK:
  :END:

Test case (clock):

>>> from orgparse import loads
>>> node = loads('''\
... * TODO Clock
... :LOGBOOK:
... CLOCK: [2022-01-01 Sat 00:00]--[2022-01-01 Sat 01:11] =>  1:11
... :END:
... ''').children[0]
>>> print(node.body)
:LOGBOOK:
:END:
karlicoss commented 1 year ago

Happy to accept the fix :)