nuria.lua: Write used Tria version into output file
Further fixes for handling templated code