Template talk:Testing/entry: Difference between revisions

Line 36: Line 36:
The problem I had with that is that the #expr logic doesn't treat blank string as 0 and errors on ("" - #). So the variable needs to be initialized to 0 for things to work out or some conversion of "" to 0 performed. The pre-init in testing\start seemed like the least work, and also helps avoid things being non-initialized if a page includes no test entries.
The problem I had with that is that the #expr logic doesn't treat blank string as 0 and errors on ("" - #). So the variable needs to be initialized to 0 for things to work out or some conversion of "" to 0 performed. The pre-init in testing\start seemed like the least work, and also helps avoid things being non-initialized if a page includes no test entries.
: That's what the additional parameter in #var does (<nowiki>{{#var:tl_testing_entry_lastrev|0}}</nowiki> would return 0 if the variable is not set or empty, or whatever else you put in the parameter -- another example is in OS category, we save the regexp value in a variable, if no suitable string is found, the variable will be empty but will return "Linux" instead, because of the additional parameter). - [[User:Jhonn|Jhonn]] ([[User talk:Jhonn|talk]]) 05:56, 22 November 2015 (CET)
: That's what the additional parameter in #var does (<nowiki>{{#var:tl_testing_entry_lastrev|0}}</nowiki> would return 0 if the variable is not set or empty, or whatever else you put in the parameter -- another example is in OS category, we save the regexp value in a variable, if no suitable string is found, the variable will be empty but will return "Linux" instead, because of the additional parameter). - [[User:Jhonn|Jhonn]] ([[User talk:Jhonn|talk]]) 05:56, 22 November 2015 (CET)
:: OK, will try to revise later today.
:: OK, will try to revise later today. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 17:10, 22 November 2015 (CET)
Is there a good reason to worry about a category being included on a page multiple times? Such is invisible and it seems like more work to check before including each. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 19:21, 21 November 2015 (CET)
Is there a good reason to worry about a category being included on a page multiple times? Such is invisible and it seems like more work to check before including each. [[User:Kolano|Kolano]] ([[User talk:Kolano|talk]]) 19:21, 21 November 2015 (CET)
: I was thinking of reducing possible overhead (a somewhat working example is on {{tl|s}}). However, I never researched if it really reduces the overhead or not. In that case we can just scrap the checks (in {{tl|s}} too)... - [[User:Jhonn|Jhonn]] ([[User talk:Jhonn|talk]]) 05:56, 22 November 2015 (CET)
: I was thinking of reducing possible overhead (a somewhat working example is on {{tl|s}}). However, I never researched if it really reduces the overhead or not. In that case we can just scrap the checks (in {{tl|s}} too)... - [[User:Jhonn|Jhonn]] ([[User talk:Jhonn|talk]]) 05:56, 22 November 2015 (CET)