Skip to content

Fix drawer parsing to not take headlines#35

Closed
calmofthestorm wants to merge 3 commits intoPoiScript:masterfrom
calmofthestorm:properties_nesting
Closed

Fix drawer parsing to not take headlines#35
calmofthestorm wants to merge 3 commits intoPoiScript:masterfrom
calmofthestorm:properties_nesting

Conversation

@calmofthestorm
Copy link
Contributor

Please review after #34 .

Currently, when parsing a drawer for a node of level N, any headlines of level N + 1 will be absorbed into the drawer. This changes drawer parsing to reject headlines. For example:

* Hello
:PROPERTIES:
** World
:END:

should be parsed as two nodes. The drawer is ill-formed, and will be parsed as part of the body instead of as a drawer.

This will fix #24 .

Currently, headline parsing breaks the file into lines before parsing
headlines, stripping terminal \n or \r\n. This prevents
parse_headline_level from differentiating between end of line and end of
file.

This can lead to an edge case where a line is considered a headline for
the purposes of stopping parsing the body of the previous, yet not a
headline itself. This leads to parsing stopping there.

If the file is immediately written, this results in truncating it.

One example of this is `"* \n*\r\n* \n"`, which will be parsed
identically to `"* \n"`.
Currently, when parsing a drawer for a node of level N, any headlines of
level N + 1 will be absorbed into the drawer. This changes drawer
parsing to reject headlines. For example:

```
* Hello
:PROPERTIES:
** World
:END:
```

should be parsed as two nodes. The drawer is ill-formed, and will be
parsed as part of the body instead of as a drawer.
@PoiScript PoiScript closed this Nov 17, 2023
@calmofthestorm calmofthestorm deleted the properties_nesting branch November 20, 2023 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

:PROPERTIES: takes precedence over headlines

2 participants