Skip to content

Fix headline parsing leading to dropped lines.#34

Closed
calmofthestorm wants to merge 2 commits intoPoiScript:masterfrom
calmofthestorm:fix_cr_bug
Closed

Fix headline parsing leading to dropped lines.#34
calmofthestorm wants to merge 2 commits intoPoiScript:masterfrom
calmofthestorm:fix_cr_bug

Conversation

@calmofthestorm
Copy link
Contributor

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".

This should fix #26

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"`.
@PoiScript
Copy link
Owner

thanks you for contributing, this problem has been fixed in v0.10.

@PoiScript PoiScript closed this Nov 17, 2023
@calmofthestorm calmofthestorm deleted the fix_cr_bug branch November 20, 2023 15:38
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.

\r\n prevents further parsing; potential for substantial data loss

2 participants