Sort references by short name

The previous code relied on the (undefined) iteration order of sets.
(I happened to get a different order on css-syntax.)

The sorting criteria is kind of arbitrary.
It could be by order of first reference,
or anything we know about the refs.
Merge pull request #4 from SimonSapin/sort-refs

Sort references by short name