Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
On this page
|
Description
Allows content to be conditionally hidden or shown based on parameter value or other conditioning. Hide is a general capability that can be quite useful for commenting out code sections easily. The parameter setting allows for a runRun macro (or similar) to control the conditional showing of the content. Moreover, the body content can be rendered even if the content is not shown, which may be convenient for producing side-effects of the rendering.
Parameters
...
Macro editor label | Default | Description | Macro parameter |
---|---|---|---|
Hide content | True | Optional. Can be specified as the default parameter. The default value is true. The content is hidden unless hide=false or other conditioning parameter indicate otherwise. |
...
hide | |||
Render body | False | Optional. The macro body is rendered when conditions determine content should be hidden or render=true or renderIf conditions are met. | render |
Treat match regex condition as a literal string | True | Optional. Set to true so that all the regex strings are treated as simple strings to make things simple for most examples. With literal as false, then the full power of regex expressions can be used. |
...
literal | ||
Show content based on matching condition | Optional. A comma-separated list of regex:value pairs. Content will be shown if any of the pairs has a value that matches their corresponding regex condition. This overrides the hide parameter if specified. |
...
showIf | |||
All regex conditions must match | False | Optional. If selected, the macro uses an AND operation on the corresponding list of comma-separated regex conditions provided in showIf parameter; if not, an OR operation is performed. | showCondition |
Hide content based on matching condition | Optional. A comma-separated list of regex:value pairs. Content will be hidden if any of the pairs has a value that matches their corresponding regex condition. This overrides the hide and showIf parameters when specified. |
...
hideIf | |||
All regex conditions must match | False | Optional. If selected, the macro uses an AND operation on the corresponding list of comma-separated regex conditions provided in hideIf parameter; if not, an OR operation is performed. | hideCondition |
Render content based on matching condition | Optional. A comma-separated list of regex:value pairs. Content will be rendered if any of the pairs has a value that matches their corresponding regex condition. This overrides the render parameter when specified. Note that content is rendered when it is not hidden no matter the setting of the render and renderIf parameters. Since 4.0. |
...
A literal parameter defaults to true so that all the regex strings are treated as simple strings to make things simple for most examples. With literal as false, then the full power of regex expressions can be used.
...
renderIf | |||
All regex conditions must match | False | Optional. If selected, the macro uses an AND operation on the corresponding list of comma-separated regex conditions provided in renderIf parameter; if not, an OR operation is performed. | renderCondition |
Example
References
The Visibility add-onapp has hide-if and show-if macros for more options on whether content should be shown or not.