make sure TemplateLine exists
set line number for literal string output
add testcase for ticket 3011