felixSchl/neodoc

CRLF normalization

eight04 opened this issue · 1 comments

I was trying to make docstring a separate file, however I noticed that neodoc can't handle \r character, which means you can't save the doc with Windows CRLF.

Failed to parse specification:
Expected Program name

This is an error with the program itself and not your fault.
Please bring this to the program author's attention.

We have to add some normalization.

var doc = fs.readFileSync(...).replace(/\r\n?/g, "\n");

Should this behavior be built-in to neodoc or just leave it to the application (then we might need a better error message)?

I don't mind normalizing the input as part of neodoc, we're already doing some adhoc pre-processing (dedenting) anyway:

Scanner.scan $ dedent help
.

Edit: It would need to be Scanner.scan $ dedent $ normalizeCRLF help, given a function normalizeCRLF that does the above.