1 ! Copyright (C) 2008 Slava Pestov
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: lcs xml.interpolate xml.writer kernel strings ;
4 FROM: accessors => item>> ;
6 FROM: sequences => each if-empty when-empty map ;
9 GENERIC: diff-line ( obj -- xml )
11 : item-string ( item -- string )
12 item>> [ CHAR: no-break-space 1string ] when-empty ;
16 [XML <td class="retain"><-></td> XML]
17 dup [XML <tr><-><-></tr> XML] ;
23 <td class="insert"><-></td>
30 <td class="delete"><-></td>
35 : htmlize-diff ( diff -- xml )
38 <table width="100%" class="comparison">
39 <tr><th>Old</th><th>New</th></tr>