You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing certain orgmode documents drops information about spacing resulting in a data structure that when written will not be the same as the original document.
So the extra spaces between the stars, keyword, priority and title surely violate most people's style guide but seem to be perfectly valid org. Extra spacing before the tags allows for right aligning them. Extraneous spacing should be removed by some formatting pass instead.
I would feel that extra spaces should be preserved ideally in a way that does not make it much harder to manipulate the AST.
{:headlines
[{:headline
{:level 1,
:level-post-spacing " "
:keyword "TODO" ;; keyword not present is another issue
:keyword-post-spacing " "
:priority "A" ;; priority not present is another issue
:priority-post-spacing " "
:title [[:text-normal "Buy raspberries"]],
:title-post-spacing " "
:planning [],
:tags ["purchase"]
:tags-post-spacing " "}}]}
The original document can be reproduced from either structure. If someone wants to fix the formatting by manipulating the data structure that should be easy too.
The text was updated successfully, but these errors were encountered:
I would say, org-parser's aim is not a 100% round-trip accuracy. In sum, and for all edge cases that would be a huge effort, I think.
Currently (write-str headline) renders the headline as org-mode would do it when you press the keys for next TODO state or next priority in emacs. I'm not sure if we should follow the suggested path because it makes everything more complicated and harder to maintain.
Assumptions
This assumes that a goal of the library is for a test like this to always pass for any given
org
:The bug
Parsing certain orgmode documents drops information about spacing resulting in a data structure that when written will not be the same as the original document.
To Reproduce
Note the use of extra spacing:
* TODO [#A] Buy raspberries :purchase:
Result from
parse
:Only extra spacing around tags is still preserved.
Result from
(comp transform parse)
:Now spacing around tags is lost.
Expected behavior
So the extra spaces between the stars, keyword, priority and title surely violate most people's style guide but seem to be perfectly valid org. Extra spacing before the tags allows for right aligning them. Extraneous spacing should be removed by some formatting pass instead.
I would feel that extra spaces should be preserved ideally in a way that does not make it much harder to manipulate the AST.
Suggested parse structure
Suggested transform structure
The original document can be reproduced from either structure. If someone wants to fix the formatting by manipulating the data structure that should be easy too.
The text was updated successfully, but these errors were encountered: