![]() |
#1 |
Chalut o/
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
Template : IF code is correct?
So I looked at the code of the Template function (for build a 'IFELSE') and I just saw the 'IF' code is that:
Code:
def evaluate(self, formatter, kwargs, mi, locals, x, y, re): if val: return val ![]() ![]() It's very strange, it shouldn't rather be : Code:
def evaluate(self, formatter, kwargs, mi, locals, x, y, re): if x == y: return re (I sincerely hope I'm wrong, otherwise there's a very old bug.) |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
What exactly are you looking at?
The line Code:
def evaluate(self, formatter, kwargs, mi, locals, x, y, re) The lines Code:
if val: return val |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Chalut o/
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
My bad. My bad.
This function "IF(x, y, re)" is a custom function. I have no idea how it got into my Caliber parameters, as this is the first time I create Template functions. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,440
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
BTW: the template language supports if/then/else. It is evaluated directly by the template processor (inlined) and has much better performance than a function. |
|
![]() |
![]() |
![]() |
#5 | |
Chalut o/
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Normal" template inside GPM template | ownedbycats | Library Management | 20 | 12-02-2020 09:40 PM |
Using built-in template functions in a custom template function | ilovejedd | Library Management | 4 | 01-28-2018 12:20 PM |
Multiple conditions in TEMPLATE code | HFC3 | Library Management | 4 | 07-07-2013 01:39 PM |
Graphical layout vs. semantically "correct" XHTML code | Iznogood | Workshop | 16 | 04-05-2011 08:14 AM |
Let's create a source code repository for DR 800 related code? | jraf | iRex | 3 | 03-11-2010 12:26 PM |