Conditional formatting (ternaries) and syntax #2666
-
|
Hello, thanks for the great plugin! I'm trying to format a citation key depending on the existence of the shorttitle field. I did find the documentation for ternaries, but the syntax described there does not seem to work, at least when I use it for Zotero 6.0.27 and Better BibTex 6.7.122 This format works for my version: What I'd like todo is to introduce an underscore with the shorttitle only if the shorttitle does excist. With the described syntax, this would be: But this seems to be the wrong syntax, at least the evaluation reports "faild to upgrade legacy formular". I also saw examples from others using syntax like: But this actually prints this text as the citation key. Did the syntax change or am I missing something? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
There's a few things going on here:
the ternary syntax is What you want is easier achieved as |
Beta Was this translation helpful? Give feedback.
There's a few things going on here:
:from the old format has been replaced by.in the new syntax, so[ShortTitle:lower]becomesShortTitle.lower(or(ShortTitle.lower)if you want the parenthesis). If you simply enter your formula in the old syntax, BBT will convert it into the new syntax for you (auth(n=0,m=1,creator="*",initials=false).fold.capitalize + year + ShortTitle.lower, which simplifies toauth.capitalize + year + ShortTitle.lower)the ternary syntax is
(<condition> ? <what to include if the condition is non-empty> : <what to include if the condition is empty>);(condition ? X) (condition : X)will not work, you need(ShortTitle ? "_" : "") + ShortTitle.lowerWhat you want is …