A bunch of related fixes to the code for parsing the state and API yaml files:
1. Some of our objects are {key: {key: value}} - style nested key/value
dictionaries. Handle this by refactoring get_json_schema_object_fields so
that such objects are handled wherever they appear, rather than when they
are just subproperties of a 'proper' object.
2. Fix multi-level inheritance (so an object can have an 'allOf' property which
can successfully refer to an object which itself has an 'allOf' property).
3. $ref fields in event schemas weren't being expanded correctly
4. sort type tables breadth-first rather than depth-first so that the ordering
in complex structures like the /sync response makes a bit more sense.
Allow columns to stretch if they end up with wide content.
Apart from the hassle of having to manually update the calculations, having the
columns wide enough to hold the widest thing they might ever have leads to
tables with lots of whitespace in the results.
Add table detailing the profiles. Add anchors to link through to each module
following a well-defined format (rather than the name of the module section).
Allow UTF-8 in the spec.
This allows us to incrementally convert sections of the spec to use this
templating system. E.g. './build.py ../specification/20_events.rst' where
that .rst file has {{room_events}} in it somewhere. Add ability to show
a list of valid template vars to use (e.g. room_events) by running
'./build.py --show-template-vars'.