Fix generation of diagrams with titles

The format for title is a single line and doesn't require "end title".