The following changes are in calibre 6.1:
- "Super-quoting" of strings. Getting the backslashes right when doing regex and template searches can be difficult. To fix that you can now "super-quote" a string using a pair of triple quotes ("""text"""). A super-quoted string is used unchanged. No escape processing is done. Examples
- #authors:"""~(\[editor|translator\])""" -- find books with the words 'editor' or 'translator' in brackets. The backslashes to escape the brackets don't need to be doubled.
- template:"""program: book_count('tags:^"' & $series & '"', 0) != 0#@#:n:1""" -- find books with the series name contained in tags of any book. The single and double quotes in the template don't need double escaping. NB and for completeness: the search below will find books with the series name in its own tags instead of in any tag in the library:
template:"""program: if $series && $series inlist $tags then 1 fi#@#:n:1"""
Super-quoting works with all search types so you can use it when you would otherwise need double escapes.
Programmers might know this syntax as "docstrings"
- Change the template part of the advanced search dialog to use super-quoting.
- Pass some of the currently selected books to the template editor available from the template section of the advanced search dialog. This helps debug the templates without needing to run the search.