Conditional Content
Depending on the layout chosen and the template files format, pure information delivered by ctcreport often needs some encapsulating content, like HTML elements containing the information. For structured templates, this is achieved by conditionally defining user variables.
These definitions are embedded in HTML comments with the general structure:
<!-- CTC_DEFINE("_UserVariable" "Condition" "Content if Condition is TRUE" "Content if Condition is FALSE") -->
It is recommended to start user variable names with an underscore.
The following conditions are available:
- Level2Available
- True if a layout with two levels of information is chosen for current page (overview / detail).
- SourceDrillable
- Independently for level 1 and level 2, this condition is true if:
- the source code view is generated by layout choice and
- the entity on the level is file or function.
- DetailDrillable
- This condition at overview page is true for the entity detail pages are generated for.
- JustificationsIncluded
- True if the report is generated with option
-include-justifications
. - OverviewLevel1Linked
- This condition is used on detail pages. It is true if the detail pages are generated for level 1 from overview page. It is used to structure the sibling navigation conditionally.
Example: One or two entities in table caption
In table headers in overview and detail pages, the one or two reported entities are
mentioned using this definition of $_Entities$
:
<!-- CTC_DEFINE("_Entities" "Level2Available" "$Level1Entities$ and $Level2Entities$" "$Level1Entities$") -->