add missing excludes for double entries (#203)

* add missing excludes for double entries

cockatrice will actually implicitly mark the second reverse-related tag
on the same token as exclude, however we prefer to mark them explicitly,
there are only two relations that we happened to have this wrong

lazy bash:
tag="reverse-related"
relationrx="( *)<$tag([^>]*)>([^<]*)</$tag>"
exclude='exclude="exclude"'
while IFS= read -r line; do
  if [[ $line =~ $relationrx ]]; then
    space=${BASH_REMATCH[1]}
    args=${BASH_REMATCH[2]}
    name=${BASH_REMATCH[3]}
    if [[ $last_name && $name == "$last_name" ]]; then
      if [[ ! $args =~ $exclude ]]; then
        echo "$space<$tag$args $exclude>$name</$tag>"
        continue
      fi
    else
      last_name=$name
    fi
  else
    last_name=""
  fi
  echo "$line"
done <tokens.xml | sponge tokens.xml

* update version to 20230311

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
ebbit1q 2023-03-11 12:25:55 +01:00 committed by GitHub
parent 6824561b28
commit 6282826daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@
<author>Cockatrice/Magic-Token</author>
<createdAt></createdAt>
<sourceUrl>https://raw.githubusercontent.com/Cockatrice/Magic-Token/master/tokens.xml</sourceUrl>
<sourceVersion>20230310b</sourceVersion>
<sourceVersion>20230311</sourceVersion>
</info>
<cards>
<!--
@ -6623,7 +6623,7 @@ A card with morph can be turned face up any time for its morph cost.)</text>
</prop>
<set picURL="https://cards.scryfall.io/large/front/3/6/3663e79b-2bf9-44af-a638-c0ad9067d8d4.jpg?1675095429">ONE</set>
<reverse-related>Chancellor of the Forge</reverse-related>
<reverse-related count="x">Chancellor of the Forge</reverse-related>
<reverse-related count="x" exclude="exclude">Chancellor of the Forge</reverse-related>
<reverse-related>Charforger</reverse-related>
<reverse-related>Chimney Rabble</reverse-related>
<reverse-related>Churning Reservoir</reverse-related>
@ -10949,7 +10949,7 @@ Whenever you cast a creature spell, note one of its creature types that hasn't b
<reverse-related>Sidisi, Brood Tyrant</reverse-related>
<reverse-related>Skull Skaab</reverse-related>
<reverse-related>Stir the Sands</reverse-related>
<reverse-related count="3">Stir the Sands</reverse-related>
<reverse-related count="3" exclude="exclude">Stir the Sands</reverse-related>
<reverse-related count="x">Syphon Flesh</reverse-related>
<reverse-related>The Book of Vile Darkness</reverse-related>
<reverse-related>The Fourth Sphere</reverse-related>

View File

@ -1 +1 @@
20230310b
20230311