Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Devices

Notices

Reply
 
Thread Tools Search this Thread
Old 08-17-2013, 02:34 PM   #1
calvin-c
Guru
calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.
 
Posts: 787
Karma: 1575310
Join Date: Jul 2009
Device: Moon+ Pro
How to do conditional literal in plugboard?

On my device I prefer the file to be {series}{series_index:0>2s}-{title}. This works when there's a series & sequence. When there's no series I get the hyphen in front of the title. Can I make the hyphen conditional so it only appears when there's a series? If so, can I also make the index conditional so it only appears when the value is greater than 0? There are some 'series' that are non-sequential. Since Calibre doesn't allow a series without an index the indexes in these are all set to 0.

Thanks.
calvin-c is offline   Reply With Quote
Old 08-17-2013, 03:03 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by calvin-c View Post
On my device I prefer the file to be {series}{series_index:0>2s}-{title}. This works when there's a series & sequence. When there's no series I get the hyphen in front of the title. Can I make the hyphen conditional so it only appears when there's a series? If so, can I also make the index conditional so it only appears when the value is greater than 0? There are some 'series' that are non-sequential. Since Calibre doesn't allow a series without an index the indexes in these are all set to 0.

Thanks.
Yes. See the Advanced Formatting section of the template language manual. It explains how to do exactly what you want.
chaley is offline   Reply With Quote
Old 08-17-2013, 03:04 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,819
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
http://manual.calibre-ebook.com/template_lang.html

See The Advanced Section
for Example:
Code:
{series}{series_index:| - | - }{title}
The space dash are literals that are included only if there is a Series_index

It gets real tricky to suppress a 0 index in a Series. I use Zero to indicate a book that belongs to a series, but has no place in the order
I use 0.n to order those
theducks is online now   Reply With Quote
Old 08-17-2013, 03:10 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by theducks View Post
http://manual.calibre-ebook.com/template_lang.html

See The Advanced Section
for Example:
Code:
{series}{series_index:| - | - }{title}
The space dash are literals that are included only if there is a Series_index

It gets real tricky to suppress a 0 index in a Series. I use Zero to indicate a book that belongs to a series, but has no place in the order
I use 0.n to order those
To convert indices with value zero to blank, try
Code:
{series_index:re(^0*$,)}
The pattern/replacement in the re() function changes any series index that is all "zero" characters (or no characters at all) to nothing, or a blank.
chaley is offline   Reply With Quote
Old 08-17-2013, 07:26 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,819
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Mr {Template}, himself has spoken
theducks is online now   Reply With Quote
Old 08-18-2013, 01:11 PM   #6
calvin-c
Guru
calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.
 
Posts: 787
Karma: 1575310
Join Date: Jul 2009
Device: Moon+ Pro
Thank you. Should have realized that 'template' was a synonym for plugboard (or vice versa) but i didn't & therefore couldn't find what I wanted. As theducks said I use zero to indicate books that belong to a series but have no place in the order. Usually that's because the series itself is unordered-but now that I think about it, not always. (Some series have short story collections where the individual stories take place scattered throughout the rest of the series. I generally put those as index 0 although I'm starting to split them into the individual stories & place them appropriately when I can.)

Anyway, thanks very much.
calvin-c is offline   Reply With Quote
Old 08-18-2013, 02:55 PM   #7
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by calvin-c View Post
Thank you. Should have realized that 'template' was a synonym for plugboard (or vice versa) but i didn't & therefore couldn't find what I wanted.
To be a bit pedantic, something I am perhaps unfortunately wont to do, plugboard is not a synonym for template. Templates are a tool that plugboards use to accomplish their task, along with device identification, format identification, and destination field. Templates play a role for save-to-disk, send-to-device, columns built from other columns, and several other functions.

And you are welcome.
chaley is offline   Reply With Quote
Old 08-18-2013, 02:59 PM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,819
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Calvin
0.n for no place
x.0n for a short that fits after x
x.yz is what I use for Omnibus X is the start, a non-zero y is the next and Z is the last (and this falls apart after 9 This way it sorts in close order with singles
theducks is online now   Reply With Quote
Old 08-20-2013, 09:08 AM   #9
calvin-c
Guru
calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.calvin-c ought to be getting tired of karma fortunes by now.
 
Posts: 787
Karma: 1575310
Join Date: Jul 2009
Device: Moon+ Pro
Thanks. I don't think I go that far-if there's no 'place' then I don't care so those are all series(0). If I'm still sequencing the series when I split the collection/omnibus then I number them in order. I only use fractions in special cases (magazines where there's month & year or volume/issue) and when I need to squeeze something into a series I've already sequenced.

To Chaley, don't worry about being pedantic. I'm that way myself at times so I generally find the clarification useful. Thanks.
calvin-c is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Literal ampersands in index_to_soup nickredding Recipes 4 02-24-2014 09:25 PM
Adding books, conditional file name matching cwdavi1 Library Management 1 02-16-2012 05:33 PM
Send to device with conditional directories Doug-W Devices 8 03-06-2011 10:35 AM
Spiritual Young, Robert (tr.): Bible: Young's Literal Translation v1. 17 Dec. 08 ProDigit BBeB/LRF Books 4 04-25-2009 09:28 PM
Conditional CSS rules Jellby ePub 10 01-20-2009 08:32 AM


All times are GMT -4. The time now is 10:29 AM.


MobileRead.com is a privately owned, operated and funded community.