Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to detect inline style changed #21

Open
vle-dev opened this issue Aug 12, 2016 · 2 comments
Open

Failed to detect inline style changed #21

vle-dev opened this issue Aug 12, 2016 · 2 comments

Comments

@vle-dev
Copy link

vle-dev commented Aug 12, 2016

Hi @Rohland
At first, thank you so much for this great tool.
My question is: is there any workaround to detect the inline changed as below? I've looked in the discussion on http://www.rohland.co.za/index.php/2009/10/31/csharp-html-diff-algorithm/ and it seems the case very similar to user 'tats' during June 7, 2010.
`[Test]
public void Execute_DetectInlineStyleChanged_Test()
{
// Arrange
var oldText = @"

SECOND

";
var newText = @"

SECOND

";
// Act
var diff = new global::HtmlDiff.HtmlDiff(oldText, newText).Build();

        // Assert
        Assert.IsFalse(diff.Contains("color:#00FFFF"));
        Assert.IsTrue(diff.Contains("em"));
    }`
@santokh3386
Copy link

Hi @Rohland ,
This has been a wonderful effort and i appreciate it. It is working perfectly except in the condition mentioned in the above condition. Can you please put light on that how can we solve this issue..

I tried making two document using CKEditor and that always contains inline tags and style which is ignored by the tool.

Expecting response AS Soon as you can..

Thanks a lot in advance..

Santokh.. :)

@GBriotti
Copy link

Hi all. I've found a problem (and probably a solution) related to this issue.

The Diff class use a Stack _specialTagDiffStack to keep track of special inline style tag. Unfortunately this works only if the inline tags are only on "one side" (i.e. deleted or inserted) but it doesn't work if there is a replace (say, changing from bold to italic).

This is probably due to the fact that if tags are on the same side, for well formed html the closures are encountered in reversal order respect to the opening tags, Thus LIFO works fine.

But when there is a replace, the closures are parsed in the same order of the openings.

I solved this using two stacks: _specialTagDiffStackIns and _specialTagDiffStackDel. It seems to work, but tests are in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants