mirror of
https://github.com/Cockatrice/Magic-Token.git
synced 2026-03-23 02:24:32 -05:00
Tokens.xml for M:tG
less lazy script but still bash:
\#!/bin/bash
tag="reverse-related"
relationrx="<$tag([^>]*)>([^<]*)</$tag>"
numberrx='[0-9]+'
declare -A list # associative array
while IFS= read -r line; do
if [[ $line =~ $relationrx ]]; then
yes=1
name="${BASH_REMATCH[2]}"
args="${BASH_REMATCH[1]}"
if [[ $args =~ $numberrx ]]; then
args="$(printf "%03d" "${BASH_REMATCH[0]}")$args"
fi
list[ "$name$args"]="$line"
keys+="
$name$args"
elif [[ $yes ]]; then
# LC_ALL=C determines the sort behavior!
<<<"${keys:1}" LC_ALL=C sort --ignore-case | while read -r key; do
echo "${list[ $key]}"
done
yes=""
list=()
keys=""
echo "$line"
else
echo "$line"
fi
done <tokens.xml | sponge tokens.xml
|
||
|---|---|---|
| .github/workflows | ||
| challenge_tokens.xml | ||
| LICENSE | ||
| README.md | ||
| tokens.xml | ||
| version.txt | ||
Magic-Token 
This repo contains token information in Cockatrice's XML card database format for Magic: The Gathering.
It describes individual tokens with linked art and the relation to their creators.
For normal tokens, save the file found here: tokens.xml
For tokens from the Theros block challege decks, save the file found here: challenge_tokens.xml