switch to JSON for .exam files

.exam files are now written in JSON, prepended with a line of the form
	// <version number>
so that we can upgrade old files automatically if we ever change the format.
Merge branch 'master' into file-versions
move version migrations into their own file

and a couple of migrations: the 'type' thing records whether an object is a question or an exam, and variables are now objects instead of just strings, so we can add extra fields
Merge branch 'master' into file-versions
change .exam header format

the header at the top of .exam files is now of the form
	// Numbas version: <version string>
so it's more clear what that line is for
compile variable definitions properly

now variables are objects with a few properties
add migrations.py
tryLoad is case-insensitive in souyrce key names
add support for custom marking scripts

each part now has a dictionary `scripts`, the values of which should be javascript code to replace the built-in function with the same name as the key.
Currently, `mark` and `validate` are supported.
Merge branch 'custommarking' into file-versions
Merge branch 'master' into file-versions
table cells have a background, not whole tables

looks better when there are missing cells
fix tryLoad on dicts when the key name is in the wrong case

No idea how this bug still existed!
Merge branch 'master' into file-versions
always try to detect the type of a NumbasObject

For some reason, I had a question without the "type" attribute. Here's a hacky fix.
use node.cloneNode instead of $(node).clone()

jQuery does something special with `<script>` tags, assuming its input is HTML. For XML, it looks like it's safe to just use `node.cloneNode` across Chrome/Firefox/IE9+.
another get-default in the migration script