This arose from a conversation on wikien-l.
There is some pretty strange behaviour involving the ISBN "magic word" when used as the label in a piped link.
---- copied from that thread ----
In summary, it looks like: * Plain text like "ISBN 123" gets mapped to http://en.wikipedia.org/wiki/Special:Booksources/isbn123 * Plain text with slashes or hyphens or whatever are mapped to different URLs (slashes, fwiw, are mapped to underscores), which all behave identically - extraneous characters are treated as though they're not there http://en.wikipedia.org/wiki/Special:Booksources/isbn1_2-3 * You can access this page via [[Special:Booksources/isbn123]] * When a link to an ISBN page like that is piped via an "ISBN" text, the actual link is ignored, and the piped label is used instead: [[Special:Booksources/isbn123|ISBN 456]] actually links to the ISBN page for 456, and the link reads "ISBN 456".
So far so good? Well, it's odd, but explainable by the "ISBN ..." text being parsed and treated later in the cycle. Now, here's the killer: *[[Test|ISBN 456]] links to Test!
(see the example at http://en.wikipedia.org/wiki/User:Stevage/sandbox )
That's the one I can't understand - putting "ISBN xxx" in the piped part of a link only overrides the actual link if it it's to an ISBN page. This is most unexpected. I suppose it has some strange "prevent misleading ISBN links" benefit, but it's just...odd.
To be honest, the fact that the piped label gets "interpreted" for magic words at all just looks like a bug, or an oversight, or a misfeature or whatever. From some more testing it looks like some "magic word" behaviour gets interpereted in piped links and some doesn't - http:// links *don't* override the actual link for instance.
---- end copy ----
Stephen Bain and I were also wondering about the history of the ISBN magic word. When did it appear, what was the reasoning etc? Since it can be implemented perfectly well as a normal template ([[Special:Booksources/isbn{{{1}}}|ISBN {{{1}}}]]), was the decision to make it a magic word just a legacy thing to make thousands of existing ISBN's suddenly "come to life"?
Also, is it documented anywhere? Haven't looked anywhere except http://meta.wikimedia.org/wiki/Help:Magic_words .
Thanks very much, Steve
On Mon, Aug 07, 2006 at 05:02:19PM +0200, Steve Bennett wrote:
Stephen Bain and I were also wondering about the history of the ISBN magic word. When did it appear, what was the reasoning etc? Since it can be implemented perfectly well as a normal template ([[Special:Booksources/isbn{{{1}}}|ISBN {{{1}}}]]), was the decision to make it a magic word just a legacy thing to make thousands of existing ISBN's suddenly "come to life"?
It's a very old feature, much older than templates.
Regards,
jens
On 8/7/06, Jens Frank jf@mormo.org wrote:
It's a very old feature, much older than templates.
Is there any chance we want to deprecate it, since it's basically obsolete now?
Steve
On 8/7/06, Steve Bennett stevage@gmail.com wrote:
Is there any chance we want to deprecate it, since it's basically obsolete now?
Is there any particular reason to add to the wikimarkup an average editor has to encounter, however slightly?
On 8/7/06, Simetrical Simetrical+wikitech@gmail.com wrote:
Is there any particular reason to add to the wikimarkup an average editor has to encounter, however slightly?
Whenever beneficial, yep.
Some (fairly minor) benefits: *You could easily compile a list of all ISBNs referred to on WP (god knows what you'd do with it) *If we implemented similar templates, like ASIN's (amazon) or something, the syntax would be the same. See http://en.wikipedia.org/wiki/Sumner_Welles for an example of a page that mixes ISBN's (which work) with ASIN's (which do nothing) *From the same page, text like this would actually work: "ISBN 0312174403 / 0-312-17440-3". It's actually a good example of where an {{ISBN}} template would actually be useful: you could make that second number a link, which currently it isn't, because it's not directly preceded by the magic word. * The syntax of MediaWiki would be reduced that little bit more, making compatibility with other wiki's easier, and making parsing it easier. Again, pretty minor considering that there's no huge loss for any wiki that doesn't support magic ISBN's - but if we implemented them as templates, they'd get them for free. * With parser functions, we could actually attempt to validate the ISBN's rather than passing them blindly. According to [[:en:International Standard Book Number]], they should be either 10 or 13 digits long, and have a checksum. Our magic word accepts "1" as a "valid" ISBN.
Basically, all the logic about ISBN's is apparently hardcoded into MediaWiki, which is a pretty awful place for it, when you think about it. It's pretty doubtful that if someone requested on this mailing list today for this functionality to be implemented, that that request would be granted.
I do acknowledge the triviality of this issue, though.
Steve
On 8/7/06, Steve Bennett stevage@gmail.com wrote:
*From the same page, text like this would actually work: "ISBN 0312174403 / 0-312-17440-3". It's actually a good example of where an {{ISBN}} template would actually be useful: you could make that second number a link, which currently it isn't, because it's not directly preceded by the magic word.
Well, you can still make it a link manually, you know. Templates aren't going to *improve* that.
- The syntax of MediaWiki would be reduced that little bit more,
making compatibility with other wiki's easier, and making parsing it easier. Again, pretty minor considering that there's no huge loss for any wiki that doesn't support magic ISBN's - but if we implemented them as templates, they'd get them for free.
That's certainly true, but very minor. Once we get a formal grammar pinned down, anyone could easily implement a parser based on it.
- With parser functions, we could actually attempt to validate the
ISBN's rather than passing them blindly. According to [[:en:International Standard Book Number]], they should be either 10 or 13 digits long, and have a checksum. Our magic word accepts "1" as a "valid" ISBN.
That would be *hell* to do with parser functions, if it's even possible (I can't see how it is without string functions). It would be very simple in PHP.
Basically, all the logic about ISBN's is apparently hardcoded into MediaWiki, which is a pretty awful place for it, when you think about it.
I agree that a wiki concept is probably better, but a) that's possible already; you could make the templates yourself if you want to fill in gaps and b) maybe we should think about extending the current syntax to parse more ID-type things, rather than removing the parsing we already have going on. If anyone has a useful ID format to share, why not add it as an option for installers? Maybe move this all to an extension?
Steve Bennett-4 wrote:
*From the same page, text like this would actually work: "ISBN 0312174403 / 0-312-17440-3". It's actually a good example of where an {{ISBN}} template would actually be useful: you could make that second number a link, which currently it isn't, because it's not directly preceded by the magic word.
That was broken because whoever entered it failed to realise that the ISBN magic word works just fine with an ISBN containing hyphens: if you check that, it's actually the same number.
HTH HAND
On 8/8/06, Phil Boswell phil.boswell@gmail.com wrote:
*From the same page, text like this would actually work: "ISBN 0312174403 / 0-312-17440-3". It's actually a good example of where an {{ISBN}} template would actually be useful: you could make that second number a link, which currently it isn't, because it's not directly preceded by the magic word.
That was broken because whoever entered it failed to realise that the ISBN magic word works just fine with an ISBN containing hyphens: if you check that, it's actually the same number.
Heh, ok - didn't notice that. Presume that they had actually meant to give two slightly different ISBN's, such as for two different editions of the same book.
Ok, now it's time I stop boring everyone with this issue :)
Steve
wikitech-l@lists.wikimedia.org