texttemplate

Provides support for text template files. More...

Since: Qbs 1.13

Properties

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

TagAuto-tagged File NamesSinceDescription
"texttemplate.input"*.in1.13.0Source 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"


© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.