Utilisateur:Kalfch/Cartes/Documentation

Modèle:Documentation subpage

52-card deck

modifier

Card ranks from Standard 52-card deck:

56-card deck

modifier

Card ranks from 56-card deck:

You may use "r" (red) or "b" (black) suit:

Or maybe use the parameters "rank_name" and "suit_name" (details see below, the "Advanced usage" section) to get a full name:

Symbols that indicate any or unknown card rank:

Customized card

modifier

Actually any string will be allowed to be shown as a "card", e.g.: {{Cards|Cd}} = Modèle:Cards, {{Cards|Vs}} = Modèle:Cards, {{Cards|€h}} = Modèle:Cards, {{Cards|勾c}} = Modèle:Cards

If one of "s", "h", "d", "c", "r", "b" in lower or upper case, and ♠, ♥, ♦, ♣ is at the end, it will be thought as a suit. A "&" symbol can be used to escape, as: {{Cards|R&}} = Modèle:Cards, {{Cards|Joker&}} = Modèle:Cards, {{Cards|♥♥&}} = Modèle:Cards

The first letter of "a", "k", "q", "kn", "j", "jkr" and "x" will be capitalized. To prevent it, put them in a <span></span>: {{Cards|<span>k</span>s}} = Modèle:Cards

Compound use

modifier

Other note

modifier

Predefined strings: "a", "k", "q", "kn", "j", "jkr", "x", and "s", "h", "d", "c", "r", "b", are case insensitive when parsed.

The number of the basic, non-named parameters (for cards) should be from 1 to 15.

Advanced usage

modifier

Description of all parameters

modifier
{{Cards
| <!-- first card's rank and/or suit,
as described above in the "Basic" section -->
| <!-- second card --><!--
... 15 max. -->
| separator      = 
| sortable       = <!-- "yes" or anything else -->
| rankname       = <!-- "full" or anything else -->
| suitname       = <!-- "full" or "letter" or anything else -->
| hand_style     = 
| spades_color   = 
| hearts_color   = 
| diamonds_color = 
| clubs_color    = 
| card_style     = <!--
| use_image      = -->
}}
Clk
to
sort
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Clk
to
sort
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Click
to
sort
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Click to sort
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards
Modèle:Cards

All these parameters are optional.

  • separator: separator that separates every card, default is a non-breaking space (&nbsp;)
  • sortable: may be "yes" or anything else:
    • yes: add a hidden key to indicate the card rank and suit's level to make it sortable in a table; card ranks from highest to lowest: Jkr, A, K, Q, Kn, J, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, then anything else; suits from highest to lowest: ♠, ♥, ♦, ♣, red, black, then those without suit indicated; note that it can only tell first card's rank, then the second card's rank, ..., it may not reflect the hand's actual value when it includes 2 or more cards
    • Anything else (incl. leaving blank or not presenting this parameter): default, not do it
  • rank_name: "full" or anything else:
    • full: full rank name: "Joker", "Ace", "King", "Queen", "Knight", "Jack", "11", "10", "9", ...
    • Anything else (incl. leaving blank or not presenting this parameter): default, normal abbr. rank name: "Jkr", "A", "K", "Q", "Kn", "J", "11", "10", "9", ...
  • suit_name: "full" or "letter" or anything else:
  • hand_style: CSS style for the hand <b style="" class="pokerhands"></b>
  • spades_color, hearts_color, diamonds_color, clubs_color: color (CSS color value, like "#FFFFFF" or "white") for cards of every suit; default is 2 black and 2 red; with these parameters, you may make it a 4-color deck: {{Cards|Ac|Kd|10s|2h|diamonds_color=blue|clubs_color=green}} = Modèle:Cards
  • card_style: CSS style for every card <span style="" class="playingcards"></span>
  • use_image: (not yet implemented) use images to show the cards

HTML, class names and CSS

modifier

The HTML markup produced by this template includes a microformat, it uses rich semantic class names including: "pokerhands", "playingcards", "spades", "hearts", "diamonds", "clubs", "cardranks", "cardsuits", which makes the details parsable by computers.

For example, {{Cards|Ac|10♥|Knd|?|J|s}} generates Modèle:Cards, whose HTML markup is:

<!-- sortable hidden key, if needed, is inserted before <b /> and is like:
<span class="sortkey" style="display:none;">&140&10&100&30&115&20&000&00&110&00&105&40</span> -->
<b style="" class="pokerhands"><!-- value of 'hand_style', if exists, is added here inside 'style=""' -->
	<span style="color:black;" class="playingcards clubs"><!-- 'black' will changed to 'clubs_color''s value if defined;
'card_style''s value, if exists, is added here inside 'style=""', and after the color value;
same things apply to below ones -->
		<span class="cardranks">A</span><span class="cardsuits">&clubs;</span>
	</span>&nbsp;<!-- &nbsp; will be replaced by user defined 'separator' if there is one;
same thing applys to below ones -->
	<span style="color:red;" class="playingcards hearts">
		<span class="cardranks">10</span><span class="cardsuits">&hearts;</span>
	</span>&nbsp;
	<span style="color:red;" class="playingcards diamonds">
		<span class="cardranks">Kn</span><span class="cardsuits">&diams;</span>
	</span>&nbsp;
	<span style="" class="playingcards"><!-- 'card_style''s value, if exists, is added here inside 'style=""';
same thing applys to below one -->
		<span class="cardranks">?</span>
	</span>&nbsp;
	<span style="" class="playingcards">
		<span class="cardranks">J</span>
	</span>&nbsp;
	<span style="color:black;" class="playingcards spades">
		<span class="cardsuits">&spades;</span>
	</span>
</b>

Template for playing cards, will automatically color the suits with the standard red/black. To see a typical 4-color deck, copy the following into your user style sheet (Special:MyPage/common.css for the common CSS):

/* Standard four-color deck */
.diamonds { color: blue !important }
.clubs { color: green !important }
modifier

Modèle:Esoteric

See also

modifier