-
Notifications
You must be signed in to change notification settings - Fork 222
Removed newlines at the end of razor comments #482
Conversation
@@ -134,12 +134,31 @@ protected void SkipToAndParseCode(Func<HtmlSymbol, bool> condition) | |||
{ | |||
if (last != null) | |||
{ | |||
Accept(last); | |||
if (!startOfLine || last.Type != HtmlSymbolType.WhiteSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for? Looks like it may re-order the symbols improperly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not for this condition, the whitespace preceding the razor comment will show up as part of the next line.
<p>
@**@
</p>
should produce
<p>
</p>
instead of this
<p>
</p>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. Instead of skipping the last
we should conditionally accept it, mark its code generator as null
(if there wasn't something prior to it like <p>hi</p> @* abcd *@
) to not mess up tooling.
⌚ |
Updated. |
@@ -134,12 +134,31 @@ protected void SkipToAndParseCode(Func<HtmlSymbol, bool> condition) | |||
{ | |||
if (last != null) | |||
{ | |||
if (startOfLine && last.Type == HtmlSymbolType.WhiteSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add a comment explaining this one 😄. This parser loop can be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance there's more than one symbol waiting to be output? Concern is using the wrong generator for non-whitespace.
Design looks good. Ensure that this works (pretty sure it will, but want to double check):
|
Just to note, you may want to label this PR as part 1/X where X is how many parts you want to take to apply the same niceness to other block level elements in Razor 😄 |
RazorComment(); | ||
|
||
// Handle the whitespace and newline at the end of a razor comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this only consume the whitespace if startOfLine
is true
? Shouldn't the final newline be removed in (less common I'm sure but possible) cases like @* hello *@ @* world *@
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked offline; I got it.
⌚ |
Updated. |
8f8aff1
to
ab459cd
Compare
Very close |
new MarkupTagBlock( | ||
Factory.Markup("</p>")) | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p>
@* abcd *@
</p>
<p>
@* abcd *@
</p>
<p>
@* abcd *@ Extra @* efgh *@
</p>
<p>
@*
abcd
*@
</p>
Intermingle some content in the above Razor comments just for variation instead of always doing @**@
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
⌚ for extra test (#482 (comment)) |
caeaec8
to
84bcd19
Compare
Updated. |
|
|
84bcd19
to
71c4c8d
Compare
Issue - #428
This does not include the fix for the issue mentioned here #428 (comment).
Will add and update tests once the design is finalized.
@NTaylorMullen @dougbu