Extend TOC macros to use caption field

Now the `caption` field is used for the text of each entry, if present,
falling back to the `title` field.