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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 08-04-2014, 01:41 PM   #1
guaranis
Junior Member
guaranis began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2014
Device: none
Saving to disk

I am trying to save to disk in a specific way:

1/ I need to replace foreign characters like ç to c, so I tried
{title:transliterate()}

2/ I want to remove un-wanted characters with
{title:re([^a-zA-Z0-9], )}

3/ I need to cut the title to 100, so I used this
{title:substr(0, 100)}

All of them work in the template editor if used separately, but how to get all of them to work in the same time.
Any idea?
guaranis is offline   Reply With Quote
Old 08-04-2014, 03:28 PM   #2
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 6,435
Karma: 10683802
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
Code:
program:

# New value for title
title = field('title');
title = transliterate(title);
title = re(
	title,
	'[^a-zA-Z0-9]',
	''
);
title = substr(title, 0, 100);

# Calculate any other bits needed
# Stuff goes here
# Stuff goes here
# Stuff goes here

strcat(
# add up all parts of template, if there is more than just the modified title
	beginning_template_bits,
	title,
	end_template_bits
)
http://manual.calibre-ebook.com/temp...l-program-mode

Last edited by eschwartz; 08-04-2014 at 03:33 PM.
eschwartz is online now   Reply With Quote
Old 08-05-2014, 05:44 AM   #3
guaranis
Junior Member
guaranis began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Aug 2014
Device: none
Thanks Eschwartz, it works perfectly.
guaranis 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
Need a little help with saving to disk svda Conversion 35 03-03-2014 03:08 PM
Saving to Disk LRC1962 Library Management 1 06-20-2012 07:58 PM
Saving to Disk paulfiera Calibre 3 07-20-2011 10:21 AM
Losing files when saving saving to disk theaccountant Library Management 4 03-10-2011 02:38 PM
Saving to disk htaylor Calibre 2 01-04-2009 08:29 PM


All times are GMT -4. The time now is 05:19 PM.


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