Page 1 of 1

Template: hide symbols if some tag value is blank

Posted: Mon Dec 12, 2022 10:42 am
by esv
For templates (e.g., for customizing tooltips) I'd like to be able to hide some separators if the values they separate are empty
For example, currently

Code: Select all

{Tag status} | {Rating} | {Color label}
shows as

Code: Select all

[] | |
when all fields as empty

I'd like to "tie" the "|" symbols to the previous values and don't show them if those values are blank, so for example, if I enter the following mock template

Code: Select all

{Tag status}{≠∅" | "}{Rating}{≠∅" | "}{Color label}
(where {≠∅" | "} means "if the previous tag is not empty, print this string)
I'd get this nice empty field (without any newlines as well, though that would require some other templating feature)

Re: Template: hide symbols if some tag value is blank

Posted: Wed Jan 04, 2023 1:23 pm
by xnview
Do you have tried

Code: Select all

(({Tag status} | ))(({Rating} | ))(({Color label}))

Re: Template: hide symbols if some tag value is blank

Posted: Wed Jan 04, 2023 1:41 pm
by esv
No I haven't, I didn't know it existed, where is this documented?

so from testing this

Code: Select all

t{Tag status} | r{Rating} | c{Color label}
((t{Tag status} | ))((r{Rating} | ))((c{Color label}))
get

Code: Select all

t[] | r | c
t[] |
Good news is that the Rating/Color tags seem to disappear, but the status remains
Also, is there a similar trick for the newline char? Can I completely remove the line if it's empty, something like this doesn't seem to work, I always get a newline

Code: Select all

(((((r{Rating} | ))((c{Color label}))<br>))