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

Windows line endings not working #24

Open
driusan opened this issue Jul 22, 2021 · 1 comment
Open

Windows line endings not working #24

driusan opened this issue Jul 22, 2021 · 1 comment

Comments

@driusan
Copy link
Owner

driusan commented Jul 22, 2021

After testing a file in github discussions #22, lmt seems to fail with Windows style \r\n line endings. I haven't had a chance to dig into why, but there's likely a regex somewhere that needs to be updated to support Windows.

@ehrentraut
Copy link

Hi Dave,

As far as I can see, this is easy to fix (just 2 or 3 lines of code, essentially):

In Implementation.md, line 265:
Replace
if line.text == "\n" by if line.text == "\n" || line.text == "```\r\n" {

In IndentedBlocks.md, line 120:
Replace
if line.text == "\n" { by if line.text == "\n" || line.text == "```\r\n" {
and the same in line 103 (for the documentation).

Similar changes must be made in
LineNumbers.md, line 146:
Replace
if line.text == "\n" { by if line.text == "\n" || line.text == "```\r\n" {
and in line 236:
Replace
if v.text != "\n" {
by
if v.text != "\n" && v.text != "\r\n" {

Not elegant, but simple, and lmt can now work with Windows and Unix line endings on both platforms (regardless where the markdown files to tangle have been produced).

Thanks for your nice work - I really appreciate lmt!

Regards, Harald

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

No branches or pull requests

2 participants