[feature] List all filenames used in render()
I've got a fairly complex template layout. It would be helpful for debugging to have a way I could see which filenames are part of a template.
Example: example.tmpl includes two template files : included_filename1.tmpl included_filename2.tmpl
lookup = mako.lookup.TemplateLookup(directories='/my/directory')
template = lookup.get_template('example.tmpl')
If the template object supported something like source_files that provided ['example.tmpl', 'included_filename1.tmpl', 'included_filename2.tmpl'] that would dramatically simplify my debugging down the line.
I can accept PRs that achieve this as long as they include tests.
This feature is very similar to what I'm looking for. My use case is the following: I have a website with hundreds of pages. I build the website with make. To increase build speed I'd like to generate dependencies (very common strategy in make projects). I would love to be able to list the immediate dependencies of a template (parent template, includes, namespace files, etc)
@zzzeek, how big of an effort do you think it would be to create this type of PR (including tests)?
both of these things can be done in the interim as separate utilities. use the Lexer to get a template structure, then traverse it to locate filenames and whatever. it would be cleaner just as a separate utility function given a Template or a filename.