16

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)

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

3 Answers 3

9

The Autocard feature has been updated to use the new url format, and to improve on our encoding of card names so as to fix many (hopefully all) of issues with the old one. Here are some of my test cases:

Note: the code that inserts links here runs server-side, as part of the process for savingt a new revision (it is not run client-side, no JS is used). So old posts that need the updated logic will not show up with the new links until a new revision is saved.

Thanks for your patience on this one. As a former MTG player (I used to run black/blue and red/green decks when I started during 4th edition), happy to work on this one.

1
  • 2
    Thank you very much for the code update! Mar 24, 2021 at 22:46
3

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/cmo1prfu/

Eldraine update 23 Oct 2019: This also passes test cases introduced by Eldraine which break in the current autocard. Those test cases are adventurer cards and their corresponding adventures, and the new card Dwarven Mine which has a name that's a subset of Dwarven Miner. Here's their broken current autocard links: Bonecrusher Giant, Stomp, Dwarven Mine. Here's their working links in the new format: Bonecrusher Giant, Stomp, Dwarven Mine.

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.:

4
  • Both Ghazban Ogress links work fine for me. Using Chrome on Windows.
    – Rainbolt
    Nov 5, 2018 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. Nov 5, 2018 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, 2018 at 13:49
  • I just added these to my answer and the link works for all of them for me.
    – Joe W
    Jan 10, 2022 at 20:59
3

Adding an answer with all the example cards as a quick way to check some of cards that are not in the latest update post.

Lightning Bolt
Death's Shadow
Island
Curiosity
Sun Titan
Platinum Angel
Hell's Caretaker
Bonecrusher Giant
Stomp
Dwarven Mine
Raven's Run
Very Cryptic Command
Garbage Elemental
Knight of the Kitchen Sink
Ineffable Blessing
Sly Spy
Everythingamajig
Ghazban Ogress

If you want to test in another language here is a link for changing the default. https://gatherer.wizards.com/Pages/Language.aspx (Thanks to doppelgreener)

You must log in to answer this question.

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