diff --git a/HtmlDiff/Diff.cs b/HtmlDiff/Diff.cs index 7a2633b..78bae3e 100644 --- a/HtmlDiff/Diff.cs +++ b/HtmlDiff/Diff.cs @@ -16,8 +16,7 @@ public class HtmlDiff private readonly StringBuilder _content; private string _newText; - private string _oldText; - + private string _oldText; private static Dictionary _specialCaseClosingTags = new Dictionary(StringComparer.OrdinalIgnoreCase) { @@ -84,6 +83,16 @@ public class HtmlDiff /// public double OrphanMatchThreshold { get; set; } + /// + /// If true all deleted texts are not formatted. + /// + public bool IgnoreDelete { get; set; } + + /// + /// If true all inserted texts are not formatted. + /// + public bool IgnoreInsert { get; set; } + /// /// Initializes a new instance of the class. /// @@ -188,11 +197,21 @@ private void ProcessReplaceOperation(Operation operation) private void ProcessInsertOperation(Operation operation, string cssClass) { List text = _newWords.Where((s, pos) => pos >= operation.StartInNew && pos < operation.EndInNew).ToList(); + + if (IgnoreInsert) + { + _content.Append(string.Join("", text.ToArray())); + return; + } + InsertTag("ins", cssClass, text); } private void ProcessDeleteOperation(Operation operation, string cssClass) { + if (IgnoreDelete) + return; + List text = _oldWords.Where((s, pos) => pos >= operation.StartInOld && pos < operation.EndInOld).ToList(); InsertTag("del", cssClass, text); } diff --git a/HtmlDiff/HtmlDiff.csproj b/HtmlDiff/HtmlDiff.csproj index 0649a11..ada6a1b 100644 --- a/HtmlDiff/HtmlDiff.csproj +++ b/HtmlDiff/HtmlDiff.csproj @@ -36,6 +36,12 @@ prompt 4 + + true + + + HtmlDiffPublicPrivate.snk + @@ -66,6 +72,7 @@ Designer +