Last modified: 2010-05-15 15:59:44 UTC
If I have an extension that creates a destination anchor, there's no way for the extension to verify that the id/anchor name is not already assigned to a different HTML tag. I've a small extension I've put together that essentially creates an anchor name in the same way headers do. So if I have: <anc>'''Runnin' Down''' [[A Dream]]</anc> The <anc> tag strips out the markup leaving "Runnin' Down A Dream" and uses that text to create the ID "Runnin.27_Down_A_Dream". After all is said and done, the output HTML is: <span id="Runnin.27_Down_A_Dream"><b>Running Down</b> <a href="/wiki/index.php?title=A_Dream&action=edit" class="new" title="A Dream">A Dream</a></span> The benefit would be similar to headers in that it will create predictable destination anchor names, but, unlike headers, they wouldn't show up in the TOC, nor have an "edit" link for section editing. Similar to bug #7356, given the following: <anc>content</anc> the tag extension will generate a span tag with id="content", which shouldn't happen because a MediaWiki creates a div tag with the same ID. The same also applies to headers. The markup: === wiki-markup === <anc>wiki-markup</anc> Will produce an anchor name identical to the id generated by the anc tag.
You shouldn't need to use this extension. Rather, create a [[Template:Anchor]] that contains: <span id="{{{id|{{{1}}}}}}">{{{1}}}</span> Then you can use {{anchor|content}} which will output <span id="content">content</span>, or: {{anchor|id=abc|def}} which will output <span id="abc">def</span>
That works fine if the template argument doesn't have any markup. But if you try that with the first example I gave, you get id as: .27.27.27Runnin.27_Down.27.27.27_.5B.5BA_Dream.5D.5D when what I want is: Runnin.27_Down_A_Dream Anyway, whether I need the extension or not is beside the point. Neither solution will ensure the id is unique.
(In reply to comment #2) > Anyway, whether I need the extension or not is beside the point. Neither > solution will ensure the id is unique. > True, but then this is just a duplicate of bug 7356. *** This bug has been marked as a duplicate of bug 7356 ***