Some background: the yu-gi-oh tag has passed the 100 Q milestone; now anyone may earn its tag badge. It is also part of our Top 15 tags on the site (currently #11 from all tags, and #8 if you count games only), so in general seems to be an important tag for the site that is growing.
I was looking at the autocard support for MTG, and I was thinking that something similar would be useful for YGO cards (as manually searching and pasting the links can be cumbersome when including several card examples). After doing some research and thinking it here is what I found and propose:
One useful site that could be the target of the linking is Yu-Gi-Oh! Wikia. This site has a thorough documentation of all the cards (effects, descriptions, ruling, etc.), and even of some anime and OCG cards.
The suggested syntax could be something like
[ygo:Celtic Guardian]
, which would lead to http://yugioh.wikia.com/wiki/Celtic_Guardian .The URLs support the use of whitespace instead of underscores (the wiki automatically inserts them)1.
The URLs also support special characters like hyphens, commas, apostrophes, etc2.
1Playing a bit with that Wiki I found this could help the feature require less code and effort, as the URL link also supports whitespace instead of underscores. This means that you can type http://yugioh.wikia.com/wiki/Celtic Guardian
and still get to the same page.
2This Wiki would also be great for cards that have special characters on their names (a past problem with the MTG autocard it seems). Doing some tests I found that there is no problem in including such characters on the URL. It even supports whitespaces and special characters. Some cards I tested successfully were:
Lyla, Lightsworn Sorceress: You can leave the comma and remove underscores, so the URL
yugioh.wikia.com/wiki/Lyla, Lightsworn Sorceress
works.Black Luster Soldier - Envoy of the Beginning: This card too, you can use whitespace and leave the hyphen, so
yugioh.wikia.com/wiki/Black Luster Soldier - Envoy of the Beginning
works.T.A.D.P.O.L.E.: As we can see this unusual card name is also properly handled with the URL
http://yugioh.wikia.com/wiki/T.A.D.P.O.L.E.
Finally Swallow's Nest: You can again use whitespaces and leave the apostrophe in place, for which the following URL works:
yugioh.wikia.com/wiki/Swallow's Nest
So, this is what I propose, and would like to know what you think about it. Any suggestions that could help achieve this goal?
Text transformations needed
Convert all spaces to underscores.
Further testing and discussion confirmed that the YuGiOh Wikia supports special characters, with some exceptions. The only unsupported special character that has ever shown up in a card name though is #
. To handle this, remove all instances of the character #
from card names whilst generating autocard links. For cards like Winged Dragon, Guardian of the Fortress #1, the name is transformed from:
Winged Dragon, Guardian of the Fortress #1
to
Winged Dragon, Guardian of the Fortress 1
and then spaces are converted to underscores, so the link would be:
http://yugioh.wikia.com/wiki/Winged_Dragon,_Guardian_of_the_Fortress_1
# < > [ ] | { }
; if any of those ever appear in a Yu-Gi-Oh! card name, the wiki editors would have to figure out alternative page titles for those cards.#
appears on quite a few cards, although perhaps that won't be an issue since they are almost all from some of the earliest sets.