09-23-2018, 05:01 AM | #16 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Tanjamuse provide me an example library where I did some tests. In order to tie up my loose ends in this thread, here is the solution that fits to her needs.
Code:
program: tmp1 = template('{#fandoms:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})'); tmp2 = template('Crossovers/{#fandoms:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,&)}/{author}/{title} ({#story_id})'); tmp3 = template('Multiple Crossovers/{author}/{title} ({#story_id})'); cmp( count( field('#fandoms'), ','), 2, re(re(tmp1,': ','_'),',',' - '), re(re(tmp2,': ','_'),',',' - '), tmp3) |
03-16-2019, 12:14 PM | #17 |
Wizard
Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
How do I make sure that the output is sorted alphabetically?
Example: Angel The Series, Buffy The Vampire Slayer, Queer Eye for the Straight Guy becomes Buffy The Vampire Slayer & Queer Eye for the Straight Guy & Angel The Series Even if I change the & to commas it still doesn't sort them alphabetically. This is the template I'm using. Code:
"program: tmp1 = template('{#parent_fandom}/{#meta_fandom:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,\\,)}/{#story_id}/{author} - {title}'); tmp2 = template('{#parent_fandom}/{#meta_fandom:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,&)}/{#story_id}/{author} - {title}'); tmp3 = template('_ Multiple Crossovers/{#story_id}/{author} - {title}'); cmp(count(field('#meta_fandom'), ','), 2, re(re(tmp1,': ',' '),',',' & '), re(re(tmp2,': ',' '),',',' & '), tmp3)" |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saving ebooks problems | Tanjamuse | Calibre | 12 | 07-15-2018 08:37 PM |
Help with a 'Saving Books to Disk' Template | Vortex | Calibre | 5 | 12-04-2014 09:18 AM |
help with saving template having multiple authors? | miquele | Library Management | 2 | 04-16-2013 04:49 PM |
Save template problem | antoon | Library Management | 12 | 08-17-2012 12:47 PM |
Saving to Disk Template | hurricane51 | Conversion | 2 | 07-07-2011 01:22 AM |