You know you've been hacking too long when… you design bits of content management systems in your sleep.
What happened was, I woke up early this morning and remembered bits of a dream I'd been having. In the dream I was thinking about a way to present web pages stored in a revision control system using some special HTML elements that don't exist. Because the page contained (in these special elements) all the revision history, it was possible to display any previous version of the page really quickly.
Translating to reality, HTML does have the <ins>
and <del> elements, and if we marked up insertions and
deletions for each revision (distinguishing changes at different times
with different values for the class attribute) then we really
would have all the revision information in the page.
So a paragraph in which a spelling mistake was fixed in the third revision might be presented as follows:
<p>Here is an interesting way of presenting rev<del class="rev3">si</del><ins class="rev3">is</ins>ion controlled web pages.</p>
The interesting bit is that we could probably write some JavaScript to set CSS things on these elements. Hiding and showing the right ones should make the visible bits correspond to different revisions of the file. We could provide buttons to instantly switch, making it easy for non-techies to see what's changed in a page without reading diffs.
A first thought of the algorithm for deciding what to hide and what
to show: to view revision n display all insertions and hide all
deletions for revisions before n, and hide all insertions and
show all deletions after n. You'd have to turn off the normal
styling of the <ins> and <del> elements.
I'm not awake enough yet to know whether this would actually work. In particular, there are some tricky issues about nested insertions and deletions, and how display and hiding override each other.