texttemplate
Provides support for text template files. More...
Since: | Qbs 1.13 |
Properties
- dict : var
- outputFileName : string
- outputTag : string
Detailed Description
The texttemplate
module provides support for text template files.
Example
Consider the following text file greeting.txt.in.
${greeting} ${name}!
This can be used in a project like this:
Product { type: ["text"] files: ["greeting.txt.in"] Depends { name: "texttemplate" } texttemplate.dict: ({ greeting: "Hello", name: "World" }) }
Which will create the file greeting.txt.
Hello World!
Placeholder Syntax
A placeholder ${foo}
is replaced by its corresponding value in texttemplate.dict. Placeholder names consist of alphanumeric characters only.
The placeholder ${$}
is always replaced with $
. If you need a literal ${foo}
in your template, use ${$}{foo}
.
Placeholders that are not defined in the dictionary will produce an error.
Relevant File Tags
Tag | Auto-tagged File Names | Since | Description |
---|---|---|---|
"texttemplate.input" | *.in | 1.13.0 | Source files with this tag serve as inputs for the text template rule. |
Property Documentation
dict : var |
The dictionary containing values for all keys used in the template file.
Default: {}
outputFileName : string |
The output file name that is assigned to produced artifacts.
Default: Complete base name of the input file
outputTag : string |
The output tag that is assigned to produced artifacts.
Default: "text"