From 2f57498dc2aa843150ee98f78b24014a25719658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Herceg=20=28RIGANTI=20s=2Er=2Eo=2E=29?= Date: Sat, 7 Sep 2024 18:37:31 +0200 Subject: [PATCH] Fixed warnings in compilation status page --- .../Parser/Dothtml/Tokenizer/DothtmlTokenizer.cs | 9 ++++++++- .../Diagnostics/CompilationDiagnostic.dotcontrol | 2 +- .../Diagnostics/CompilationDiagnosticRows.dotcontrol | 2 +- .../Parser/Dothtml/DothtmlTokenizerElementsTests.cs | 12 ++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Framework/Framework/Compilation/Parser/Dothtml/Tokenizer/DothtmlTokenizer.cs b/src/Framework/Framework/Compilation/Parser/Dothtml/Tokenizer/DothtmlTokenizer.cs index 1f44e55897..6b3fe1f0e9 100644 --- a/src/Framework/Framework/Compilation/Parser/Dothtml/Tokenizer/DothtmlTokenizer.cs +++ b/src/Framework/Framework/Compilation/Parser/Dothtml/Tokenizer/DothtmlTokenizer.cs @@ -227,7 +227,14 @@ private ReadElementType ReadElement(bool wasOpenBraceRead = false) if (!char.IsLetterOrDigit(firstChar) & firstChar != '/' & firstChar != ':') { - CreateToken(DothtmlTokenType.Text, errorProvider: t => CreateTokenError(t, "'<' char is not allowed in normal text")); + if (char.IsWhiteSpace(firstChar)) + { + CreateToken(DothtmlTokenType.Text); + } + else + { + CreateToken(DothtmlTokenType.Text, errorProvider: t => CreateTokenError(t, "'<' char is not allowed in normal text")); + } return ReadElementType.Error; } diff --git a/src/Framework/Framework/Diagnostics/CompilationDiagnostic.dotcontrol b/src/Framework/Framework/Diagnostics/CompilationDiagnostic.dotcontrol index d76471315c..dfaab7490c 100644 --- a/src/Framework/Framework/Diagnostics/CompilationDiagnostic.dotcontrol +++ b/src/Framework/Framework/Diagnostics/CompilationDiagnostic.dotcontrol @@ -2,7 +2,7 @@
-
+
{{value: LineNumber}}: {{value: SourceLinePrefix}}{{value: SourceLineHighlight}}{{value: SourceLineSuffix}}
diff --git a/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol b/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol index 34cd0cdc8a..9a84822eb3 100644 --- a/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol +++ b/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol @@ -6,7 +6,7 @@ 0}> - + diff --git a/src/Tests/Parser/Dothtml/DothtmlTokenizerElementsTests.cs b/src/Tests/Parser/Dothtml/DothtmlTokenizerElementsTests.cs index 0fd1c4fc11..697f0b2455 100644 --- a/src/Tests/Parser/Dothtml/DothtmlTokenizerElementsTests.cs +++ b/src/Tests/Parser/Dothtml/DothtmlTokenizerElementsTests.cs @@ -239,6 +239,18 @@ public void DothtmlTokenizer_Invalid_OpenBraceInText() tokenizer.Tokenize(input); Assert.IsTrue(tokenizer.Tokens.All(t => t.Type == DothtmlTokenType.Text)); + Assert.IsTrue(tokenizer.Tokens.All(t => !t.HasError)); + Assert.AreEqual(string.Concat(tokenizer.Tokens.Select(t => t.Text)), input); + } + + [TestMethod] + public void DothtmlTokenizer_Invalid_OpenBraceInTextWithoutSpace() + { + var input = "inline t.HasError)); Assert.AreEqual(string.Concat(tokenizer.Tokens.Select(t => t.Text)), input); }