This repository has been archived on 2026-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cardmaker/resources/cards/card.vm
T

186 lines
6.0 KiB
Plaintext

<!DOCTYPE html>
<link rel="stylesheet" href="card.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.0.46/css/materialdesignicons.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
#macro(figure $card)
#foreach($figure in $card.figure_parsed)
#figure_embed($figure)
#end
#end
#macro(figure_embed $fig)
#if($fig.source == "material-icons")
<!--https://material.io/icons/-->
<i class="material-icons figure" #figure_style($fig)>$escape_html($fig.filename)</i>
#elseif($fig.source == "mdi")
<!--https://materialdesignicons.com/-->
<i class="mdi mdi-$escape_html($fig.filename)" #figure_style($fig)></i>
#elseif($fig.source == "fa")
<!--http://fontawesome.io/icons/-->
<i class="fa fa-$escape_html($fig.filename)" #figure_style($fig)></i>
#elseif($fig.source == "svg")
<!--/cards/svg-->
<!--<img class="svg_filter" src="/svg/${escape_html($figure)}.svg">-->
#set($color = "")
#if($fig.color)
#set($color = "?color=${fig.color}")
#end
<img src="/svg/${escape_html($fig.filename)}.svg$color" #figure_style($fig)>
#end
#end
#macro(figure_style $fig)
style="
top:${fig.top}px;
right:${fig.right}px;
bottom:${fig.bottom}px;
left:${fig.left}px;
#if($fig.source == "svg") ## Unsupported with other sources due to being fonts, not images **
#if($fig.autoscale)
height:calc(100% - ${fig.size}px);
#else
height:${fig.scale}%;
#end
#elseif($fig.color)
#set($H = "#") ## Easiest way to escape the # character **
color: ${H}${fig.color};
#end
transform:rotate(${fig.rotate}deg)"
#end
#macro(specialFlags $card)
#if($card.has_flag("mastery"))
<big>
&#x274F; &#x274F; &#x274F; &#x274F; &#x274F;
&#x274F; &#x274F; &#x274F; &#x274F; &#x274F;
</big>
#end
#if($card.has_flag("pokehum"))
<big>
Name: ______________
</big>
#end
#end
#macro(statIcons $text)
#foreach($word in $text.split())
#if($word == "BODY")
<i class="mdi mdi-human"></i>
#elseif($word == "TEC")
<i class="fa fa-wrench"></i>
#elseif($word == "MAG")
<i class="fa fa-magic"></i>
#elseif($word == "ATT")
<small>ATT</small>
#else
$word
#end
#end
#end
#macro(handleCostUnit $cost $match)
<div class="costunit">
$escape_html($strip_unit($cost, $match))<br/>
<small>$escape_html($match)</small>
</div>
#end
#macro(effectList $effects)
<ul>
#foreach($effect in $effects)
#if($effect)
<li>$escape_html($effect)</li>
#end
#end
</ul>
#end
<title>Cards</title>
#foreach($card in $cards)
#set($card_is_item = false)
#foreach($flag in ["Consumable", "Title", "Food", "Trinket", "Crafting Material", "Collectible", "Alchemy Material", "Ammo", "Splash", "Thrown", "Draw Card", "Passive", "Melee Weapon", "Arc Weapon", "LoS Weapon"])
#if($card.flags.__contains__($flag)) #set($card_is_item = true) #end
#if($card.flags.__contains__($flag.lower())) #set($card_is_item = true) #end
#end
#if($card_is_item)
<article id="$escape_html($card.filename)" class="item" onclick="location.href='creator?filename=$escape_html($card.filename)'">
#elseif($card.effects)
<article id="$escape_html($card.filename)" class="effects" onclick="location.href='creator?filename=$escape_html($card.filename)'">
#else
<article id="$escape_html($card.filename)" onclick="location.href='creator?filename=$escape_html($card.filename)'">
#end
<h1>$escape_html($card.title)</h1>
<figure>
#figure($card)
</figure>
#if($card.effects && ! $card_is_item)
#effectList($card.effects)
#end
<section>
#if($card.cp)
<div class="cp">$escape_html($card.cp)</div>
#elseif($card.gp)
<div class="gp">$escape_html($card.gp)</div>
#end
#foreach($cost in $card.cost.split(","))
#if($cost.upper().endswith(" ACT"))
#handleCostUnit($cost, "ACT")
#elseif($cost.upper().endswith(" OVERDRIVE"))
#handleCostUnit($cost, "OVERDRIVE")
#elseif($cost.upper().endswith(" COMBO"))
#handleCostUnit($cost, "COMBO")
#elseif($cost.upper().endswith(" DIFFICULTY"))
#handleCostUnit($cost, "DIFFICULTY")
#else
#if($cost.strip())
<div class="cost">$escape_html($cost.split())</div>
#end
#end
#end
#if($card.power)
<div class="power">#statIcons($escape_html($card.power))</div>
#end
</section>
<main>
$escape_html($card.description)
#if($card.steps)
<ol>
#foreach($item in $card.steps)
#if($item)
<li>$escape_html($item)</li>
#end
#end
</ol>
#end
#if($card.effects && $card_is_item)
#effectList($card.effects)
#end
#if($card.flags)
<div class="bottom">
<small>
-
#foreach($flag in $card.flags)
#if(!$flag && $foreach.hasNext)
- <br> -
#else
$escape_html($flag.capitalize())#if($foreach.hasNext), #end
#end
#end
-
</small>
<br>
#specialFlags($card)
</div>
#end
</main>
</article>
#end
#if($was_saved)
<center class="message">The card has been saved</center>
#end
#if($was_deleted)
<center class="message">The card has been removed from storage</center>
#end