Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser error with toml engine and CRLF. #92

Closed
fimars opened this issue Mar 8, 2019 · 5 comments · May be fixed by #148
Closed

Parser error with toml engine and CRLF. #92

fimars opened this issue Mar 8, 2019 · 5 comments · May be fixed by #148
Labels
bug A problem that causes an error in the library at compilation or runtime.

Comments

@fimars
Copy link

fimars commented Mar 8, 2019

  1. gray-matter with CRLF, work well.
  2. node-toml with CRLF, work well too.

BUT:

If you run the toml example of README with CRLF file, will get a parse error.

image

Minimal example repo here

@fimars
Copy link
Author

fimars commented Mar 8, 2019

I see the point, here of gray-matter output code like:

\r\n RawOfMatter \r

And node-toml doesn't trim the input thing for now. Maybe add trim here for engines or else, Any suggestions with this?

@robertmassaioli

fimars added a commit to fimars/gray-matter that referenced this issue Mar 8, 2019
@robertmassaioli
Copy link
Collaborator

I can verify this just by modifying line 15 of examples/toml.js to be:

].join('\r\n');

The error message suggests that the problem is not in the gray-matter library though. It suggests that the error is in the toml package.

In fact, this error message:

throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);

Looks like it comes from the PEG.js library, which I assume the toml library is using internally.

Please go raise an issue here to get this problem fixed: https://github.com/BinaryMuse/toml-node

@robertmassaioli robertmassaioli added the bug A problem that causes an error in the library at compilation or runtime. label Mar 26, 2019
@fimars
Copy link
Author

fimars commented Mar 27, 2019

@robertmassaioli thanks for your reply, But don't you think it's a little strange to output \r as EOF

@zachleat
Copy link

I think this should be reopened. It causes errors on TOML parsing on Windows machines.

Input file: https://github.com/11ty/eleventy/blob/master/test/stubs/custom-frontmatter/template-toml.njk#L1
JavaScript test case: https://github.com/11ty/eleventy/blob/master/test/TemplateTest.js#L1732

Build failure on Windows machines from this: https://travis-ci.org/11ty/eleventy/jobs/550051432 (Works on Linux and Mac https://travis-ci.org/11ty/eleventy/builds/550051427)

@redblue9771
Copy link

I also think that this issue should be reopened to solve the bug that appears on windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A problem that causes an error in the library at compilation or runtime.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants