If we treated section' s path as its ID, we could get rid of most conflicts
when editing sections.
''Disclaimer: this should work fairly well for two users in conflict. I'm
not sure how scalable it is or needs to be.''
Construct paths from heading texts, separated by #. Where needed, add
dissambig characters. Use the path to identify sections when editing.
Provide users with an option to either edit the section with it subsections
(so the smallest needed part is edited when restructuring) or just the text
of the section (to edit even less when appropriate).
So, users U1 and U2 are concurrently editing section S1 and S2 and then U1
saves the page with his version of S1. U2 tries to save the page with his
edit of S2, but gets an edit conflict. What's to be done?
1) If S1 and S2 are same, show diff and let U2 handle it.
2 ) If S1 and S2 are disjunct (i.e. one is not included in the other), there
is no conflict. Overwrite S2 with U2's version and save.
3) If S1 and S2 are not disjunct, we call the larger one (S) and the smaller
one (s). Check if (s) exists in the newest version of (S).
3.1) If (s) doesn't exist, present U2 with the diff page for (S).
3.2) If (s) exists, and U1 changed its contents, present U2 with the diff.
3.3) If (s) exists, and the user who edited (S) did not change its contents,
replace it with the version of the user who edited (s) (this is quite
automagical, so if conservative, present U2 with the diff)
3.4) When U2 finally saves the page, record the version as an edit of (S) to
ensure correct behaviour.
Additional tuning may be needed:
Maybe show separate diff for (s) and show source of (s) in the version where
it was directly chosen for editing .
What happens when U1 changed the title of the section, (or ordering of
sections with the same names) but left the contents alone? Should we bother
to check for it? Maybe keep CRC's of section contents? (They can be kept in
the source- filter them out on display and edit, calculate new and store on
save)
~~~~ zocky