Clarify copy_without_render
It's not clear what copy_without_render will be matched against and how.
Judging from the source code the glob pattern is used as-is, against the "real" path (fully resolved in the filesystem? relative to output directory?) of the destination where the template file would be copied to, but:
- does that include the output directory (
--output-dirCLI option) ? - it doesn't seem like template variables are expanded in the glob, which makes it impossible to match individual files when those have templated names (say I need to render most files in
template/there/*.htmlexcept fortemplate/there/{{name}}.html) - what about matching template-relative paths (so, the source files)?
- Not sure, would have to test it
- Correct, they are not templated right now it could be added
- Ideally that's how it would work
I've added templating for copy_without_render elements in https://github.com/Keats/kickstart/pull/69 could you try it and come up with a simple template for it as example?
I've also ensured that the globs match without needing to include the directory (whether ./ if running in the current dir or defined via --output-dir) if you want to try.
Just tried, seems to work.
I think my usecase was generating a project file with a templated name, but contents with Tera-like syntax that would cause problems… I'll have to try to remember precisely. I've since rewritten the template I needed with cookiecutter and that contains a justfile that uses variables, and a LaTeX file whose name i wanted to be templated, but has stuff wrapped in double braces all over the place.
Anything else you're missing from cookiecutter? I'm implement pre-gen/post-gen hooks right now
Okay I think I found why I wanted copy_without_render to work. A file {{basename}}.tex included macro definitions like:
\newcommand\foo[1]{%
\texttt{#1}}
I wanted a templated file name, otherwise I might as well do a simple copy. But it was acceptable not rendering the contents: only the document title came from variables, and I often change that anyways once I'm writing.
Tera doesn't like either {% and {#, even between {% raw %}…{% endraw %}. And I can't separate those characters without impacting what the LaTeX code does. With cookiecutter I ended up re-configuring the Jinja2 delimiters to include a non-breaking space inside the braces, bypassing the syntax overlap with LaTeX.
I see, so rendering the filename/dir name only but not the content. Makes sense.