zzorba / marvelsdb-json-data

repository for marvelsdb json data
52 stars 81 forks source link

MarvelsDB cards JSON data

The goal of this repository is to store marvelsdb card data in a format that can be easily updated by multiple people and their changes reviewed.

Validating and Formatting JSON

Steps have been verified with Python 2.7.x and 3.7.x.

Set Up Python Environment

The validation script requires python package jsonschema which can be installed using pip via pip install jsonschema. It is recommended that you use a virtual environment, but this is strictly optional.

# use a virtual environment (optional)
virtualenv venv
source venv/bin/activate
pip install jsonschema

If you see an error like "No module named jsonschema" when running the script, you have not installed the jsonschema package correctly.

Run the Validation Script

To check the JSON files:

./validate.py

# or for more detailed output, include the --verbose flag

./validate.py --verbose

To check and apply formatting to JSON files:

./validate.py --fix_formatting

# or for more detailed output, include the --verbose flag

./validate.py --verbose --fix_formatting

Pack schema

Card schema

JSON text editing tips

Full description of (very simple) JSON format can be found here, below there are a few tips most relevant to editing this repository.

Non-ASCII symbols

When symbols outside the regular ASCII range are needed, UTF-8 symbols come in play. These need to be escaped using \u<4 letter hexcode>.

To get the 4-letter hexcode of a UTF-8 symbol (or look up what a particular hexcode represents), you can use a UTF-8 converter, such as this online tool.

Quotes and breaking text into multiple lines

To have text spanning multiple lines, use \n to separate them. To have quotes as part of the text, use \". For example, "flavor": "\"I'd run if I were you.\"\n - Scott Lang", results in following flavor text:

"I'd run if I were you." - Scott Lang

Game Symbols

These can be used in a card's text section. It will get converted to the appropriate icon.

Translations

To merge new changes in default language in all locales, run the CoffeeScript script update_locales.

Pre-requisites:

Usage: coffee update_locales.coffee