Example #1
0
    def diff_to_older(self, older):
        field_diff_data = list(overdiff.overdiff(older.body_pars, self.body_pars))
        field_diffs = []

        for i in xrange(0,len(field_diff_data)):
            field_diffs.append(overdiff.selection_to_s(self.body_pars[i], field_diff_data[i], markdown=True))
        field_diff = '\n\n'.join(field_diffs)
        return field_diff
Example #2
0
def overdiff_and_highlight(old,new):
    def prepare_value(value):
        return pars_to_blocks(value.replace('\r', '').split('\n\n'))

    old = prepare_value(old)
    new = prepare_value(new)
    field_diff_data = list(overdiff.overdiff(old, new))
    field_diffs = []

    for i in xrange(0, len(field_diff_data)):
        field_diffs.append(overdiff.selection_to_s(new[i], field_diff_data[i], markdown=True))
    return '\n\n'.join(field_diffs), len(field_diff_data)>0