-
Notifications
You must be signed in to change notification settings - Fork 484
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
Make sure we have LF line endings only. #791
Conversation
@scls19fr can you try this branch? You can |
@Datseris maybe you can try this branch too, if you still can reproduce this problem. |
6f451f3
to
1304062
Compare
Im on it. |
LGTM. Thanks @fredrikekre for this fix |
# Drop `skip` leading lines from the code block. Needed for deprecated `{docs}` syntax. | ||
code = string(code, '\n') | ||
code = last(split(code, '\n', limit = skip + 1)) | ||
# Check whether we have windows-style line endings. | ||
offset = occursin("\n\r", code) ? 2 : 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect the error was from this beeing "\n\r"
and not "\r\n"
, but I figured we might as well just use "\n"
internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here is not used when writing back things (like when fixing up doctests)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. That code kinda assumes \n
anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also, this local code
argument does not leak out of this parser function anyways.
Perfect, thanks for confirming. |
Amazing @fredrikekre ! It works without any problems! |
src/Utilities/Utilities.jl
Outdated
@@ -114,11 +114,11 @@ parsed from. | |||
The keyword argument `skip = N` drops the leading `N` lines from the input string. | |||
""" | |||
function parseblock(code::AbstractString, doc, page; skip = 0, keywords = true) | |||
# work only with LF line endings internally | |||
code = replace(code, "\r\n" => "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this could be dangerous if someone have "\r\n"
in a string. Should revert this and let the Julia parser decide this kind of things instead.
1304062
to
202deb1
Compare
@Datseris or @scls19fr sorry, but can you check the updated version too? |
It's broken on my side |
Hm That's weird @scls19fr . @fredrikekre I can confirm that this is still LGTM on Windows 10. I am also testing it with a documentation that was problematic, i.e. was causing the problems of #749. |
Ok I will remove my |
Sorry to say that... but
Browsing to file:///C:/Users/Admin-pc/.julia/dev/DataStructures/docs/build/default_dict.html and
Maybe I did something wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Should definitely be CRLF nor LFCR if we're looking for windows line endings.
@scls19fr do you mean that the previous version of this PR worked? It looks like you get different errors now. |
This is because it's not the same part of page (with the minimal md file I mentioned #790 (comment) I get)
I think the previous PR was working correctly. |
This may sound stupid, but I recall from Slack that |
|
This is probably the kind of issue I'm also facing.
|
|
It does, just tested it as well. Sorry for the off-topic comment! |
How can I check that I'm running the "right" Documenter (ie from fe/fix-parsing branch)? |
Ok, found a simple testcase that still fails on this branch. Will ping you when I have a new version that you can try. |
202deb1
to
eb140c6
Compare
Okay, @Datseris and @scls19fr feel free to test the new version. |
eb140c6
to
9637d13
Compare
9637d13
to
317d20e
Compare
After you merged to master, I did
but I still facing #790 |
You might have to pull the newest version manually, there is a bug where develop fails to get the latest version. |
I can still confirm that on the current master this works for me. |
Under Mac OS X now
Minimal md file mentioned in #790 (comment) saved with CRLF or LF as EOL still render badly
|
Trying with an even simpler file
(CRLF or LF) rendered as
|
(cherry picked from commit fe8a644)
fix #749, fix #790