Predefined compound formatting support

Units can now define compound formatting templates. Also reworked
compound formatting implementation a bit.