Пример #1
0
 def prev_version(self, current_doc, name):
     _differ = dmp()
     result = ""
     current_text = current_doc.get(name, "")
     patch = self[name]
     # result = _differ.diff_main(old_text, value)
     result = _differ.patch_fromText(patch)
     result = _differ.patch_apply(result, current_text)
     return result
Пример #2
0
 def add_diff(self, original_doc, name, value):
     _differ = dmp()
     if isinstance(value, basestring):
         old_text = original_doc.get(name, "")
         # result = _differ.diff_main(old_text, value)
         result = _differ.patch_make(value, old_text)
         result = _differ.patch_toText(result)
         self[name] = result
     original_doc[name] = value
Пример #3
0
 def __init__(self):
     self.previous_text = ""
     self.editor = MajesticEditor()
     self.dmp = dmp()
Пример #4
0
 def get_html(self, key):
     _differ = dmp()
     return _differ.make_prettyHtml(self[key])