zing icon indicating copy to clipboard operation
zing copied to clipboard

Handle the case of an empty rendered string in Plurr preview

Open iafan opened this issue 4 years ago • 5 comments

When the rendered string is empty, let's provide a different message, e.g. "Empty string rendered", rather than saying "Please enter placeholder <...>" (see the screenshot)

iafan avatar Apr 24 '20 19:04 iafan

@iafan By plurr we mean this: https://github.com/loctools/plurr ?

benjamimo1 avatar Apr 27 '20 19:04 benjamimo1

@benjamimo1 correct!

iafan avatar Apr 27 '20 19:04 iafan

If we input all necessary strings: Screen Shot 2020-05-20 at 10 20 08

If we don't: Screen Shot 2020-05-20 at 10 20 13

Is "Empty string rendered" a different case scenario as "Please enter placeholder"? Are we aiming for two different message for each scenario? I don't understand how they are different. Or should I just change the message altogether without a change in logic? Or are we aiming for a partial rendering of the message using all inputs so far. Do we consider the 0 value as an empty string? (Given the example you provided) or are we talking about #472

benjamimo1 avatar May 20 '20 14:05 benjamimo1

Yes, these are different cases. The first one is when you have missing (empty) placeholder values. The second one is an empty string as returned from Plurr formatting function.

In your screenshot above, you will never get an empty string in the output, regardless of the parameters. But there can be units which may produce an empty string as an output. See this example (try to change N to 0, 1, and 2)

iafan avatar May 20 '20 19:05 iafan

OK, will give it a look now, assuming two different cases.

benjamimo1 avatar May 20 '20 19:05 benjamimo1