From ef2443cb968a97556a70dfe4e1838847934fd175 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sun, 21 May 2023 17:43:26 +0100 Subject: [PATCH] String changes/corrections --- .../gui2/preferences/template_functions.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index 294e6747f9..ef6d37b655 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -88,14 +88,15 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): in template processing. You use a stored template in another template as if it were a template function, for example 'some_name(arg1, arg2...)'.

-

Stored templates must use General Program Mode -- they must - either begin with the text '{0}' or be {1}. You retrieve arguments - passed to a GPM stored template using the '{2}()' template function, as - in '{2}(var1, var2, ...)'. The passed arguments are copied to the named - variables. Arguments passed to a Python template are in the '{2}' - parameter. Arguments are always strings.

+

Stored templates must use General Program Mode or Python Template + Mode -- they must begin with the text '{0}' or '{1}'. You retrieve + arguments passed to a GPM stored template using the '{2}()' template + function, as in '{2}(var1, var2, ...)'. The passed arguments are copied + to the named variables. Arguments passed to a Python template are in the + '{2}' attribute (a list) of the '{3}' parameter. Arguments are always + strings.

-

For example, this stored template checks if any items are in a +

For example, this stored GPM template checks if any items are in a list, returning '1' if any are found and '' if not.

Template name: items_in_list
@@ -115,7 +116,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): See the template language tutorial for more information.

''') - self.st_textBrowser.setHtml(help_text.format('program:', 'python templates', 'arguments')) + self.st_textBrowser.setHtml(help_text.format('program:', 'python:', 'arguments', 'context')) self.st_textBrowser.adjustSize() self.st_show_hide_help_button.clicked.connect(self.st_show_hide_help) self.st_textBrowser_height = self.st_textBrowser.height()