FileTemplate
FileTemplate["file"]
yields a TemplateObject expression that represents a file template to be applied using functions like TemplateApply.
FileTemplate[src]
uses File[…], URL[…], or CloudObject[…] as the specification for the file location.
FileTemplate[form,args]
yields a TemplateObject with arguments, suitable for cloud deployment or other evaluation.
Details and Options
- FileTemplate will infer from the extension whether to interpret the contents as a StringTemplate, XMLTemplate, or NotebookTemplate.
- FileTemplate[CloudObject[…]] will infer the template type based on the contents of the cloud object.
- FileTemplate[File["path"]] and FileTemplate["path"] are effectively equivalent.
- The following special forms can be used in the file for FileTemplate:
-
`` TemplateSlot[] `n` TemplateSlot[n] `name` TemplateSlot["name"] <*expr*> TemplateExpression[expr] - FileTemplate has the following options:
-
CombinerFunction Automatic function to apply to combine pieces before returning a result InsertionFunction Automatic function to apply before inserting expressions Path $TemplatePath search for templates on the specified path
Examples
open allclose allBasic Examples (1)
Loading a template file from disk:
Applying to a FileTemplate:
The type of template to use is by default determined by the extension:
Evaluate $TemplatePath to see where FileTemplate is searching for templates:
Scope (3)
File is fully supported:
Templates can be hosted in the Wolfram Cloud:
URL can be used to fetch templates:
URL can be directly used by TemplateApply:
Options (2)
Properties & Relations (1)
If you deploy a template with data, each time you visit it TemplateApply will render the content again:
Text
Wolfram Research (2014), FileTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/FileTemplate.html.
CMS
Wolfram Language. 2014. "FileTemplate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileTemplate.html.
APA
Wolfram Language. (2014). FileTemplate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileTemplate.html