First pass serializing image thumbs.
- Collect all figure tokens and process them as a chunk
- This effectively mimics context-sensitive DOM walking, but since we need serialization supported on a token stream, we cannot use real DOM walking. The current technique should also work on a token stream.
- There is a FIXME about the image filename being capitalized. This needs fixing in the parser or some other way of recognizing original unnormalized filenam.
Amended by gwicke:
- Build option list and join it with pipe to avoid stray trailing pipe
- Satisfy JSHint's weird preference to have '&&' and '||' at the end of the line