Tutorial :semantic markup for Python's difflib.HtmlDiff


It appears Python's difflib.HtmlDiff, rather than using INS and DEL, uses SPAN elements with custom classes:

python -c 'import difflib; txt1 = "lorem ipsum\ndolor sit amet".splitlines(); txt2 = "lorem foo isum\ndolor amet".splitlines(); d = difflib.HtmlDiff(); print d.make_table(txt1, txt2)'  

Before I go about fixing this myself, has anyone looked into this already? Is there perhaps a valid reason for not using POSH? (Google wasn't a big help here... )


This script by Aaron Swartz uses difflib to output ins/del.


The python bug tracker is here: http://bugs.python.org/

There's no open bug on this issue, which I guess is because most people would not care what sort of html it is as long as it works. If it's important to you, file a bug and submit a patch.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »