I need to programatically distinguish between Jinja template files, other template files (such as ERB), and template-less plain text files.
According to Jinja documentation:
A Jinja template doesn’t need to have a specific extension: .html, .xml, or any other extension is just fine.
Jinja Authors did not define a default extension. Most of Jinja template editors like Vim extension, TextMate extension, Emacs extension, and PyCharm mention no default extension to enforce Jinja highlighting.
Django had already a similar debate about setting a default extension, and ended as a wontfix issue. I quote from the closing message:
Filetype detection based on extension is flawed for the very reasons described in these comments, so you have to do some internal inspection, just like MIME type detection works.
I suggest that you should use your own since there is no common one.