-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract TagAttributeCollection with TrailingWhitespace property.
This also fixes the bug that TrailingWhitespace and ClosingTagTrailingWhitespace are mistakenly using the same field.
- Loading branch information
Showing
4 changed files
with
62 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace MwParserFromScratch.Nodes | ||
{ | ||
public class TagAttributeCollection : NodeCollection<TagAttribute> | ||
{ | ||
private string _TrailingWhitespace; | ||
|
||
internal TagAttributeCollection(Node owner) : base(owner) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// The trailing whitespace after the last tag attribute. | ||
/// </summary> | ||
/// <exception cref="ArgumentException">The string contains non-white-space characters.</exception> | ||
public string TrailingWhitespace | ||
{ | ||
get { return _TrailingWhitespace; } | ||
set | ||
{ | ||
Utility.AssertNullOrWhiteSpace(value); | ||
_TrailingWhitespace = value; | ||
} | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
foreach (var attr in this) | ||
sb.Append(attr); | ||
sb.Append(_TrailingWhitespace); | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters