01-04-2015, 08:49 AM | #1 |
e^bored
Posts: 44
Karma: 10
Join Date: Jun 2010
Device: Kobo Aura HD, BeBook Neo
|
Syntax for custom lists in programs
I'm trying to add a tag to my books based upon whether it's a graphic novel.
What I'm trying to do is: Code:
comic_types = ["CBR", "CBZ", "CBT", "CBA", "CB7"]; formats = approximate_formats(); has_comic_formats = list_intersection(comic_types, formats,","); # etc. Does calibre have support for actual lists, or is it just all operating on Strings (and doing text-munging)? |
01-04-2015, 10:17 AM | #2 |
Grand Sorcerer
Posts: 11,761
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
By calibre I assume you mean the template language. You are correct, the template language supports strings. A string is converted to a list if the context calls for it. In your example you would use "CBR, CBZ, CBT, CBA, CB7".
If you want to use "real" lists then you can write a custom formatter function in python, which will of course have much better performance than a template language program. |
Advert | |
|
01-04-2015, 04:30 PM | #3 |
e^bored
Posts: 44
Karma: 10
Join Date: Jun 2010
Device: Kobo Aura HD, BeBook Neo
|
That's what I was afraid of. Thanks for confirming for me chaley.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Either/Or Search Syntax? | PatNY | Library Management | 4 | 09-05-2013 06:15 AM |
Help with Syntax please..... | Hendrixxxxxxxx | Library Management | 4 | 01-31-2013 12:17 AM |
syntax tags | MMAC | Library Management | 1 | 02-29-2012 03:51 PM |
Help with plugboard syntax, please | Ptarmigan | Library Management | 3 | 02-15-2012 05:44 AM |
Help with search syntax please. | rwelbourn | Library Management | 3 | 04-16-2011 02:07 AM |