[squeak-dev] generating a quick diff of two strings?

gettimothy gettimothy at zoho.com
Thu Aug 19 08:03:46 UTC 2021


Hi Marcel.



Thank you ...



I will need the inline as my comparison is....





TextDiffBuilder from:'<div><h5> Note: This example is not accessible, and should be avoided as much as possible. For example, nested tables (tables inside tables) should be separated into distinct tables when possible. </h5><table style="border: 1px solid black; border-spacing: 0; margin: 1em auto;"><caption>''An example table''</caption><tr><th style="border: 1px solid black; padding: 5px; background: #efefef;"> First header</th><th colspan="2" style="border: 1px solid black; padding: 5px; background: #ffdead;"> Second header</th></tr><tr colspan="2" style="border: 1px solid black; padding: 5px; background: #ffdead;"><td style="border: 1px solid black; padding: 5px;"> Upper left</td><td style="border: 1px solid black; padding: 5px;"> Upper middle</td><td rowspan="2" style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px; vertical-align: top;"> Right side</td></tr><tr rowspan="2" style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px; vertical-align: top;"><td style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"> Lower left</td><td style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"> Lower middle</td></tr><tr style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"><td colspan="3" style="border: 1px solid black; text-align: center;">Text before a nested table...<table><caption>''A table in a table''</caption><tr colspan="3" style="border: 1px solid black; text-align: center;"><td style="text-align: center; width: 150px;"> <a href="https://www.wikipedia.org/wiki/Wiki"><div class="card"><img src="https://commons.wikimedia.org/wiki/Special:Redirect/file/Wiki.png" class="linkfile"/><div class="card-section">Wiki</div></div></a></td><td style="text-align: center; width: 150px;"> <a href="https://www.wikipedia.org/wiki/Wiki"><div class="card"><img src="https://commons.wikimedia.org/wiki/Special:Redirect/file/Wiki.png" class="linkfile"/><div class="card-section">Wiki</div></div></a></td></tr><tr style="text-align: center; width: 150px;"><td colspan="2" style="text-align:center; border-top: 1px solid red;<!--  --> border-right: 1px solid red; border-bottom: 2px solid red;<!--  --> border-left: 1px solid red;">Two Wikipedia logos</td></tr></table></td></tr></table></div>'



to: '<div><p><h5> Note: This example is not accessible, and should be avoided as much as possible. For example, nested tables (tables inside tables) should be separated into distinct tables when possible. </h5><table style="border: 1px solid black; border-spacing: 0; margin: 1em auto;"><caption>''An example table''</caption><tr><th style="border: 1px solid black; padding: 5px; background: #efefef;"> First header</th><th colspan="2" style="border: 1px solid black; padding: 5px; background: #ffdead;"> Second header</th></tr><tr colspan="2" style="border: 1px solid black; padding: 5px; background: #ffdead;"><td style="border: 1px solid black; padding: 5px;"> Upper left</td><td style="border: 1px solid black; padding: 5px;"> Upper middle</td><td rowspan="2" style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px; vertical-align: top;"> Right side</td></tr><tr rowspan="2" style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px; vertical-align: top;"><td style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"> Lower left</td><td style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"> Lower middle</td></tr><tr style="border: 1px solid black; border-bottom: 3px solid grey; padding: 5px;"><td colspan="3" style="border: 1px solid black; text-align: center;">Text before a nested table...<table><caption>''A table in a table''</caption><tr colspan="3" style="border: 1px solid black; text-align: center;"><td style="text-align: center; width: 150px;"> <a href="https://www.wikipedia.org/wiki/Wiki"><div class="card"><img src="https://commons.wikimedia.org/wiki/Special:Redirect/file/Wiki.png" class="linkfile"/><div class="card-section">Wiki</div></div></a></td><td style="text-align: center; width: 150px;"> <a href="https://www.wikipedia.org/wiki/Wiki"><div class="card"><img src="https://commons.wikimedia.org/wiki/Special:Redirect/file/Wiki.png" class="linkfile"/><div class="card-section">Wiki</div></div></a></td></tr><tr style="text-align: center; width: 150px;"><td colspan="2" style="text-align:center; border-top: 1px solid red;<!--  --> border-right: 1px solid red; border-bottom: 2px solid red;<!--  --> border-left: 1px solid red;">Two Wikipedia logos</td></tr></table></td></tr></table></p></div>') buildDisplayPatch asMorph openInHand







So, this tells me that the two strings are different, but not "where" they are different which is what you and chris mean by "inline".



Thanks for your time.



I will try emacs diff



cheers!




---- On Tue, 17 Aug 2021 04:23:06 -0400 Marcel Taeumel <marcel.taeumel at hpi.de> wrote ----


Hi Timothy --

(TextDiffBuilder from: 'Lazy fat dog' to: 'Lazy fat cat') buildDisplayPatch asMorph openInHand



Well, no in-line diffs. :-/



Best,

Marcel



Am 17.08.2021 09:48:32 schrieb gettimothy via Squeak-dev <mailto:squeak-dev at lists.squeakfoundation.org>:

Hi Folks,



I did not find what I was looking for on forum world, so asking here.



I would like to "diff" to strings



"Lazy fat dog" diff: "Lazy fat cat"  



I took a brief glance at the Diff3 class and tests and saw nothing obvious, so I ask here.



Thank you for your time
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210819/7271eaa0/attachment.html>


More information about the Squeak-dev mailing list