Heya,
I've been using this template for a while and generally it works fine...
Code:
program:
series = test( field('series'), field('series'), '');
topic = test( field('#topic'), field('#topic'), '');
category = first_non_empty(series, topic);
strippedcategory = re(category, '^(A|The|An|Der|Die|Das)\s+', '');
initialofcategory = substr( strippedcategory, 0, 1 );
idx = field('series_index');
indexno = contains(idx, '\.', format_number(idx, '04.1f'), format_number(idx, '02d'));
index = test(series, strcat( indexno , ' - '), '');
cleanedCategory = re(category, ' & ', ' and ');
cleanedCategory = re(category, '&', ' and ');
foldernameforcategory = strcat(initialofcategory, '/', cleanedCategory, '/', index);
defaultfoldername = 'other/';
cleanedTitle = field('title');
finalfolder = test(category, foldernameforcategory, defaultfoldername);
strcat('books/', finalfolder, cleanedTitle );
Basically, for my kobo, my books are sorted under their series (if any) or their topic (a custom field), grouped by the first letter of either (A/A-Series, The; B/B-Topic, etc.). So far, so good...
Now I wanted to be clever and though, if I used the "topic" column to add a sub-topic as well, it could sort it under the sub-directory, for example:
"Programming" -> goes under P/Programming
"Programming/C" -> goes under P/Programming/C
"Programming/Java" -> goes under P/Programming/Java
In calibre when this is displayed, it also looks correct, but unfortunately, when loading them onto the Kobo, it actually works out to...
"Programming" -> goes under P/Programming
"Programming/C" -> goes under P/Programming_C
"Programming/Java" -> goes under P/Programming_Java
So, any idea what's causing this and is there an easy way to clean up the topic string to get the correct result?