From 8b756df123dafac6e9322f1a845d992f6cbfaa33 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Wed, 23 Oct 2024 16:39:03 +0100 Subject: [PATCH] Ooops -- forgot to change field_inlist to inlist_field in the template tester's highlighter and in a few places in the documentation. --- manual/template_lang.rst | 4 ++-- src/calibre/gui2/dialogs/template_dialog.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manual/template_lang.rst b/manual/template_lang.rst index 33f4d1287c..34656e84e7 100644 --- a/manual/template_lang.rst +++ b/manual/template_lang.rst @@ -407,10 +407,10 @@ Relational operators return ``'1'`` if the comparison is true, otherwise the emp There are two forms of relational operators: string comparisons and numeric comparisons. -String comparisons do case-insensitive string comparison using lexical order. The supported string comparison operators are ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``, ``in``, ``inlist``, and ``field_inlist``. +String comparisons do case-insensitive string comparison using lexical order. The supported string comparison operators are ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``, ``in``, ``inlist``, and ``inlist_field``. For the ``in`` operator, the result of the left hand expression is interpreted as a regular expression pattern. The ``in`` operator is True if the value of left-hand regular expression matches the value of the right hand expression. -The ``inlist`` operator is true if the left hand regular expression matches any one of the items in the right hand list where the items in the list are separated by commas. The ``field_inlist`` operator is true if the left hand regular expression matches any of the items in the field (column) named by the right hand expression, using the separator defined for the field. NB: the ``field_inlist`` operator requires the right hand expression to evaluate to a field name, while the ``inlist`` operator requires the right hand expression to evaluate to a string containing a comma-separated list. Because of this difference, ``field_inlist`` is substantially faster than ``inlist`` because no string conversions or list constructions are done. The regular expressions are case-insensitive. +The ``inlist`` operator is true if the left hand regular expression matches any one of the items in the right hand list where the items in the list are separated by commas. The ``inlist_field`` operator is true if the left hand regular expression matches any of the items in the field (column) named by the right hand expression, using the separator defined for the field. NB: the ``inlist_field`` operator requires the right hand expression to evaluate to a field name, while the ``inlist`` operator requires the right hand expression to evaluate to a string containing a comma-separated list. Because of this difference, ``inlist_field`` is substantially faster than ``inlist`` because no string conversions or list constructions are done. The regular expressions are case-insensitive. The numeric comparison operators are ``==#``, ``!=#``, ``<#``, ``<=#``, ``>#``, ``>=#``. The left and right expressions must evaluate to numeric values with two exceptions: both the string value "None" (undefined field) and the empty string evaluate to the value zero. diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py index 428f04b568..f7d2f7ae26 100644 --- a/src/calibre/gui2/dialogs/template_dialog.py +++ b/src/calibre/gui2/dialogs/template_dialog.py @@ -75,7 +75,7 @@ class TemplateHighlighter(QSyntaxHighlighter): KEYWORDS_GPM = ['if', 'then', 'else', 'elif', 'fi', 'for', 'rof', 'separator', 'break', 'continue', 'return', 'in', 'inlist', - 'field_inlist', 'def', 'fed', 'limit'] + 'inlist_field', 'def', 'fed', 'limit'] KEYWORDS_PYTHON = ["and", "as", "assert", "break", "class", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from",