View Single Post
Old 06-27-2015, 12:30 PM   #77
Thomas_AR
Zealot
Thomas_AR began at the beginning.
 
Thomas_AR's Avatar
 
Posts: 131
Karma: 10
Join Date: Jan 2015
Location: Buenos Aires
Device: Android
Quote:
Originally Posted by chaley View Post
I have figured out a way to do this that is both simple and general. I am going to add "if ... then ... else ..." processing.

It will look something like
Code:
:if: {some_template} {} {} {} :then: {some_replacement_template} {} {} :else: {some_replacement_template} {} {} :::
The :else: is optional. All of the templates are arbitrary: single or multiple values. The test is "true" if that template evaluates to some non-blank value. A special symbol will be available, :tv: (test value) that can be used in a :then: or an :else: to replace the test with itself.

All if the if/then/elses will be processed first, then the template will be processed as normal. This means that the :then: and :else: parts can add slashes to change the directory structure.
This is great. I will check that out as soon as Calibre 2.32 is released
For sure we will need a separate thread for CC templates with user examples in the future
Thanks a lot!!

Last edited by Thomas_AR; 06-27-2015 at 12:33 PM.
Thomas_AR is offline   Reply With Quote