Adjust tokenizer to understand environment based newlines.
This commit is contained in:
parent
09bcc67955
commit
43fce8c927
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
public static bool IsNewLine(string value)
|
||||
{
|
||||
return (value.Length == 1 && (IsNewLine(value[0]))) ||
|
||||
(string.Equals(value, "\r\n", StringComparison.Ordinal));
|
||||
(string.Equals(value, Environment.NewLine, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
// Returns true if the character is Whitespace and NOT a newline
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNet.Razor.Parser;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Text
|
||||
|
|
@ -65,7 +66,8 @@ namespace Microsoft.AspNet.Razor.Text
|
|||
{
|
||||
_absoluteIndex++;
|
||||
|
||||
if (ParserHelpers.IsNewLine(characterRead) && (characterRead != '\r' || nextCharacter != '\n'))
|
||||
if (Environment.NewLine.Length == 1 && characterRead == Environment.NewLine[0] ||
|
||||
ParserHelpers.IsNewLine(characterRead) && (characterRead != '\r' || nextCharacter != '\n'))
|
||||
{
|
||||
_lineIndex++;
|
||||
_characterIndex = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue