|
|
#1 |
|
Junior Member
![]() 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? |
|
|
|
|
|
#2 |
|
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (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
)
Last edited by eschwartz; 08-04-2014 at 04:33 PM. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Aug 2014
Device: none
|
Thanks Eschwartz, it works perfectly.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a little help with saving to disk | svda | Conversion | 35 | 03-03-2014 04:08 PM |
| Saving to Disk | LRC1962 | Library Management | 1 | 06-20-2012 08:58 PM |
| Saving to Disk | paulfiera | Calibre | 3 | 07-20-2011 11:21 AM |
| Losing files when saving saving to disk | theaccountant | Library Management | 4 | 03-10-2011 03:38 PM |
| Saving to disk | htaylor | Calibre | 2 | 01-04-2009 09:29 PM |