View Single Post
Old 09-26-2011, 11:36 AM   #14
arspr
None
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 312
Karma: 240168
Join Date: Mar 2011
Location: Madrid, Spain
Device: Sony PRS-650 >>> Kobo Aura HD
Quote:
Originally Posted by chaley View Post
Why do you start with "{#original:"? That field is never used in the functions (the token $ does not appear). You could use "{:" and make it clear that there is no field being passed into the functions.
A very simple explanation, I didn't know I could use that syntax...

I'm quite noob using templates and in the Calibre Manual all the examples start with {whatever_field: ...}

Quote:
I am considering adding a "list_equal" function, where two lists are considered equal if they contain the same items in any order (case insensitive compares). That would get rid of the list_sorts, which are superfluous in this case. One question: I would assume that both lists have the same separator, making the call something like
Code:
list_equal(list1, list2, ',', yes_value, no_value).
What do you think?
I'm no expert, but this straight-forward comparison seems less hack-like than using strcmp.

Although, in order to prevent further work I would code (if easy):

Code:
list_equal(list1, list2, ','(for list1), ','(for list2), yes_value, no_value).
In this way you would have a fully robust comparison function fully independent from the separator.

Just one doubt. How will it behave with "Greek, Modern (1453-)"?
I feel that you have one serious inconsistency here. If languages_string gives the values separated with commas, commas shouldn't be used within the names.
arspr is offline   Reply With Quote