Comparing versions of custom and modified content
I am working on a project creating an interactive collaboration tool. Looking at Wikipedia, I noticed that custom page iterations can be easily compared to each other ; the comparison highlights the differences.
Conceptually, what do I need to implement to do almost the same thing?
a source to share
Composed of good advice:
The easiest way is to just use any of the existing wiki engines. There are many good wiki engines out there. Don't reinvent the wheel.
For example, StackOverflow itself is a custom wiki. Take a look at the edit preview on Stack Overflow to see how well its functionality matches the one described in the question.
a source to share
You will need a versioned data store and a great algorithm.
Maintain versions of your resources by giving each resource a version number. When a user edits a resource instead of replacing the resource, save the edit as a new entry in your datastore with a new, higher revision number. When you want to get a resource, return the one with the highest version.
You can use timestamps instead of the version number. Not only are the timestamps always incremented, but the version number itself can be used to determine when a resource was changed.
Choose a diff algorithm based on how you store resources. Wikitext is commonly used in linuxise, so if users are editing this it makes sense to use linewise diff as a standard Unix utility diff
. If the resources are XML, you may want to look for an XML-specific differential algorithm so that users can understand where the differences are.
a source to share