![]() |
#1 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,023
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
![]()
I just got around to trying this feature (been doing a pick from 2 patterns)
![]() Code:
{series:switch("","00noseries"/{author_sort[0]}_authors/{authors}/{title}_{id}_{title}-{authors},{series[0]}-series/{series}/{series_index:0>2s}-{title}_{id}_{authors})} When the series is blank, the attached file (OPF part of the pair. Avoiding copyright issues ![]() BTW,I tries without the quotes around 00noseries first. did I miss something? TNX Last edited by theducks; 08-16-2012 at 08:30 PM. |
![]() |
![]() |
![]() |
#2 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,421
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
![]() The template language supports three modes: single function, template program, and general program. Your template is using single function syntax, which (unfortunately for your example) does not support quoted strings or non-constant arguments (arguments that require further evaluation). In addition, no mode supports implicit string concatenation, which you are using after "00noseries". Finally, the regular expression "" (in the switch) will look for literal 2 quotes and match anything, which isn't what you want. You would need something like ^$, or "^$" in one of the other two modes. You could use template program mode and fix all of this, but with something as complex as you have I would instead suggest that you use general program mode. In that mode, the program would be: Code:
program:
test( field('series'),
template("{series[0]}-series/{series}/{series_index:0>2s}-{title}_{id}_{authors}"),
template("00noseries/{author_sort[0]}_authors/{authors}/{title}_{id}_{title}-{authors}")
)
Code:
program:
test( field('series'),
strcat(
substr(field('series'), 0, 1),
template("-series/{series}/{series_index:0>2s}-{title}_{id}_{authors}")
),
template("00noseries/{author_sort[0]}_authors/{authors}/{title}_{id}_{title}-{authors}")
)
Last edited by chaley; 03-08-2011 at 10:56 AM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,023
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Wow!
![]() I can put all that (the last) into a 'save to disk' template? |
![]() |
![]() |
![]() |
#4 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,023
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
![]()
Answered my own question by testing
![]() ![]() ![]() ![]() |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,421
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,023
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() That was an error I corrected long ago in the actual template (when th underscore used to be a / and failed to correct in my 'Notes log' that I used for the message. +fixed+ |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sewing pattern for e-readers! | strawhatbrat | Deals and Resources (No Self-Promotion or Affiliate Links) | 11 | 12-02-2010 09:23 PM |
header removal fails, even though test identifies the pattern | hpep | Calibre | 2 | 08-09-2010 12:40 PM |
Virus pattern match upon connecting Astak Pocket Pro to my computer | Xochipilli2012 | Astak EZReader | 6 | 03-04-2010 02:24 AM |
Literary Pattern Matching | kennyc | News | 5 | 12-16-2009 03:12 PM |
How do I specify TOC pattern? | PaulChernoch | Calibre | 5 | 10-10-2009 01:18 AM |