Bug introduced in V10.0 and persisting through V10.4
Since V10.3 the bug still remains but additionally the
GenerateDocument examples, previously working correctly, are now exhibiting a new bug described in: What has changed in the Template system in 10.3?
GenerateDocument[ _NotebookObject ] seems to do the same what
NotebookTemplate @ _NotebookObject ] does except that the latter evaluates more than it should. It does not respect "leave unevaluated" cell properties.
Let's create a
File -> New -> Template Notebook and fill it with the following template:
TemplateExpression[ "test: " <> TemplateSlot["tag", DefaultValue -> "DEFAULT"]]
created using available
Cell Behaviour is set to
Generate test gives me anticipated:
the same result I get with
GenerateDocument[ Notebooks[] (*this template was 2nd on my Notebooks list*) ]
TemplateApply[ NotebookTemplate @ Notebooks[] ]
Gives correct notebook but evaluates the cell printing
The same is the case when I add parameters like
<|"tag" -> "test2134"|> to those functions.
TemplateApply is unexpected to me.
Why this evaluation happens? Have I missed something in documentation?
I don't see any reason why that cell is evaluated. And I don't see how my opinion may change with small update of docs like suggested by support:
I have not heard back from the developers for the question yet. It looks like that
returns different results, and yet in the documentation this is not mentioned.
I have filed a suggestion for adding the clarification of this issue. Thank you very much for giving us feedback and hopefully this issue would be improved in future release.'
That's why I'm adding bug.