|
|
#1 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 555
Karma: 422221
Join Date: Jul 2010
Location: UK
Device: Sony PRS-300 & Kindle PW
|
Save Template: Strip out spaces
My save template is currently: {title_sort:.8} Can I add some code to either strip out spaces or convert them to hyphens? |
|
|
|
|
|
#2 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,954
Karma: 2574555
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
(are you having the same problem I have with my PEz. Bookmarks do not work (be able to retrieve location) with files that have spaces? )
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
Enthusiast
|
|
|
|
#3 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,879
Karma: 285970
Join Date: Jan 2010
Location: France
Device: Sony PRS-300, HTC WM6.5, Samsung Galaxy Nexus, HTC Sensation
|
Quote:
Code:
Strip spaces: {title_sort:.8:re( ,)}
Convert spaces to hyphens: {title_sort:.8:re( ,-)}
Code:
Strip spaces: {title_sort:.8:'re($, ' ' ,'')'}
Convert spaces to hyphens: {title_sort:.8:'re($, ' ' ,'-')'}
Code:
Strip spaces: {title_sort:'shorten(re($, ' ' ,''), 8, '', 0)'}
Convert spaces to hyphens: {title_sort:'shorten(re($, ' ' ,'-'), 8, '', 0)'}
Code:
Strip spaces: program: shorten(re(field('title_sort'), ' ', ''), 8, '', 0)
Convert spaced to hyphens: program: shorten(re(field('title_sort'), ' ', '-'), 8, '', 0)
__________________
Support calibre developers at no cost to you by using calibre's get books feature. Use Calibre Companion to wirelessly connect your Android phone or tablet to calibre charles.haleys.org/calibre |
|
|
|
|
|
|
#4 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 555
Karma: 422221
Join Date: Jul 2010
Location: UK
Device: Sony PRS-300 & Kindle PW
|
Thanks for the replies. I used the simple function solution and both stripping and converting work exactly as required. (I'll save the more complex methods for a rainy day!)
(And... No, I was not having a bookmark problem, I just don't like spaces in filenames.) Last edited by Agama; 03-17-2012 at 03:15 PM. |
|
|
|
![]() |
| Tags |
| templates |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Old Thread] Save Template not working | TGinAZ | Calibre | 7 | 01-18-2012 01:03 AM |
| A little help with a save template...? | Belfaborac | Library Management | 2 | 02-04-2011 09:47 PM |
| problem to save with customize template | Roxro | Library Management | 4 | 01-22-2011 07:37 AM |
| save file template for series | bucsie | Calibre | 2 | 11-08-2010 02:07 AM |
| save to disk template | speakingtohe | Calibre | 9 | 05-29-2010 06:02 AM |