Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] List all filenames used in render() #300

Open
jcpunk opened this issue Jul 8, 2019 · 3 comments
Open

[feature] List all filenames used in render() #300

jcpunk opened this issue Jul 8, 2019 · 3 comments

Comments

@jcpunk
Copy link

jcpunk commented Jul 8, 2019

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.

@zzzeek
Copy link
Member

zzzeek commented Jul 31, 2019

I can accept PRs that achieve this as long as they include tests.

@aioobe
Copy link

aioobe commented Dec 14, 2019

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)?

@zzzeek
Copy link
Member

zzzeek commented Dec 14, 2019

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.

@bourke bourke added this to the 1.3 milestone Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants