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

Incorrect handling of \r when processing "Windows" source files #6340

Closed
vicuna opened this Issue Mar 6, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Mar 6, 2014

Original bug ID: 6340
Reporter: @dra27
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2015-03-25T01:16:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.03.0+dev / +beta1
Category: ocamldoc

Bug description

ocamldoc doesn't correctly handle Windows line endings (\r\n) in comments - resulting HTML files contain \r\r\n. This shows up in code blocks as spurious blank lines.

Steps to reproduce

Create Broken.mli (using Windows line-endings) and run ocamldoc -html -stars Broken.mli

(**

  • This will be broken by ocamldoc.
  • It seems unable to cope with DOS line endings.
  • {[let foo = "bar"
    *in
  • "fu" ^ foo]}
    *)

val foo : unit

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 15, 2014

Comment author: @damiendoligez

Arguably, your HTML renderer is also broken: it shouldn't take a single \r as an end-of-line.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Sep 15, 2014

Comment author: @dra27

Well, possibly, but by HTML renderer you're referring to Internet Explorer 11, Chrome 37 and Firefox 27 (I know that's out-of-date - I don't use it very often!). Interestingly, as I also have a not-updated Ubuntu 12.4 virtual machine, Firefox 27 appears to ignore the extra \r on Linux, but not on Windows.
Technically (http://www.w3.org/TR/html401/struct/text.html#line-breaks), both are behaving correctly - \r\r\n is two line breaks (or three, depending on how you read it!) and a pre element's rendering of whitespace is all covered by "may"! What SGML parsing has to say about mixed line break use, I don't know, because it's of course an ISO standard and I'm not wealthy enough to be able to consult it!

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 6, 2015

Comment author: @damiendoligez

OK, so it's HTML itself that is broken. I'm not surprised.

FTR, now that MacOS 9 has disappeared, the correct way to handle this CR/LF nonsense is to consider that LF is a newline, and CR is utterly ignored in all contexts. That works with both Unix and Windows.

I've committed a fix to trunk (rev 15815), but I still need to test it for real under Windows.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Mar 25, 2015

Comment author: @damiendoligez

tested under Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.