Template:Scryfall search: Difference between revisions

From MTG Wiki
Jump to navigation Jump to search
>Yandere-sliver
mNo edit summary
>Jerodast
m (Undo revision 476332 by Jerodast (talk) - actually I think it was a param problem not a logic problem)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}|[https://scryfall.com/search?q=<!--
<includeonly>{{#if:{{{1|}}}|[https://scryfall.com/search?q=<!--
  -->{{#if:{{{2|}}}|{{{2|}}}%3A}}<!-- adds the search type if given
   -->{{#ifeq:{{{2}}}|raw<!--
   -->{{#ifeq:{{{2|}}}|is<!-- if the search type is "is", skip the quotations
     -->|{{urlencode:{{{1}}}}}<!-- raw search: exactly as given, no prefix, no enclosure
     -->|{{#replace:{{{1|}}}| |+}}<!--
     --><!--
     -->|%22{{#replace:{{{1|}}}| |+}}%22<!--
    -->|{{#if:{{{2|}}}|{{{2}}}%3A}}<!-- adds the search type if given; %3A is a URL-encoded colon :
  -->}}<!--
    -->{{#ifeq:{{{2}}}|is<!-- if the search type is "is", skip the quotations  
  -->{{#if:{{{add|}}}|+{{urlencode:{{{add|}}}|PATH}}}} <!-- additional search options that automatically will be url encoded.
      -->|{{urlencode:{{{1}}}}}<!--
  -->{{#if:{{{display|}}}<!-- if you want to display something different then the search phrase
      -->|{{urlencode:{{{enclose|"}}}{{{1}}}{{{enclose|"}}}}}<!--
    -->|{{#replace:{{{display|}}}|]|&#93;}}<!-- closing bracket is escaped do avoid issue with the wiki formatting.
    -->}}<!--
    -->|{{#if:{{{2|}}}<!--
      -->|{{{2|}}}:{{#ifeq:{{{2|}}}|is<!-- again if the search type is "is", skip the quotations  
        -->|{{#replace:{{{1|}}}|]|&#93;}}<!--
        -->|"{{#replace:{{{1|}}}|]|&#93;}}"}}<!--
      -->|{{{1|}}}<!--
    -->}}<!--
   -->}}<!--
   -->}}<!--
-->]}}</includeonly><noinclude>
  -->{{#if:{{{color|}}}|+color%3D{{{color}}}}}<!-- additional exact color; %3D is a URL-encoded equals sign =
==Parameters==
  -->{{#if:{{{add|}}}|+{{urlencode:{{{add}}}|PATH}}}}<!-- additional URL-encoded search options
*<code>{{{1}}}</code>: Search phrase
  --> <!-- intentional space before display text
*<code>{{{2}}}</code>: Search type (is, watermark, lore, fulloracle, artist, etc.)
  -->{{#if:{{{display|}}}<!-- if you want to display something different than the search phrase
*<code>{{{display}}}</code>: If another thing then the search phrase should be displayed
    -->|{{#replace:{{{display}}}|]|&#93;}}<!-- closing bracket is escaped do avoid issue with the wiki formatting.
*<code>{{{add}}}</code>: Make the search more specific.
    -->|{{#ifeq:{{{2}}}|raw<!-- else display search itself (no custom display)
==Examples==
      -->|{{#replace:{{{1}}}|]|&#93;}}<!-- raw search - exactly as given, other than closing bracket escape
*<nowiki>{{Scryfall search|Circle of Protection}}</nowiki> - {{Scryfall search|Circle of Protection}}
      -->|{{#if:{{{2|}}}<!--
*<nowiki>{{Scryfall search|Circle of Protection|add=-is:funny}}</nowiki> - {{Scryfall search|Circle of Protection|add=-is:funny}}
        -->|{{{2}}}:<!-- first the search type (if any)
*<nowiki>{{Scryfall search|Dimir|watermark}}</nowiki> - {{Scryfall search|Dimir|watermark}}
          -->{{#ifeq:{{{2}}}|is<!-- again if the search type is "is", skip the quotations
*<nowiki>{{Scryfall search|Dimir|watermark|display=[Just Dimir]}}</nowiki> - {{Scryfall search|Dimir|watermark|display=[Just Dimir]}}
            -->|{{#replace:{{{1}}}|]|&#93;}}<!--
*<nowiki>{{Scryfall search|manland|is}}</nowiki> - {{Scryfall search|manland|is}}
            -->|{{{enclose|"}}}{{#replace:{{{1}}}|]|&#93;}}{{{enclose|"}}}}}<!--
 
        -->|{{{1}}}<!-- else plain/name search display (no search type specified)
      -->}}<!--
    -->}}<!--
  -->}}<!--
-->]<!--
-->|Template error: Scryfall search missing search term.[[Category:Pages with template calls missing required parameters]]<!--
-->}}<!--
-->{{#if:{{{date|}}}|. Retrieved from Scryfall on {{{date|}}}.}}</includeonly><noinclude>{{Documentation}}
[[Category:Magic product templates]]</noinclude>
[[Category:Magic product templates]]</noinclude>

Latest revision as of 01:27, 4 April 2023

 Template Documentation[view | edit | history | purge]
This is a template documentation subpage for Template:Scryfall search.
It contains usage information, categories, interlanguage links and other content that is not part of the original template page.

Parameters

  • {{{1}}}: Search phrase. Required.
  • {{{2}}}: Search type (is, watermark, lore, fulloracle, artist, etc. Use "raw" if you want search exactly the search phrase.)
  • {{{enclose}}}: Defaults to ", can be set to / to enable regular expressions
  • {{{display}}}: If another thing then the search phrase should be displayed
  • {{{color}}}: Choose the exact color to be selected
  • {{{add}}}: Make the search more specific
  • {{{date}}}: The date of the search

Other usage notes

  • Use {{!}} to stand in for a pipe character | for use in regular expression search.
  • Use {{=}} to stand in for an equals sign = for use in regular expression search or with numerical fields.
  • Pages using this template display warnings and appear on Category:Pages with template calls missing required parameters if they do not provide the required {{{1}}} parameter.

Examples

The above documentation is transcluded from Template:Scryfall search/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories and interwikis to the /doc subpage. Subpages of this template.