Quote:
Originally Posted by BookJunkieLI
I think I understand now. You can use a function in a composite column and you can use it in a template, you just can't use it to return functioning HTML (ie a working hyperlink). Yes?
|
Not quite ...
There are two kinds of templates in calibre, mostly due to history. The first kind, {name}, is what we might call a basic template that means replace itself with the value of the field/column/variable "name". These templates are used in jackets and catalogs, and perhaps other places that I don't remember. The second is template-language templates. These are the templates described in calibre's documentation
The calibre template language. These templates are used in composite columns; save-to-disk templates; send-to-device templates; (as of calibre 2.1) catalog section templates; and column coloring , column icon, and cover view emblem advanced templates.
The issue of returning HTML is not directly related to templates of either kind, but is instead related to where the templates are used. Jackets use basic templates and furthermore "escape" the value returned by composite columns so (I think) that HTML in a composite column won't work. However, catalog sections use template-language templates and do not escape the value so columns can contain HTML that will be used. HTML can be used in columns that are displayed in book details. And perhaps in other places.
And yes, all of this should be harmonized. Unfortunately doing so would certainly break existing setups, which would result in a large support load. As an example, consider the title/title_sort stuff in save-to-disk templates. Historically, in those templates {title} has meant {title_sort}, and changing that could adversely affect millions of people. So instead a tweak was added to permit someone to tell calibre that the person wants different behavior. Catalogs and jackets have similar issues.