12

This used to be an answer. Now it is a feature request.

The Autocard feature for Magic: the Gathering was updated in 2016. Since then the community has discovered a couple of bugs. We also found a solution that addresses those bugs, doesn't reintroduce old bugs, and as a bonus adds support for multiple languages.

Here are some test cases from bugs we've had in the past:

  • Regular cards (Lightning Bolt)
  • Cards with apostrophes (Death's Shadow)
  • Single word cards whose names are a subset of another card (Island, Curiousity)
  • Double word cards whose names are a subset of another card (Sun Titan)
  • Cards that are also an avatar (Platinum Angel)
  • Both an apostrophe, and an avatar (Hell's Caretaker)

A separate bug is that whilst we usually link card names in English, if a visitor's PC is configured to another language (e.g. German or Japanese) Gatherer completely fails to find the card. (Because it looks for the card name in their language's list, not in the English list.)

Test Results for the current autocard link as of 2018-05-27

See the test run here. If the link took me directly to the one card I was searching for, it passed. Otherwise it failed. I copied the URLs that were produced, in case they change retroactively. The base URL is always gatherer.wizards.com/Pages/Search/Default.aspx.

  • Pass: [mtg:Lightning Bolt] -> ...?name=%2b%5bLightning%20Bolt%5d
  • Pass: [mtg:Death's Shadow] -> ...?name=%2b%5bDeath%27s%5d%2b%5bShadow%5d
  • Fail: [mtg:Island] -> ...?name=%2b%5bIsland%5d
  • Pass: [mtg:Sun Titan] -> ...?name=%2b%5bSun%20Titan%5d
  • Fail: [mtg:Platinum Angel] -> ...?name=%2b%5bPlatinum%20Angel%5d
  • Pass: [mtg:Hell's Caretaker] -> ...?name=%2b%5bHell%27s%5d%2b%5bCaretaker%5d

Solution — A new Gatherer autocard format

The community came up with a solution that is almost a one-liner in JavaScript.

function urlFrom(cardName) {
    const baseUrl = 'http://gatherer.wizards.com/Pages/Card/Details.aspx'
    var queryString = '?name=' + encodeURIComponent(cardName)
    return baseUrl + queryString;
}

Or:

http://gatherer.wizards.com/Pages/Card/Details.aspx?name=Platinum%20Angel

No brackets or pluses. Using this URL also fixes the language bug.

Here's a fiddle demonstrating that the solution works. The links in this fiddle point to every card we've found that may cause bugs for Autocard linking (or are bug examples), and all the links pass.

https://jsfiddle.net/ws165r64/52/ (See doppelgreener's answer for a fiddle with a more comprehensive test suite)

  • The community is doing really good work here. – Alex P Jul 2 '18 at 22:36
1

I've run through the jsfiddle test battery to double check results.

I've also made an updated battery that removes some duplicates and consolidates cases in the Javascript: https://jsfiddle.net/ws165r64/53/

English language: some minor breaks

  • "Soldier" doesn't link to the token, just a search page listing cards with Soldier in their name (no tokens). This is fine, not being able to link to tokens isn't a big deal especially considering a Soldier token can be like nine different things.
  • Split cards can only be referenced by one side: the links to Alive, Well, Insult, and Injury all work. None of the joined combinations work (e.g. Alive // Well, Trial / Error, Insult /// Injury with or without spaces). This means for split cards we only link to sides and would have to write [mtg:Alive] // [mtg:Well] if we wanted the full card linked.
  • Who // What // When // Where // Why works, but the single-slash variation doesn't.

Some accented card names have to be spelled precisely. The following fail if they are missing any special characters:

  • Ring of Ma'rûf (cannot be spelled "Ring of Ma'ruf" or "Ring of Maruf")
  • The Ultimate Nightmare of Wizards of the Coast® Customer Service (cannot be written without the reserved sign)

Just "Emrakul" is in the list, and leads to a search page since there isn't any one card called that. That's fine. Emrakul, the Aeons Torn works: http://gatherer.wizards.com/Pages/Card/Details.aspx?name=Emrakul%2C%20the%20Aeons%20Torn

Foreign language differences

These are tried after I set my Gatherer language to Japanese, German, and Korean. This section documents any difference from the English experience.

The cards from Unstable with functional variants all break:

X is fine: http://gatherer.wizards.com/Pages/Card/Details.aspx?name=X and so are all other silver bordered cards on the list from Unhinged and Unglued.

Cards with special characters must be spelled exactly or else they fail, e.g.:

  • Both Ghazban Ogress links work fine for me. Using Chrome on Windows. – Rainbolt Nov 5 '18 at 13:46
  • 1
    @Rainbolt Did you set your Gatherer to another language first, and do you have any scripts running that might replace the link (like SOUP)? They should both work in English, but for other languages the non-accented version breaks. – doppelgreener Nov 5 '18 at 13:48
  • Oh, no. Sorry, I thought that was a different part of the answer but I see the big bold heading now! – Rainbolt Nov 5 '18 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .