sander / code-illuminated

Automatically exported from code.google.com/p/code-illuminated
0 stars 0 forks source link

windows files "\n\r" #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that "\r" of windows files are not parsed correctly.
Maybe, a pre-process of the entry (removing of "\r") would be usefull. 

(but think twice : for mac-os, I'm not sure, is it "\r", "\r\n" or "\n" ?,
if it is "\r", it would be nice not to remove "\r" but to replace "\r" with
"\n")

other solution (?) : introduce "\r" in the regex used by the parser. 

Best regards.

(apart : very nice)

Original issue reported on code.google.com by Denis.Bo...@imag.fr on 13 Feb 2009 at 10:43

GoogleCodeExporter commented 9 years ago
a small change (in docs.js) may be enough :

App.processCode = function processCode(code, div) {
  var lines = code.replace(/\r\n/g,'\n').split('\n');
...

Original comment by Denis.Bo...@imag.fr on 13 Feb 2009 at 11:28

GoogleCodeExporter commented 9 years ago
for windows files + mac files (but I do not have mac-os file, so ...)
the change could be :
App.processCode = function processCode(code, div) {
  var lines = code.replace(/\r\n/g,'\n').replace(/\r/g,'\n').split('\n');
...
(but I do not have mac-os file, so think twice, test it ...)

Original comment by Denis.Bo...@imag.fr on 13 Feb 2009 at 11:36

GoogleCodeExporter commented 9 years ago
Fixed by revision 20. Thanks to Denis Bouhineau for the patch. Tested with CR, 
CR/LF
and LF line end chars on IE7 and FF 3.0.

Original comment by albertos...@gmail.com on 13 Feb 2009 at 12:20

GoogleCodeExporter commented 9 years ago

Original comment by albertos...@gmail.com on 13 Feb 2009 at 12:21