Last modified: 2011-11-29 21:03:44 UTC
MediaWiki currently generates A (anchor) tags in pages at the beginning of sections with both NAME and ID properties based on the text of the section label/separator. This can be problematic, since the purpose of those tags is to be linked to -- which means that if someone links to them, and you then change them, external markup (that you don't even know about) breaks. One possible solution would be to extend the vertical-bar semantics, currently used for [URL|text link] and [[page_name|substitute text]] cases, to work in section headers as well, like so: ==TV|Television Coverage== Which would render as <p><a name="TV" id="TV"></a></p> <h2>Television Coverage</h2> This would break any current section headers which happen to contain a vertical bar character as text, but those are likely not to be too common, and the issue could be dealt with for outstanding instances by a striping process, if necessary.
Hmm, that's an interesting idea. I'm changing the summary to better reflect the actual *feature* being requested; the suggested syntax for achieving it is not central to the concept (and it's a bit misleading to talk about "the '|' semantics", given the completely arbitrary nature of wiki syntax; note also that [URL link text] uses no '|', only *internal links* do). That said, your suggested syntax does indeed seem pretty elegant, and I agree that there are unlikely to be all that many existing headings with a pipe in the middle - and in order to be a problem, they would have to have a pipe in the middle *and* be linked to directly. Of course, in order to have the desired effect, the change would have to be followed by awareness and agreement by wiki users of how to use this feature - pretty much the first person to introduce it onto a page needs to choose something that won't be confusing later on. But your example makes me think that this could just work.
WRT your observation about user training, please remember that "not all mediawiki's are wikipedia" -- this is as much an external feature as it is for WP. But I'm glad that you think it's practical. It doesn't *seem* to me that it would be all that much work to code, but I haven't looked at the code yet.
Yes, I tried to pick my words to imply that in order to be effective, the community of *any* wiki using this feature would have to use it effectively - unless you're using [abusing?] MediaWiki as a single-user system, there is a community who need to "get it". But like I say, I'm optimistic that they would. As for easer or otherwise of coding - never underestimate the hideous complexity of Parser.php ;)
Certainly. In a new installation, it's just one more thing to learn, and I tried to choose my suggested implementation to generalize a rule they'd already be learning. And it's also a fairly low-odds collision item. And, since I'm diving into MW->DocBook as we speak, I'm told I'm about to discover the wonders of that parser... :-)
Hallo! (In reply to comment #0) > ==TV|Television Coverage== > > Which would render as > > <p><a name="TV" id="TV"></a></p> > <h2>Television Coverage</h2> What about generating both anchors? <p><a name="TV" id="TV"><font id="Television_Coverage" /></a></p> <h2>Television Coverage</h2> or an equivalent construct. This would help shorten url's using Unicode characters or characters converted to ".XX". At wikies using transcription one would use Latin characters for foo at == foo|bar ==. see http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#.D7.B0.D7.90.D6.B7.D7.A1.D7.A2.D7.A8 which is 99% equivalent to http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#vaser *note* Automatic replacement of spaces to underscores in section ancors is made. This should be the case also for == foo bar|bar == . *question* Are the following links valid? http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#foo.20bar http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#foo.5Fbar http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#bar.20foo http://yi.wiktionary.org/w/index.php?title=project:bugzilla/01521#bar.5Ffoo They all fail. best regards reinhardt [[user:gangleri]]
(In reply to comment #0) > This would break any current section headers which happen to contain a vertical > bar character as text, but those are likely not to be too common, and the issue > could be dealt with for outstanding instances by a striping process, if necessary. The *first* "nonescaped" "|" should be relevant for rendering: a) a section which is using today ==TV|Television Coverage== could be changed to ==TV<nowiki>|</nowiki>Television Coverage== and renders as before b) ==A<nowiki>|</nowiki>B<nowiki>|</nowiki>C|Alphabet== would render <p><a name="A|B|C" id="A|B|C"></a></p> <h2>Alphabet</h2> c) ==A<nowiki>|</nowiki>B<nowiki>|</nowiki>C|foo|bar== would render <p><a name="A|B|C" id="A|B|C"></a></p> <h2>foo|bar</h2> The syntax would obsolete complicated constructs which generated bug 04039, bug 04987 etc. best regards reinhardt [[user:gangleri]]
Because this should not be hard to implement and adds a lot of functionality, I'd even be willing to spend some hours to get into the source and provide a patch. Is this wish considered to be "design-complete"? I often wished that this has been already implemented, but now it's really needed, because I want to link to sections from another (web) application (help links). There it would be the best to have the anchors named after the internal's setting name, e.g. "param_foo", but a "human readable" text for the header. The workaround seems to be, to manually insert "<div id="param_foo"></div>" tags into the wiki source.
(In reply to comment #7) > The workaround seems to be, to manually insert "<div id="param_foo"></div>" tags > into the wiki source. "<div id="param_foo"></div>" would generate a new line. "<span id="param_foo"></span>" would *not* generate a new line. see http://test.leuksman.com/view/User:Gangleri/tests/bugzilla/01521 In comment 5 I used "<font id="Television_Coverage" />"; probably it is not recommended to use HTML. best regards reinhardt [[user:gangleri]]
This seems very stale, and also of dubious utility; the suggested syntax is certainly not viable, we already use bare pipes for far too many other things.
I'm going to agree and go ahead and mark this WONTFIX. Custom anchors can be done with <span id="foo"></span> (or a template wrapping them) placed near the heading; this is fairly standard and already gets used in places.