View Single Post
Old 08-28-2016, 05:31 AM   #3
chaley
Grand Sorcerer
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: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Actually, the fact that it works in a calibre template is probably a bug. Calibre removes slashes in template items, with the exception of a leading slash in a tag. The probable bug is that composite columns (columns built from other columns) don't have that processing (slash removal) applied to them. There isn't a good reason why composites should be treated differently from custom text or standard columns. However, I am not going to fix that probable bug because it has been there too long and people (like you) might depend upon it.

I am not willing to change CC's template processor to allow slashes in fields by default because such a change could break things. Consider a title like "My Magazine 2011/10". That slash should not (must not?) indicate a new directory level. Neither should a series like "Coffee/Tea". However, I am willing to add a format specifier that tells CC to not remove slashes for that template item, something like
Code:
{#mycolumn:allowslashes}
If #mycolumn contains "aaa/bbb", title = "Foo" and authors = "Blogs, Joe" then the following template
Code:
{#mycolumn:allowslashes}/{title} - {author}
would produce
Code:
aaa/bbb/Foo - Blogs, Joe
Leaving out the allowslashes format specifier would produce
Code:
aaa_bbb/Foo - Blogs, Joe
if #mycolumn is empty then the template would produce
Code:
Foo - Blogs, Joe
Do note that using calibre's template will probably create problems if you use CC's content server or cloud connections. See How do I get the same file names in CC no matter which connection I use? for more information.

EDIT: also note that if you use a composite column in a CC template and also use the cloud connection then you almost certainly want to use the calibre plugin that stores the composite column values for CC's use. See When I look at book details using the cloud connection my custom columns "built from other columns" are missing. Why? for some explanation.

Last edited by chaley; 08-28-2016 at 05:37 AM.
chaley is offline   Reply With Quote