Make new/newdir/tempfile/tempdir handle templates consistently

They now all take either a leading template argument or a TEMPLATE
value.

Documentation hasn't been heavily revised to reflect this, but
at least the code will DWIM now.