Move section_heading to the corresponding reference_list object.
Only add reference_list if the section is empty after the heading and reference_list content are removed.
We still want to keep all the references_by_id entries, regardless of whether they show up in a reference list or not since we need that quick lookup still to work.
Previously we had separate objects for section_heading, like this:
"reference_lists": [ { "type": "section_heading", "id": "References", "html": "References" }, { "type": "reference_list", "id": "#mwt4", "order": [ "ref2-1" ] } ],
Now we want to make the section_heading part of the reference_list, like that:
"reference_lists": [ { "type": "reference_list", "id": "#mwt4", "section_heading": { "id": "References", "html": "References" }, "order": [ "ref2-1" ] } ]