View Single Post
Old 07-18-2015, 05:48 AM   #34
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,461
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Sorry, didn't see your edits.
Quote:
Originally Posted by Thomas_AR View Post
Hmmm...
On one side you are right regarding standard decimal separator in my local - Spanish uses ",".
On the other hand Calibre (English and Spanish GUI ) uses the "." when pushing books to my tablet
You are right. I will change CC to use the same symbols as calibre.
Quote:
P. S.
Are you planning something like a "contains" syntax?

Example:
Code:
 :if: {tags:contains|test} :then: {series_index:%04d} :else: {series_index:%04.2f}:::
Of course this syntac also for other fieldes, not only {tags}
No, I haven't been planning something like this. I will think about it, but I am not yet sure of the value.

Note that there are at least two ways to accomplish the same thing.
  1. Create a Yes/No column that is set to Yes for any book that would match the expression you want to use in the if test, otherwise set to empty. In this case the if test would be
    Code:
     :if: {#yesno_col} :then: {series_index:%04d} :else: {series_index:%04.2f}:::
  2. Even more powerful is to use the order CC evaluates if/then within templates. CC evaluates the if/then/else parts, substitutes the results back into the template, then evaluates the template with the substitutions. This permits you to specify arbitrary template parts inside the if statement that are used when finally evaluating the template. Consequence: you can put templates or template components in calibre columns then use these in CC. For example, the following would use a CC template stored in a text column in calibre:
    Code:
    :if:{#sometextcolumn}:then: :tv: :else:{the default template}:::
    If #sometextcolumn contains
    Code:
    :if: {series}:then:{series:|_|}:else:{first_author} :::/{series_index:%04d/%07.2f|[|] - }{title} -  {first_author}
    then that is the template that would be used.

    You can do the same thing with template components. For example, assume that #sif is a text column containing the format specifier to use for the series index for the book. The following template segment would use that format if it exists, otherwise %04d/%07.2f
    Code:
    {series} {series_index::if: {#sif} :then: :tv: :else: %04d/%07.2f:::}
    To finish the example, if #sif contains %03d/%06.2f then after processing the :if:, the template would be
    Code:
    {series} {series_index:%03d/%06.2f}
    If #sif is empty then after processing the :if:, the template would be
    Code:
    {series} {series_index:%04d/%07.2f}
    In the end you could use a different series index format for every series.


    Note that there is a bug in V4.0.5 causing % characters to be replaced before they are substituted into the template. Production release candidate V4.1.0, released to the beta group this morning, fixes this problem.
chaley is offline   Reply With Quote