This repository has been archived on 2025-05-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
discourse/lib/diff_engine.rb

26 lines
826 B
Ruby
Raw Normal View History

2013-12-12 03:41:34 +01:00
# This class is used to generate diffs, it will be consumed by the UI on the client that displays diffs.
2013-02-23 16:30:02 +11:00
#
2013-03-15 17:31:51 -07:00
# There are potential performance issues associated with diffing large amounts of completely
# different text, see answer here for optimization if needed
# http://meta.stackoverflow.com/questions/127497/suggested-edit-diff-shows-different-results-depending-upon-mode
2013-02-23 16:30:02 +11:00
class DiffEngine
2013-02-25 19:42:20 +03:00
2013-12-12 03:41:34 +01:00
# Generate an html friendly diff
2013-02-23 16:30:02 +11:00
#
2013-03-06 08:52:24 +01:00
# returns: html containing decorations indicating the changes
2013-02-23 16:30:02 +11:00
def self.html_diff(html_before, html_after)
2013-12-12 03:41:34 +01:00
# tokenize
# remove leading/trailing common
# SES
# format diff
2013-02-23 16:30:02 +11:00
end
2013-12-12 03:41:34 +01:00
# Same as html diff, except that it operates on markdown
2013-02-23 16:30:02 +11:00
#
# returns html containing decorated areas where diff happened
def self.markdown_diff(markdown_before, markdown_after)
2013-12-12 03:41:34 +01:00
2013-02-23 16:30:02 +11:00
end
end