Use parent's sort order (if present) in diff view

Appendices will sometimes have an 'h1' after a 'p1', and other oddities that force us to pay attention to the original ordering when generating a diff.

This patch sorts the children of a new node by that original ordering, but only if all the ordered nodes are present (and no others). This is similar to the code used in notice compilation in the parser.