Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-17-2013, 03: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: 756
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, 04:03 PM   #2
chaley
"chaley", not "charley"
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: 5,809
Karma: 1216080
Join Date: Jan 2010
Location: France
Device: Many android devices
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, 04:04 PM   #3
theducks
Grand Sorcerer
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: 15,094
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
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 offline   Reply With Quote
Old 08-17-2013, 04:10 PM   #4
chaley
"chaley", not "charley"
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: 5,809
Karma: 1216080
Join Date: Jan 2010
Location: France
Device: Many android devices
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, 08:26 PM   #5
theducks
Grand Sorcerer
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: 15,094
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Mr {Template}, himself has spoken
theducks is offline   Reply With Quote
Old 08-18-2013, 02: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: 756
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, 03:55 PM   #7
chaley
"chaley", not "charley"
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: 5,809
Karma: 1216080
Join Date: Jan 2010
Location: France
Device: Many android devices
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, 03:59 PM   #8
theducks
Grand Sorcerer
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: 15,094
Karma: 5939999
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
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 offline   Reply With Quote
Old 08-20-2013, 10: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: 756
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 11:02 AM.


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