Requests for comment/Anchor links for lines changed in diffs

From MediaWiki.org
Jump to: navigation, search
2014-03-05PiRSquared1761486early draft
Request for comment
Anchor links for lines changed in diffs
Component General
Creation date 2014-03-05
Author(s) PiRSquared17
Document status in draft

It may be useful to provide anchor links for lines in diffs, but if the diff algorithm changes significantly these links will be broken.

Proposal[edit | edit source]

  • The plus and minus signs in a diff (example diff) should be changed to links, or have links added right next to them, which add #line[linenumber] to the URL.
  • The current diff algorithm should be given a code, like "diff1" or "diff3".

(draft... please expand)

Comments[edit | edit source]

Sounds good, even if I think they will be only used by techies. Particularly useful for JS and CSS files. --Ricordisamoa 03:11, 7 March 2014 (UTC)

  • My thanks to PiRSquared17 for opening this - I filed the original bug. It's a good point about line diff anchors potentially breaking if the diff algorithm changes. I'll copy what I suggested for that over there:
[Links breaking can be avoided if] the anchor URL specifies what kind of diff is in use, and that particular diff algorithms are always kept available.
In that case, [an] example URL... would look something like the following (pretending that our current diff algo is called "diff1"):
https://en.wikipedia.org/w/index.php?title=Wikipedia&diff=594765035&oldid=590925507&difftype=diff1#56
A diff without difftype= would always use the latest algorithm, whatever it may be. [I.e., this is current behavior.] Obviously this raises the complexity somewhat; I don't know what the internal policy with regards to diff algorithms is. I would like to imagine that access could still be provided to older ones in the event of changes. Someone who's actually a developer, unlike me, can hopefully shed some light on that.
Scott talk 14:00, 8 March 2014 (UTC)

I'd strongly recommend including a screenshot or mock-up of what you're proposing here. --MZMcBride (talk) 02:38, 10 March 2014 (UTC)

@Ricordisamoa, MZMcBride, Scott: here's a VERY rough mockup: http://pirsquared-dev.wmflabs.org/w/index.php?title=4&diff=26&oldid=25 πr2 (tc) 15:11, 22 April 2014 (UTC)