Add optional injection of external templates for sections.

Rebased #56 and expanded the code.