Tweak categories handling, fix space-comma-space

This fixes an awkward space-comma-space in article category display due
to line breaks.

It also makes fewer assumptions about setting of `category1` and
`category2` - for example, now just `category2` can be set and it won’t
display the comma-space if `category1` isn’t set.