Flavoring
At TINC, we create documents for a set of products that are used by different customers within TRUMPF. Each customer has their own identity, which is reflected in the product name, the logo, and other branding elements. To support this, we use a process called Flavoring.
Flavoring is the process of adapting a core document into a customer-specific version—such as for Trumpf, JFY, or Lantek. Flavoring can be apply to entire product documents (e.g., Praxis transformed to JFY+) or modular extractions, where components are split into tailored modules (e.g., Flux transformed into FluxCut, FluxBend, FluxFold).
Bento tool has a set of functionality to perform these tasks using substitutional and conditional compilation. The flavoring is mainly defined by attributes in the manifest.txt and contents.txt file.
Substitutional compilation
Below is a typical example of substitutional compilation in manifest.txt for Flux reference manual to create TecZone reference manual:
FLAVORS=FLUX, JFY, TRUMPF (1)
TITLE=Flux Reference Manual (2)
OUTDIR=../FluxHTML
LOGO=img/logo.png,103,34
COPYRIGHT=Copyright © 2025 by Metamation. All rights reserved.
FAVICON=img/flux-icon.png
ATTRIBUTE=APPNAME:Flux (3)
ATTRIBUTE=BENDAPP:Flux
ATTRIBUTE=FOLDAPP:Flux
ATTRIBUTE=CUTAPP:Flux
ATTRIBUTE=PRAXISAPP=Praxis
ATTRIBUTE=BRAND:TRUMPF
#if TRUMPF (4)
TITLE=TecZone Bend Reference Manual
OutDIR=../BoostHTML
COPYRIGHT=Copyright © 2025 by TRUMPF SE + Co.KG. All rights reserved.
ATTRIBUTE=APPNAME:TecZone
ATTRIBUTE=BENDAPP:TecZone Bend
ATTRIBUTE=FOLDAPP:TecZone Fold
ATTRIBUTE=CUTAPP:TecZone Cut
ATTRIBUTE=PRAXISAPP=HomeZone
ATTRIBUTE=BRAND:TRUMPF
#endif
| 1 | The FLAVORS line defines the available flavors for this document. Each flavor can have its own set of attributes and files, which are used to customize the document for different customers. The first flavor name in this line is the default flavor. |
| 2 | The second section defines the title of the document and other metadata. The OUTDIR specifies where the generated HTML files will be placed, and LOGO provides the path to the logo image. COPYRIGHT and FAVICON are also defined here. |
| 3 | The ATTRIBUTE section define substitution attributes that replace product names within the document. These attributes can be used to customize the content for different flavors, such as Flux or TecZone. |
| 4 | The #if TRUMPF conditional block allows for specific attributes and content
to be included only when the TRUMPF flavor is being processed. This is
useful for tailoring the document to the specific needs of TRUMPF customers. |
Conditional compilation
Below is a typical example of conditional compilation in contents.txt for a Flux reference manual to create TecZone Cut reference manual:
On the left is the files or folder names and on the right is the conditional attributes.
[Intro] (1)
[CAD]
[Cut] #ifdef TRUMPF (2)
[Bend] #ifndef TRUMPF
[BCell] #ifndef TRUMPF
[Fold] #ifndef TRUMPF
[Settings] #ifdef TRUMPF
[Database]
[Report]
[Appendix]
| 1 | Defines the content for the document. |
| 2 | The #ifdef TRUMPF & #ifndef TRUMPF directive allows for specific sections
to be included or excluded based on the flavor being processed. In this case,
the Cut section is included only for the TRUMPF flavor, while the Bend,
BCell, and Fold sections are excluded. |
Exchange files for a flavor
In addition to the manifest file, each flavor can have its own set of files that are used to customize the document. These files can include:
-
Asciidoc files (.adoc)
-
Images (.png)
-
CSS files (.css)
To enable this, the naming of the files must have the flavor name at the beginning as shown below:
Impressum.adoc
TRUMPF.Impressum.adoc
logo.png
TRUMPF.logo.png
Site.css
TRUMPF.Site.css
This option is highly essential for images when creating a flavored document. The images for TRUMPF flavor can be placed in the same img folder. Bento will identify the images based on the flavor name and use the appropriate image for the TRUMPF document.
Conditional attributes in asciidoc file
Conditional attributes can also be used to include or exclude
content[1] based on the current flavor. This is done using the
ifdef directive in the Asciidoc files. For example, to include content only
for the TRUMPF flavor, you can use:
ifdef::TRUMPF[]
The text here is included only in the TRUMPF flavor of the product and describes
how TecZone module is used.
endif::[]
You can also use the ifndef directive to exclude content for a specific flavor:
ifndef::TRUMPF[]
The text here is included in all flavors except for the TRUMPF flavor.
endif::[]