diff --git a/manual/template_lang.rst b/manual/template_lang.rst index 04083e7d47..d80c33467d 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -107,7 +107,7 @@ Function references appear in the format part, going after the ``:`` and before Functions are always applied before format specifications. See further down for an example of using both a format and a function, where this order is demonstrated. -The syntax for using functions is ``{field:function(arguments)}``, or ``{field:function(arguments)|prefix|suffix}``. Arguments are separated by commas. Commas inside arguments must be preceeded by a backslash ( '\\' ). The last (or only) argument cannot contain a closing parenthesis ( ')' ). Functions return the value of the field used in the template, suitably modified. +The syntax for using functions is ``{field:function(arguments)}``, or ``{field:function(arguments)|prefix|suffix}``. Arguments are separated by commas. Commas inside arguments must be preceded by a backslash ( ``\`` ). The last (or only) argument cannot contain a closing parenthesis ( ``)`` ). Functions return the value of the field used in the template, suitably modified. Important: If you have programming experience, please note that the syntax in this mode (single function) is not what you might expect. Strings are not quoted. Spaces are significant. All arguments must be constants; there is no sub-evaluation. **Do not use subtemplates (`{ ... }`) as function arguments.** Instead, use :ref:`template program mode ` and :ref:`general program mode `. @@ -309,7 +309,7 @@ The following functions are available in addition to those described in single-f * ``formats_paths()`` -- return a comma-separated list of colon-separated items representing full path to the formats of a book. You can use the select function to get the path for a specific format. Note that format names are always uppercase, as in EPUB. * ``formats_sizes()`` -- return a comma-separated list of colon-separated items representing sizes in bytes of the formats of a book. You can use the select function to get the size for a specific format. Note that format names are always uppercase, as in EPUB. * ``has_cover()`` -- return ``Yes`` if the book has a cover, otherwise return the empty string - * ``not(value)`` -- returns the string "1" if the value is empty, otherwise returns the empty string. This function works well with test or first_non_empty. + * ``not(value)`` -- returns the string "1" if the value is empty, otherwise returns the empty string. This function works well with test or first_non_empty. * ``list_difference(list1, list2, separator)`` -- return a list made by removing from `list1` any item found in `list2`, using a case-insensitive comparison. The items in `list1` and `list2` are separated by separator, as are the items in the returned list. * ``list_equals(list1, sep1, list2, sep2, yes_val, no_val)`` -- return `yes_val` if `list1` and `list2` contain the same items, otherwise return `no_val`. The items are determined by splitting each list using the appropriate separator character (`sep1` or `sep2`). The order of items in the lists is not relevant. The comparison is case-insensitive. * ``list_intersection(list1, list2, separator)`` -- return a list made by removing from `list1` any item not found in `list2`, using a case-insensitive comparison. The items in `list1` and `list2` are separated by separator, as are the items in the returned list. @@ -495,4 +495,3 @@ You might find the following tips useful. :hidden: generated/en/template_ref - diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 8c56154659..22f62ff9d5 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -924,9 +924,9 @@ class BuiltinSublist(BuiltinFormatterFunction): 'of zero is assumed to be the length of the list. Examples using ' 'basic template mode and assuming that the tags column (which is ' 'comma-separated) contains "A, B, C": ' - '{tags:sublist(0,1,\\,)} returns "A". ' - '{tags:sublist(-1,0,\\,)} returns "C". ' - '{tags:sublist(0,-1,\\,)} returns "A, B".' + '{tags:sublist(0,1,\\\\,)} returns "A". ' + '{tags:sublist(-1,0,\\\\,)} returns "C". ' + '{tags:sublist(0,-1,\\\\,)} returns "A, B".' ) def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):