Last modified: 2014-09-23 22:56:01 UTC
Created attachment 10486 [details] Patch for 1.18.3 Here is a patch, that append short "id" attribute to headlines. It useful for easy short link creation to page section.
base64 encoded truncated md5? Not really what I'd pick for 'short' or 'intuitive'. The string concatenation instead of modifying $attribs smells of bad coding style. But more importantly. Taking over the <h#>'s id="" for this? That is a fairly short sighted decision. We have bugs open requesting that we move the existing id="" from the mw-headline to the <h#>. So I would reject this patch simply on those grounds.
I just want short id for url #hash. Each section has <h1><span id="..."></span></h1> format. One of it is used for long urlencoded section's name, but we may use _second_ for short id. I will be happy if someone add hook that'll be able to modify $attribs. Sorry for bad style, I am not a coder. I want to illustrate my idea with that patch.
[Please also flag the file as a patch so it can be found when querying. Thanks!]
Thank you. Sorry for the reverse patch.
Thanks for the patch! Please feel free to get developer access https://www.mediawiki.org/wiki/Developer_access and submit this directly into our source control system: https://www.mediawiki.org/wiki/Git/Workflow If you have any questions, please let us know: https://www.mediawiki.org/wiki/Communication
-patch-need-review, already reviewed in Comment 1.
Marking patch as reviewed. CC'ing Kai Nissen in case he wants to comment on a11y grounds.
mwh: In case you're still interested in this (hopefully), would you have time to follow the steps that Sumana provided in comment 6?
Created attachment 11398 [details] Patch for latest version from git Sorry for incorrect direction in previous patch.
Created attachment 11399 [details] Patch for latest version from git AAAARGH.
(In reply to comment #9) > mwh: In case you're still interested in this (hopefully), would you have time > to follow the steps that Sumana provided in comment 6? I am bad at coding (as you can see). Sorry.
(In reply to comment #1) > base64 encoded truncated md5? Not really what I'd pick for 'short' or > 'intuitive'. > > The string concatenation instead of modifying $attribs smells of bad coding > style. > > But more importantly. Taking over the <h#>'s id="" for this? That is a fairly > short sighted decision. We have bugs open requesting that we move the existing > id="" from the mw-headline to the <h#>. So I would reject this patch simply on > those grounds. I agree with Daniel, this seems very hacky and there is no clear use case. If you want to create a short url, create a truly short url, not just the section anchor (there are 100s of url shorteners out there, and Wikimedia is also working on one of their own).
(In reply to comment #13) > and Wikimedia is also working on one of their own That's nice. If it will be native option.