Format specifiers: how to use the "alternatives" thing with the "conditional" specifier? #2833
-
I am struggling to get the exact behavior I want out of the format strings. I would like to pull images from Sankaku; if the "tags_character" field exists, I want to join the first several of them; if it does not exist, then I would like a string such as "NONE" to be used. Based on this post I know that I can get the behavior I want by listing alternatives in the configuration file, but I really feel like this should be possible with only one formatter string... Here is what I've tried so far (assuming that tags_character does not exist): So, is this a bug, or intended/expected behavior? If this is intended, is there any way to get this default behavior in only one formatter string, or am I forced to use the branching behavior in the config file? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Well, this is "expected" behavior, but it should definitely be improved. The correct way of specifying NONE as alternative would be I will push a commit that changes this behavior to not join strings, only lists, the next time I do a |
Beta Was this translation helpful? Give feedback.
Well, this is "expected" behavior, but it should definitely be improved.
The correct way of specifying NONE as alternative would be
{tags_character[0:5]|'NONE':J+/}
but applying
J
, i.e.str.join()
, to another string results inN+O+N+E
,so you are currently forced to use the branching behavior.
I will push a commit that changes this behavior to not join strings, only lists, the next time I do a
git push
.