mark icon indicating copy to clipboard operation
mark copied to clipboard

How to use the `Content by Label` macro?

Open toast-gear opened this issue 4 years ago • 1 comments

👋 I couldn't figure out of there was support for the Content by Label macro, is this supported and if so could I get some pointers on how to reference it? If not could this get tagged as an enhancement?

Screenshot below of an example configuration:

image

toast-gear avatar Mar 07 '22 11:03 toast-gear

You can take a look at the code here https://github.com/kovetskiy/mark/blob/c70eb550fe57bbe2d757835b07c03bc404121cd1/pkg/mark/stdlib/stdlib.go#L144 or here https://github.com/kovetskiy/mark/blob/c70eb550fe57bbe2d757835b07c03bc404121cd1/pkg/mark/stdlib/stdlib.go#L154 to get an idea of how you can create a template for that macro.

The Template code could be, for example:

<ac:structured-macro ac:name="contentbylabel">
{{ if .Max }}<ac:parameter ac:name="max">{{ .Max }}</ac:parameter>{{ end }}
{{ if .Sort }}<ac:parameter ac:name="sort">{{ .Sort }}</ac:parameter>{{ end }}
{{ if .Reverse }}<ac:parameter ac:name="reverse">{{ .Reverse }}</ac:parameter>{{ end }}
{{ if .Title }}<ac:parameter ac:name="title">{{ .Title }}</ac:parameter>{{ end }}
{{ if .ExcludeCurrent }}<ac:parameter ac:name="excludeCurrent">{{ .ExcludeCurrent }}</ac:parameter>{{ end }}
<ac:parameter ac:name="cql">label = &quot;{{ .Label }}&quot;</ac:parameter>
</ac:structured-macro>

Skeeve avatar Jun 20 '22 06:06 Skeeve