@@ -3,6 +3,8 @@ BeginPackage["CoffeeLiqueur`Notebook`FileFormat`"];
33readNotebook ;
44writeNotebook ;
55
6+ endOfLine = If [$OperatingSystem === "Windows" , "\r " , EndOfLine ];
7+
68Begin ["`Private`" ];
79
810takeKeys [nb_ , keys_ ] := Association @ Map [(# -> nb [# ])& , keys ]
@@ -307,7 +309,7 @@ readNotebook[stream_, timeout_:10] := Module[
307309 ReadString [
308310 file
309311 ,
310- ___ ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%Notebook%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine
312+ ___ ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%Notebook%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine
311313 ,
312314 TimeConstraint -> timeout
313315 ]
@@ -321,7 +323,7 @@ readNotebook[stream_, timeout_:10] := Module[
321323 ReadString [
322324 file
323325 ,
324- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine
326+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine
325327 ,
326328 TimeConstraint -> timeout
327329 ]
@@ -339,7 +341,7 @@ readNotebook[stream_, timeout_:10] := Module[
339341 ReadString [
340342 file
341343 ,
342- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ "Cells" ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n " ..
344+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ "Cells" ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n " ..
343345 ,
344346 TimeConstraint -> timeout
345347 ]
@@ -353,7 +355,7 @@ readNotebook[stream_, timeout_:10] := Module[
353355 ReadString [
354356 file
355357 ,
356- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n "
358+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n "
357359 ,
358360 TimeConstraint -> timeout
359361 ]
@@ -376,7 +378,7 @@ readNotebook[stream_, timeout_:10] := Module[
376378 ReadString [
377379 file
378380 ,
379- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n "
381+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n "
380382 ,
381383 TimeConstraint -> timeout
382384 ]
@@ -406,7 +408,7 @@ readNotebook[stream_, timeout_:10] := Module[
406408 ReadString [
407409 file
408410 ,
409- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ field ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n " ..
411+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ field ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n " ..
410412 ,
411413 TimeConstraint -> timeout
412414 ]
@@ -420,7 +422,7 @@ readNotebook[stream_, timeout_:10] := Module[
420422 ReadString [
421423 file
422424 ,
423- (StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n " ) | (StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%EndOf" ~~ field ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n " )
425+ (StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n " ) | (StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%EndOf" ~~ field ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n " )
424426 ,
425427 TimeConstraint -> timeout
426428 ]
@@ -446,7 +448,7 @@ readNotebook[stream_, timeout_:10] := Module[
446448 ReadString [
447449 file
448450 ,
449- StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ EndOfLine ~~ "\n "
451+ StartOfLine ~~ "%" ~~ Repeated ["-" , {17 , 100 }] ~~ Repeated ["-" , {17 , 100 }] ~~ "%" ~~ endOfLine ~~ "\n "
450452 ,
451453 TimeConstraint -> timeout
452454 ]
0 commit comments