Debian Codegraph @

translations/manual/bn_BD/template_lang.po

raw
1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) Kovid Goyal
3 # This file is distributed under the same license as the calibre package.
4 #
5 # Translators:
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: calibre\n"
9 "Report-Msgid-Bugs-To: \n"
10 "POT-Creation-Date: 2022-06-17 02:39+0000\n"
11 "PO-Revision-Date: 2014-06-17 08:34+0000\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: Bengali (Bangladesh) (http://www.transifex.com/calibre/calibre/language/bn_BD/)\n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17 "Language: bn_BD\n"
18 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
20 #: ../../__w/calibre/calibre/manual/template_lang.rst:4
21 msgid "The calibre template language"
22 msgstr ""
23
24 #: ../../__w/calibre/calibre/manual/template_lang.rst:6
25 msgid ""
26 "The calibre template language is a calibre-specific language used throughout"
27 " calibre for tasks such as specifying file paths, formatting values, and "
28 "computing the value for user-specified columns. Examples:"
29 msgstr ""
30
31 #: ../../__w/calibre/calibre/manual/template_lang.rst:8
32 msgid ""
33 "Specify the folder structure and file names when saving files from the "
34 "calibre library to the disk or e-book reader."
35 msgstr ""
36
37 #: ../../__w/calibre/calibre/manual/template_lang.rst:9
38 msgid "Define rules for adding icons and colors to the calibre book list."
39 msgstr ""
40
41 #: ../../__w/calibre/calibre/manual/template_lang.rst:10
42 msgid "Define `virtual columns` that contain data from other columns."
43 msgstr ""
44
45 #: ../../__w/calibre/calibre/manual/template_lang.rst:11
46 msgid "Advanced library searching."
47 msgstr ""
48
49 #: ../../__w/calibre/calibre/manual/template_lang.rst:12
50 msgid "Advanced metadata search and replace."
51 msgstr ""
52
53 #: ../../__w/calibre/calibre/manual/template_lang.rst:14
54 msgid ""
55 "The language is built around the notion of a `template`, which specifies "
56 "which book metadata to use, computations on that metadata, and how it is to "
57 "be formatted."
58 msgstr ""
59
60 #: ../../__w/calibre/calibre/manual/template_lang.rst:17
61 msgid "Basic templates"
62 msgstr ""
63
64 #: ../../__w/calibre/calibre/manual/template_lang.rst:19
65 msgid ""
66 "A basic template consists one or more ``template expressions``. A ``template"
67 " expression`` consists of text and names in curly brackets (``{}``) that is "
68 "replaced by the corresponding metadata from the book being processed. For "
69 "example, the default template in calibre used for saving books to device has"
70 " 4 ``template expressions``::"
71 msgstr ""
72
73 #: ../../__w/calibre/calibre/manual/template_lang.rst:23
74 msgid "For the book \"The Foundation\" by \"Isaac Asimov\" the will become::"
75 msgstr ""
76
77 #: ../../__w/calibre/calibre/manual/template_lang.rst:27
78 msgid ""
79 "The slashes are not ``template expressions`` because they are in between in "
80 "``{}``. Such text is left where it appears. For example, if the template "
81 "is::"
82 msgstr ""
83
84 #: ../../__w/calibre/calibre/manual/template_lang.rst:31
85 msgid "then for \"The Foundation\" the template produces::"
86 msgstr ""
87
88 #: ../../__w/calibre/calibre/manual/template_lang.rst:35
89 msgid ""
90 "A ``template expression`` can access all the metadata available in calibre, "
91 "including custom columns (columns you create yourself), by using a column's "
92 "``lookup name``. To find the lookup name for a `column` (sometimes called "
93 "`fields`), hover your mouse over the column header in calibre's book list. "
94 "Lookup names for custom columns always begin with ``#``. For series type "
95 "columns there is an additional field named ``#lookup name_index`` that is "
96 "the series index for that book in the series. For example, if you have a "
97 "custom series column named ``#myseries``, there will also be a column named "
98 "``#myseries_index``. The standard series column's index is named "
99 "``series_index``."
100 msgstr ""
101
102 #: ../../__w/calibre/calibre/manual/template_lang.rst:37
103 msgid "In addition to the standard column based fields, you also can use:"
104 msgstr ""
105
106 #: ../../__w/calibre/calibre/manual/template_lang.rst:39
107 msgid ""
108 "``{formats}`` - A list of formats available in the calibre library for a "
109 "book"
110 msgstr ""
111
112 #: ../../__w/calibre/calibre/manual/template_lang.rst:40
113 msgid "``{identifiers:select(isbn)}`` - The ISBN of the book"
114 msgstr ""
115
116 #: ../../__w/calibre/calibre/manual/template_lang.rst:42
117 msgid ""
118 "If the metadata for the field for a given book is not defined then the field"
119 " in the template is replaced by the empty string (``''``). For example, "
120 "consider the following template::"
121 msgstr ""
122
123 #: ../../__w/calibre/calibre/manual/template_lang.rst:46
124 msgid ""
125 "If Asimov's book \"Second Foundation\" is in the series \"Foundation\" then "
126 "the template produces::"
127 msgstr ""
128
129 #: ../../__w/calibre/calibre/manual/template_lang.rst:50
130 msgid ""
131 "If a series has not been entered for the book then the template produces::"
132 msgstr ""
133
134 #: ../../__w/calibre/calibre/manual/template_lang.rst:54
135 msgid ""
136 "The template processor automatically removes multiple slashes and leading or"
137 " trailing spaces."
138 msgstr ""
139
140 #: ../../__w/calibre/calibre/manual/template_lang.rst:57
141 msgid "Advanced formatting"
142 msgstr ""
143
144 #: ../../__w/calibre/calibre/manual/template_lang.rst:59
145 msgid ""
146 "In addition to metadata substitution, templates can conditionally include "
147 "additional text and control how substituted data is formatted."
148 msgstr ""
149
150 #: ../../__w/calibre/calibre/manual/template_lang.rst:61
151 msgid "**Conditionally including text**"
152 msgstr ""
153
154 #: ../../__w/calibre/calibre/manual/template_lang.rst:63
155 msgid ""
156 "Sometimes you want text to appear in the output only if a field is not "
157 "empty. A common case is ``series`` and ``series_index`` where you want "
158 "either nothing or the two values separated by a hyphen. calibre handles this"
159 " case using a special ``template expression`` syntax."
160 msgstr ""
161
162 #: ../../__w/calibre/calibre/manual/template_lang.rst:65
163 msgid ""
164 "For example and using the above Foundation example, assume you want the "
165 "template to produce `Foundation - 3 - Second Foundation`. This template "
166 "produces that output:"
167 msgstr ""
168
169 #: ../../__w/calibre/calibre/manual/template_lang.rst:67
170 msgid "``{series} - {series_index} - {title}``"
171 msgstr ""
172
173 #: ../../__w/calibre/calibre/manual/template_lang.rst:69
174 msgid ""
175 "However, if a book has no series the template will produce `- - the title`, "
176 "which is probably not what you want. Generally, people want the result be "
177 "the title without the extraneous hyphens. You can accomplish this using the "
178 "following template syntax:"
179 msgstr ""
180
181 #: ../../__w/calibre/calibre/manual/template_lang.rst:71
182 msgid "``{field:|prefix_text|suffix_text}``"
183 msgstr ""
184
185 #: ../../__w/calibre/calibre/manual/template_lang.rst:73
186 msgid ""
187 "This ``template expression`` says that if ``field`` has the value `XXXX` "
188 "then the result will be `prefix_textXXXXXsuffix_text`. If ``field`` is empty"
189 " (has no value) then the result will be the empty string (nothing) because "
190 "the prefix and suffix are ignored. The prefix and suffix can contain blanks."
191 msgstr ""
192
193 #: ../../__w/calibre/calibre/manual/template_lang.rst:75
194 msgid ""
195 "**Do not use subtemplates (`{ ... }`) or functions (see below) in the prefix"
196 " or the suffix.**"
197 msgstr ""
198
199 #: ../../__w/calibre/calibre/manual/template_lang.rst:77
200 msgid ""
201 "Using this syntax, we can solve the above no-series problem with the "
202 "template::"
203 msgstr ""
204
205 #: ../../__w/calibre/calibre/manual/template_lang.rst:81
206 msgid ""
207 "The hyphens will be included only if the book has a series index, which it "
208 "has only if it has a series. Continuing the Foundation example again, the "
209 "template will produce `Foundation - 1 - Second Foundation`."
210 msgstr ""
211
212 #: ../../__w/calibre/calibre/manual/template_lang.rst:83
213 #: ../../__w/calibre/calibre/manual/template_lang.rst:260
214 msgid "Notes:"
215 msgstr ""
216
217 #: ../../__w/calibre/calibre/manual/template_lang.rst:85
218 msgid ""
219 "You must include the colon after the ``lookup name`` if you are using a "
220 "prefix or a suffix."
221 msgstr ""
222
223 #: ../../__w/calibre/calibre/manual/template_lang.rst:86
224 msgid ""
225 "You must either use either no or both ``|`` characters. Using one, as in "
226 "``{field:| - }``, is not allowed."
227 msgstr ""
228
229 #: ../../__w/calibre/calibre/manual/template_lang.rst:87
230 msgid ""
231 "It is OK to provide no text for either the prefix or the suffix, such as in "
232 "``{series:|| - }``. The template ``{title:||}`` is the same as ``{title}``."
233 msgstr ""
234
235 #: ../../__w/calibre/calibre/manual/template_lang.rst:89
236 msgid "**Formatting**"
237 msgstr ""
238
239 #: ../../__w/calibre/calibre/manual/template_lang.rst:91
240 msgid ""
241 "Suppose you want the ``series_index`` to be formatted as three digits with "
242 "leading zeros. This does the trick:"
243 msgstr ""
244
245 #: ../../__w/calibre/calibre/manual/template_lang.rst:93
246 msgid "``{series_index:0>3s}`` - Three digits with leading zeros"
247 msgstr ""
248
249 #: ../../__w/calibre/calibre/manual/template_lang.rst:95
250 msgid "For trailing zeros, use:"
251 msgstr ""
252
253 #: ../../__w/calibre/calibre/manual/template_lang.rst:97
254 msgid "``{series_index:0<3s}`` - Three digits with trailing zeros"
255 msgstr ""
256
257 #: ../../__w/calibre/calibre/manual/template_lang.rst:99
258 msgid ""
259 "If you use series indices with fractional values, e.g., 1.1, you might want "
260 "the decimal points to line up. For example, you might want the indices 1 and"
261 " 2.5 to appear as 01.00 and 02.50 so that they will sort correctly on a "
262 "device that does lexical sorting. To do this, use:"
263 msgstr ""
264
265 #: ../../__w/calibre/calibre/manual/template_lang.rst:101
266 msgid ""
267 "``{series_index:0>5.2f}`` - Five characters consisting of two digits with "
268 "leading zeros, a decimal point, then 2 digits after the decimal point."
269 msgstr ""
270
271 #: ../../__w/calibre/calibre/manual/template_lang.rst:103
272 msgid "If you want only the first two letters of the data, use:"
273 msgstr ""
274
275 #: ../../__w/calibre/calibre/manual/template_lang.rst:105
276 msgid ""
277 "``{author_sort:.2}`` - Only the first two letters of the author sort name"
278 msgstr ""
279
280 #: ../../__w/calibre/calibre/manual/template_lang.rst:107
281 msgid ""
282 "Much of the calibre template language formatting comes from Python. For more"
283 " details on the syntax of these advanced formatting operations see the "
284 "`Python documentation "
285 "<https://docs.python.org/3/library/string.html#formatstrings>`_."
286 msgstr ""
287
288 #: ../../__w/calibre/calibre/manual/template_lang.rst:111
289 msgid "Using templates to define custom columns"
290 msgstr ""
291
292 #: ../../__w/calibre/calibre/manual/template_lang.rst:113
293 msgid ""
294 "Templates can be used to display information that isn't in calibre metadata,"
295 " or to display metadata differently from calibre's normal format. For "
296 "example, you might want to show the ``ISBN``, a field that calibre does not "
297 "display. You can accomplish this creating a custom column with the type "
298 "`Column built from other columns` (hereafter called `composite columns`) and"
299 " providing a template to generate the displayed text. The column will "
300 "display the result of evaluating the template. For example, to display the "
301 "ISBN, create the column and enter ``{identifiers:select(isbn)}`` in the "
302 "template box. To display a column containing the values of two series custom"
303 " columns, separated by a comma, use ``{#series1:||,}{#series2}``."
304 msgstr ""
305
306 #: ../../__w/calibre/calibre/manual/template_lang.rst:115
307 msgid "Composite columns can use any template option, including formatting."
308 msgstr ""
309
310 #: ../../__w/calibre/calibre/manual/template_lang.rst:117
311 msgid ""
312 "Note: You cannot edit the data displayed in a composite column. Instead you "
313 "edit the source columns. If you edit a composite column, for example by "
314 "double-clicking it, calibre will open the template for editing, not the "
315 "underlying data."
316 msgstr ""
317
318 #: ../../__w/calibre/calibre/manual/template_lang.rst:122
319 msgid "Using functions in templates - Single Function Mode"
320 msgstr ""
321
322 #: ../../__w/calibre/calibre/manual/template_lang.rst:124
323 msgid ""
324 "Suppose you want to display the value of a field in upper case when that "
325 "field is normally in title case. You can do this using `template functions`."
326 " For example, to display the title in upper case use the ``uppercase`` "
327 "function, as in ``{title:uppercase()}``. To display it in title case, use "
328 "``{title:titlecase()}``."
329 msgstr ""
330
331 #: ../../__w/calibre/calibre/manual/template_lang.rst:126
332 msgid ""
333 "Functions go into the format part of the template, after the ``:`` and "
334 "before the first ``|`` or the closing ``}`` if no prefix/suffix is used. If "
335 "you have both a format and a function reference, the function comes after a "
336 "second ``:``. Functions return the value of the column specified in the "
337 "template, suitably modified."
338 msgstr ""
339
340 #: ../../__w/calibre/calibre/manual/template_lang.rst:128
341 msgid "The syntax for using functions is one of::"
342 msgstr ""
343
344 #: ../../__w/calibre/calibre/manual/template_lang.rst:135
345 msgid ""
346 "Function names must always be followed by opening and closing parentheses. "
347 "Some functions require extra values (arguments), and these go inside the "
348 "parentheses. Arguments are separated by commas. Literal commas (commas as "
349 "text, not argument separators) must be preceded by a backslash (``\\``) . "
350 "The last (or only) argument cannot contain a textual closing parenthesis."
351 msgstr ""
352
353 #: ../../__w/calibre/calibre/manual/template_lang.rst:137
354 msgid ""
355 "Functions are evaluated before format specifications and the prefix/suffix. "
356 "See further down for an example of using both a format and a function."
357 msgstr ""
358
359 #: ../../__w/calibre/calibre/manual/template_lang.rst:139
360 msgid ""
361 "**Important**: If you have programming experience, please note that the "
362 "syntax in `Single Function Mode` is not what you expect. Strings are not "
363 "quoted and spaces are significant. All arguments are considered to be "
364 "constants; there are no expressions."
365 msgstr ""
366
367 #: ../../__w/calibre/calibre/manual/template_lang.rst:141
368 msgid ""
369 "**Do not use subtemplates (`{ ... }`) as function arguments.** Instead, use "
370 ":ref:`Template Program Mode <template_mode>` and :ref:`General Program Mode "
371 "<general_mode>`."
372 msgstr ""
373
374 #: ../../__w/calibre/calibre/manual/template_lang.rst:143
375 msgid ""
376 "Some functions require regular expressions. In the template language regular"
377 " expression matching is case-insensitive."
378 msgstr ""
379
380 #: ../../__w/calibre/calibre/manual/template_lang.rst:145
381 msgid ""
382 "In the function documentation below, the notation ``[something]*`` means "
383 "that ``something`` can be repeated zero or more times. The notation "
384 "``[something]+`` means that the ``something`` is repeated one or more times "
385 "(must exist at least one time)."
386 msgstr ""
387
388 #: ../../__w/calibre/calibre/manual/template_lang.rst:147
389 msgid "The functions intended for use in Single Function Mode are:"
390 msgstr ""
391
392 #: ../../__w/calibre/calibre/manual/template_lang.rst:150
393 msgid ""
394 "``capitalize()`` -- returns the value with the first letter upper case and "
395 "the rest lower case."
396 msgstr ""
397
398 #: ../../__w/calibre/calibre/manual/template_lang.rst:151
399 msgid ""
400 "``contains(pattern, text if match, text if not match)`` -- checks if the "
401 "value is matched by the regular expression ``pattern``. Returns ``text if "
402 "match`` if the pattern matches the value, otherwise returns ``text if no "
403 "match``."
404 msgstr ""
405
406 #: ../../__w/calibre/calibre/manual/template_lang.rst:152
407 msgid ""
408 "``count(separator)`` -- interprets the value as a list of items separated by"
409 " ``separator`` and returns the number of items in the list. Most lists use a"
410 " comma as the separator, but ``authors`` uses an ampersand (&). Examples: "
411 "``{tags:count(,)}``, ``{authors:count(&)}``. Aliases: ``count()``, "
412 "``list_count()``"
413 msgstr ""
414
415 #: ../../__w/calibre/calibre/manual/template_lang.rst:153
416 msgid ""
417 "``format_number(template)`` -- interprets the value as a number and formats "
418 "that number using a Python formatting template such as ``{0:5.2f}`` or "
419 "``{0:,d}`` or ``${0:5,.2f}``. The formatting template must begin with "
420 "``{0:`` and end with ``}`` as in the above examples. Exception: you can "
421 "leave off the leading \"{0:\" and trailing \"}\" if the format template "
422 "contains only a format. See the template language and the `Python "
423 "documentation "
424 "<https://docs.python.org/3/library/string.html#formatstrings>`_ for more "
425 "examples. Returns the empty string if formatting fails."
426 msgstr ""
427
428 #: ../../__w/calibre/calibre/manual/template_lang.rst:154
429 msgid ""
430 "``human_readable()`` -- expects the value to be a number and returns a "
431 "string representing that number in KB, MB, GB, etc."
432 msgstr ""
433
434 #: ../../__w/calibre/calibre/manual/template_lang.rst:155
435 msgid ""
436 "``ifempty(text if empty)`` -- if the value is not empty then return the "
437 "value of the field, otherwise return `text if empty`."
438 msgstr ""
439
440 #: ../../__w/calibre/calibre/manual/template_lang.rst:156
441 msgid ""
442 "``in_list(separator, [ pattern, found_val, ]* not_found_val)`` -- interpret "
443 "the value as a list of items separated by ``separator``, checking the "
444 "``pattern`` against each item in the list. If the ``pattern`` matches an "
445 "item then return ``found_val``, otherwise return ``not_found_val``. The pair"
446 " ``pattern`` and ``found_value`` can be repeated as many times as desired, "
447 "permitting returning different values depending on the item's value. The "
448 "patterns are checked in order, and the first match is returned."
449 msgstr ""
450
451 #: ../../__w/calibre/calibre/manual/template_lang.rst:157
452 msgid ""
453 "``language_strings(localize)`` -- return the `language names "
454 "<https://www.loc.gov/standards/iso639-2/php/code_list.php>`_ for the "
455 "`language codes <https://www.loc.gov/standards/iso639-2/php/code_list.php>`_"
456 " passed in as the value. Example: ``{languages:language_strings()}``. If "
457 "``localize`` is zero, return the strings in English. If ``localize`` is not "
458 "zero, return the strings in the language of the current locale. "
459 "``Lang_codes`` is a comma-separated list."
460 msgstr ""
461
462 #: ../../__w/calibre/calibre/manual/template_lang.rst:158
463 msgid ""
464 "``list_item(index, separator)`` -- interpret the value as a list of items "
465 "separated by ``separator``, returning the 'index'th item. The first item is "
466 "number zero. The last item has the index ``-1`` as in "
467 "``list_item(-1,separator)``. If the item is not in the list, then the empty "
468 "string is returned."
469 msgstr ""
470
471 #: ../../__w/calibre/calibre/manual/template_lang.rst:159
472 msgid ""
473 "``lookup([ pattern, key, ]* else_key)`` -- The patterns will be checked "
474 "against the value in order. If a pattern matches then the value of the field"
475 " named by ``key`` is returned. If no pattern matches then the value of the "
476 "field named by ``else_key`` is returned. See``switch`` (below)."
477 msgstr ""
478
479 #: ../../__w/calibre/calibre/manual/template_lang.rst:160
480 msgid "``lowercase()`` -- returns the value of the field in lower case."
481 msgstr ""
482
483 #: ../../__w/calibre/calibre/manual/template_lang.rst:161
484 msgid ""
485 "``rating_to_stars(use_half_stars)`` -- Returns the rating as string of star "
486 "(``★``) characters. The value must be a number between 0 and 5. Set "
487 "use_half_stars to 1 if you want half star characters for fractional numbers "
488 "available with custom ratings columns."
489 msgstr ""
490
491 #: ../../__w/calibre/calibre/manual/template_lang.rst:162
492 msgid ""
493 "``re(pattern, replacement)`` -- return the value after applying the regular "
494 "expression. All instances of ``pattern`` in the value are replaced with "
495 "``replacement``. The template language uses case insensitive `Python regular"
496 " expressions <https://docs.python.org/3/library/re.html>`_."
497 msgstr ""
498
499 #: ../../__w/calibre/calibre/manual/template_lang.rst:163
500 msgid ""
501 "``select(key)`` -- interpret the value as a comma-separated list of items "
502 "with each item having the form ``id:value`` (the calibre ``identifier`` "
503 "format). The function finds the first pair with the id equal to key and "
504 "returns the corresponding value. If no id matches then the function returns "
505 "the empty string."
506 msgstr ""
507
508 #: ../../__w/calibre/calibre/manual/template_lang.rst:164
509 msgid ""
510 "``shorten(left chars, middle text, right chars)`` -- Return a shortened "
511 "version of the value, consisting of ``left chars`` characters from the "
512 "beginning of the value, followed by ``middle text``, followed by ``right "
513 "chars`` characters from the end of the value. ``Left chars`` and ``right "
514 "chars`` must be non-negative integers. Example: assume you want to display "
515 "the title with a length of at most 15 characters in length. One template "
516 "that does this is ``{title:shorten(9,-,5)}``. For a book with the title "
517 "`Ancient English Laws in the Times of Ivanhoe` the result will be `Ancient "
518 "E-anhoe`: the first 9 characters of the title, a ``-``, then the last 5 "
519 "characters. If the value's length is less than ``left chars`` + ``right "
520 "chars`` + the length of ``middle text`` then the value will be returned "
521 "unchanged. For example, the title `The Dome` would not be changed."
522 msgstr ""
523
524 #: ../../__w/calibre/calibre/manual/template_lang.rst:165
525 msgid ""
526 "``str_in_list(separator, [ string, found_val, ]+ not_found_val)`` -- "
527 "interpret the value as a list of items separated by ``separator`` then "
528 "compare ``string`` against each value in the list. The ``string`` is not a "
529 "regular expression. If ``string`` is equal to any item (ignoring case) then "
530 "return the corresponding ``found_val``. If ``string`` contains "
531 "``separators`` then it is also treated as a list and each subvalue is "
532 "checked. The ``string`` and ``found_value`` pairs can be repeated as many "
533 "times as desired, permitting returning different values depending on "
534 "string's value. If none of the strings match then ``not_found_value`` is "
535 "returned. The strings are checked in order. The first match is returned."
536 msgstr ""
537
538 #: ../../__w/calibre/calibre/manual/template_lang.rst:166
539 msgid ""
540 "``subitems(start_index, end_index)`` -- This function breaks apart lists of "
541 "tag-like hierarchical items such as genres. It interprets the value as a "
542 "comma-separated list of tag-like items, where each item is a period-"
543 "separated list. It returns a new list made by extracting from each item the "
544 "components from ``start_index`` to ``end_index``, then merging the results "
545 "back together. Duplicates are removed. The first subitem in a period-"
546 "separated list has an index of zero. If an index is negative then it counts "
547 "from the end of the list. As a special case, an end_index of zero is assumed"
548 " to be the length of the list."
549 msgstr ""
550
551 #: ../../__w/calibre/calibre/manual/template_lang.rst:168
552 #: ../../__w/calibre/calibre/manual/template_lang.rst:388
553 msgid "Examples:"
554 msgstr "উদাহরণ"
555
556 #: ../../__w/calibre/calibre/manual/template_lang.rst:170
557 msgid "Assuming a #genre column containing `A.B.C`:"
558 msgstr ""
559
560 #: ../../__w/calibre/calibre/manual/template_lang.rst:172
561 msgid "``{#genre:subitems(0,1)}`` returns \"A\""
562 msgstr ""
563
564 #: ../../__w/calibre/calibre/manual/template_lang.rst:173
565 msgid "``{#genre:subitems(0,2)}`` returns \"A.B\""
566 msgstr ""
567
568 #: ../../__w/calibre/calibre/manual/template_lang.rst:174
569 msgid "``{#genre:subitems(1,0)}`` returns \"B.C\""
570 msgstr ""
571
572 #: ../../__w/calibre/calibre/manual/template_lang.rst:176
573 msgid "Assuming a #genre column containing \"A.B.C, D.E\":"
574 msgstr ""
575
576 #: ../../__w/calibre/calibre/manual/template_lang.rst:178
577 msgid "``{#genre:subitems(0,1)}`` returns \"A, D\""
578 msgstr ""
579
580 #: ../../__w/calibre/calibre/manual/template_lang.rst:179
581 msgid "``{#genre:subitems(0,2)}`` returns \"A.B, D.E\""
582 msgstr ""
583
584 #: ../../__w/calibre/calibre/manual/template_lang.rst:181
585 msgid ""
586 "``sublist(start_index, end_index, separator)`` -- interpret the value as a "
587 "list of items separated by ``separator``, returning a new list made from the"
588 " items from ``start_index`` to ``end_index``. The first item is number zero."
589 " If an index is negative, then it counts from the end of the list. As a "
590 "special case, an end_index of zero is assumed to be the length of the list."
591 msgstr ""
592
593 #: ../../__w/calibre/calibre/manual/template_lang.rst:183
594 msgid ""
595 "Examples assuming that the tags column (which is comma-separated) contains "
596 "\"A, B ,C\":"
597 msgstr ""
598
599 #: ../../__w/calibre/calibre/manual/template_lang.rst:185
600 msgid "``{tags:sublist(0,1,\\,)}`` returns \"A\""
601 msgstr ""
602
603 #: ../../__w/calibre/calibre/manual/template_lang.rst:186
604 msgid "``{tags:sublist(-1,0,\\,)}`` returns \"C\""
605 msgstr ""
606
607 #: ../../__w/calibre/calibre/manual/template_lang.rst:187
608 msgid "``{tags:sublist(0,-1,\\,)}`` returns \"A, B\""
609 msgstr ""
610
611 #: ../../__w/calibre/calibre/manual/template_lang.rst:189
612 msgid ""
613 "``swap_around_articles(separator)`` -- returns the value with articles moved"
614 " to the end. The value can be a list, in which case each item in the list is"
615 " processed. If the value is a list then you must provide the ``separator``. "
616 "If no ``separator`` is provided then the value is treated as being a single "
617 "value, not a list. The `articles` are those used by calibre to generate the "
618 "``title_sort``."
619 msgstr ""
620
621 #: ../../__w/calibre/calibre/manual/template_lang.rst:190
622 msgid ""
623 "``swap_around_comma()`` -- given a value of the form ``B, A``, return ``A "
624 "B``. This is most useful for converting names in LN, FN format to FN LN. If "
625 "there is no comma in the value then the function returns the value "
626 "unchanged."
627 msgstr ""
628
629 #: ../../__w/calibre/calibre/manual/template_lang.rst:191
630 msgid ""
631 "``switch([pattern, value,]+ else_value)`` -- for each ``pattern, value`` "
632 "pair, checks if the value matches the regular expression ``pattern`` and if "
633 "so returns the associated ``value``. If no ``pattern`` matches, then "
634 "``else_value`` is returned. You can have as many ``pattern, value`` pairs as"
635 " you wish. The first match is returned."
636 msgstr ""
637
638 #: ../../__w/calibre/calibre/manual/template_lang.rst:192
639 msgid ""
640 "``test(text if not empty, text if empty)`` -- return ``text if not empty`` "
641 "if the value is not empty, otherwise return ``text if empty``."
642 msgstr ""
643
644 #: ../../__w/calibre/calibre/manual/template_lang.rst:193
645 msgid "``titlecase()`` -- returns the value of the field in title case."
646 msgstr ""
647
648 #: ../../__w/calibre/calibre/manual/template_lang.rst:194
649 msgid ""
650 "``transliterate()`` -- Return a string in a latin alphabet formed by "
651 "approximating the sound of the words in the source field. For example, if "
652 "the source field is ``Фёдор Миха́йлович Достоевский`` this function returns "
653 "``Fiodor Mikhailovich Dostoievskii``."
654 msgstr ""
655
656 #: ../../__w/calibre/calibre/manual/template_lang.rst:195
657 msgid "``uppercase()`` -- returns the value of the field in upper case."
658 msgstr ""
659
660 #: ../../__w/calibre/calibre/manual/template_lang.rst:197
661 msgid "**Using functions and formatting in the same template**"
662 msgstr ""
663
664 #: ../../__w/calibre/calibre/manual/template_lang.rst:199
665 msgid ""
666 "Suppose you have an integer custom column ``#myint`` that you want displayed"
667 " with leading zeros, as in ``003``. One way to do this is to use a format of"
668 " ``0>3s``. However, by default if a number (integer or float) equals zero "
669 "then the value is displayed as the empty string so zero values will produce "
670 "the empty string, not ``000``. If you want to see ``000`` values then you "
671 "use both the format string and the ``ifempty`` function to change the empty "
672 "value back to a zero. The template would be::"
673 msgstr ""
674
675 #: ../../__w/calibre/calibre/manual/template_lang.rst:203
676 msgid ""
677 "Note that you can use the prefix and suffix as well. If you want the number "
678 "to appear as ``[003]`` or ``[000]``, then use the template::"
679 msgstr ""
680
681 #: ../../__w/calibre/calibre/manual/template_lang.rst:210
682 msgid "General Program Mode"
683 msgstr ""
684
685 #: ../../__w/calibre/calibre/manual/template_lang.rst:212
686 msgid ""
687 "`General Program Mode` (`GPM`) replaces `template expressions` with a "
688 "program written in the `template language`. The syntax of the language is "
689 "defined by the following grammar::"
690 msgstr ""
691
692 #: ../../__w/calibre/calibre/manual/template_lang.rst:262
693 msgid ""
694 "a ``top_expression`` always has a value. The value of an ``expression_list``"
695 " is the value of the last ``top_expression`` in the list. For example, the "
696 "value of the expression list ``1;2;'foobar';3`` is ``3``."
697 msgstr ""
698
699 #: ../../__w/calibre/calibre/manual/template_lang.rst:263
700 msgid "In a logical context, any non-empty value is ``True``"
701 msgstr ""
702
703 #: ../../__w/calibre/calibre/manual/template_lang.rst:264
704 msgid "In a logical context, the empty value is ``False``"
705 msgstr ""
706
707 #: ../../__w/calibre/calibre/manual/template_lang.rst:265
708 msgid ""
709 "Strings and numbers can be used interchangeably. For example, ``10`` and "
710 "``'10'`` are the same thing."
711 msgstr ""
712
713 #: ../../__w/calibre/calibre/manual/template_lang.rst:266
714 msgid ""
715 "Comments are lines starting with a '#' character. Comments beginning later "
716 "in a line are not supported."
717 msgstr ""
718
719 #: ../../__w/calibre/calibre/manual/template_lang.rst:268
720 msgid "**Operator precedence**"
721 msgstr ""
722
723 #: ../../__w/calibre/calibre/manual/template_lang.rst:270
724 msgid ""
725 "The operator precedence (order of evaluation) from highest (evaluated first)"
726 " to lowest (evaluated last) is:"
727 msgstr ""
728
729 #: ../../__w/calibre/calibre/manual/template_lang.rst:272
730 msgid ""
731 "Function calls, constants, parenthesized expressions, statement expressions,"
732 " assignment expressions, field references."
733 msgstr ""
734
735 #: ../../__w/calibre/calibre/manual/template_lang.rst:273
736 msgid ""
737 "Unary plus (``+``) and minus (``-``). These operators evaluate right to "
738 "left."
739 msgstr ""
740
741 #: ../../__w/calibre/calibre/manual/template_lang.rst:275
742 msgid ""
743 "These and all the other arithmetic operators return integers if the "
744 "expression results in a fractional part equal to zero. For example, if an "
745 "expression returns ``3.0`` it is changed to ``3``."
746 msgstr ""
747
748 #: ../../__w/calibre/calibre/manual/template_lang.rst:276
749 msgid ""
750 "Multiply (``*``) and divide (``/``). These operators are associative and "
751 "evaluate left to right. Use parentheses if you want to change the order of "
752 "evaluation."
753 msgstr ""
754
755 #: ../../__w/calibre/calibre/manual/template_lang.rst:277
756 msgid ""
757 "Add (``+``) and subtract (``-``). These operators are associative and "
758 "evaluate left to right."
759 msgstr ""
760
761 #: ../../__w/calibre/calibre/manual/template_lang.rst:278
762 msgid ""
763 "Numeric and string comparisons. These operators return ``'1'`` if the "
764 "comparison succeeds, otherwise the empty string (``''``). Comparisons are "
765 "not associative: ``a < b < c`` is a syntax error."
766 msgstr ""
767
768 #: ../../__w/calibre/calibre/manual/template_lang.rst:279
769 msgid ""
770 "String concatenation (``&``). The ``&`` operator returns a string formed by "
771 "concatenating the left-hand and right-hand expressions. Example: ``'aaa' & "
772 "'bbb'`` returns ``'aaabbb'``. The operator is associative and evaluates left"
773 " to right."
774 msgstr ""
775
776 #: ../../__w/calibre/calibre/manual/template_lang.rst:280
777 msgid ""
778 "Unary logical not (``!``). This operator returns ``'1'`` if the expression "
779 "is False (evaluates to the empty string), otherwise ``''``."
780 msgstr ""
781
782 #: ../../__w/calibre/calibre/manual/template_lang.rst:281
783 msgid ""
784 "Logical and (``&&``). This operator returns '1' if both the left-hand and "
785 "right-hand expressions are True, or the empty string ``''`` if either is "
786 "False. It is associative, evaluates left to right, and does `short-"
787 "circuiting <https://chortle.ccsu.edu/java5/Notes/chap40/ch40_2.html>`_."
788 msgstr ""
789
790 #: ../../__w/calibre/calibre/manual/template_lang.rst:282
791 msgid ""
792 "Logical or (``||``). This operator returns ``'1'`` if either the left-hand "
793 "or right-hand expression is True, or ``''`` if both are False. It is "
794 "associative, evaluates left to right, and does `short-circuiting "
795 "<https://chortle.ccsu.edu/java5/Notes/chap40/ch40_2.html>`_. It is an "
796 "`inclusive or`, returning ``'1'`` if both the left- and right-hand "
797 "expressions are True."
798 msgstr ""
799
800 #: ../../__w/calibre/calibre/manual/template_lang.rst:284
801 msgid "**Field references**"
802 msgstr ""
803
804 #: ../../__w/calibre/calibre/manual/template_lang.rst:286
805 msgid ""
806 "A ``field_reference`` evaluates to the value of the metadata field named by "
807 "lookup name that follows the ``$`` or ``$$``. Using ``$`` is equivalent to "
808 "using the ``field()`` function. Using ``$$`` is equivalent to using the "
809 "``raw_field`` function. Examples::"
810 msgstr ""
811
812 #: ../../__w/calibre/calibre/manual/template_lang.rst:293
813 msgid "**If expressions**"
814 msgstr ""
815
816 #: ../../__w/calibre/calibre/manual/template_lang.rst:295
817 msgid ""
818 "``If`` expressions first evaluate the ``condition``. If the ``condition`` is"
819 " True (a non-empty value) then the ``expression_list`` in the ``then`` "
820 "clause is evaluated. If it is False then if present the ``expression_list`` "
821 "in the ``elif`` or ``else`` clause is evaluated. The ``elif`` and ``else`` "
822 "parts are optional. The words ``if``, ``then``, ``elif``, ``else``, and "
823 "``fi`` are reserved; you cannot use them as identifier names. You can put "
824 "newlines and white space wherever they make sense. The ``condition`` is a "
825 "``top_expression`` not an ``expression_list``; semicolons are not allowed. "
826 "The ``expression_lists`` are semicolon-separated sequences of "
827 "``top_expressions``. An ``if`` expression returns the result of the last "
828 "``top_expression`` in the evaluated ``expression_list``, or the empty string"
829 " if no expression list was evaluated."
830 msgstr ""
831
832 #: ../../__w/calibre/calibre/manual/template_lang.rst:297
833 msgid "Examples::"
834 msgstr ""
835
836 #: ../../__w/calibre/calibre/manual/template_lang.rst:310
837 msgid "Nested ``if`` example::"
838 msgstr ""
839
840 #: ../../__w/calibre/calibre/manual/template_lang.rst:323
841 msgid ""
842 "As said above, an ``if`` produces a value. This means that all the following"
843 " are equivalent::"
844 msgstr ""
845
846 #: ../../__w/calibre/calibre/manual/template_lang.rst:329
847 msgid ""
848 "As a last example, this program returns the value of the ``series`` column "
849 "if the book has a series, otherwise the value of the ``title`` column::"
850 msgstr ""
851
852 #: ../../__w/calibre/calibre/manual/template_lang.rst:333
853 msgid "**For expressions**"
854 msgstr ""
855
856 #: ../../__w/calibre/calibre/manual/template_lang.rst:335
857 msgid ""
858 "The ``for`` expression iterates over a list of values, processing them one "
859 "at a time. The ``list_expression`` must evaluate either to a metadata field "
860 "``lookup name`` e.g., ``tags`` or ``#genre``, or to a list of values. The "
861 ":ref:`range() function <range_function>` (see below) generates a list of "
862 "numbers. If the result is a valid ``lookup name`` then the field's value is "
863 "fetched and the separator specified for that field type is used. If the "
864 "result isn't a valid lookup name then it is assumed to be a list of values. "
865 "The list is assumed to be separated by commas unless the optional keyword "
866 "``separator`` is supplied, in which case the list values must be separated "
867 "by the result of evaluating the ``separator_expr``. A separator cannot be "
868 "used if the list is generated by ``range()``. Each value in the list is "
869 "assigned to the specified variable then the ``expression_list`` is "
870 "evaluated. You can use ``break`` to jump out of the loop, and ``continue`` "
871 "to jump to the beginning of the loop for the next iteration."
872 msgstr ""
873
874 #: ../../__w/calibre/calibre/manual/template_lang.rst:337
875 msgid ""
876 "Example: This template removes the first hierarchical name for each value in"
877 " Genre (``#genre``), constructing a list with the new names::"
878 msgstr ""
879
880 #: ../../__w/calibre/calibre/manual/template_lang.rst:347
881 msgid ""
882 "If the original Genre is `History.Military, Science Fiction.Alternate "
883 "History, ReadMe` then the template returns `Military, Alternate History, "
884 "ReadMe`. You could use this template in calibre's :guilabel:`Edit metadata "
885 "in bulk -> Search & replace` with :guilabel:`Search for` set to ``template``"
886 " to strip off the first level of the hierarchy and assign the resulting "
887 "value to Genre."
888 msgstr ""
889
890 #: ../../__w/calibre/calibre/manual/template_lang.rst:350
891 msgid ""
892 "Note: the last line in the template, ``new_tags``, isn't strictly necessary "
893 "in this case because ``for`` returns the value of the last top_expression in"
894 " the expression list. The value of an assignment is the value of its "
895 "expression, so the value of the ``for`` statement is what was assigned to "
896 "``new_tags``."
897 msgstr ""
898
899 #: ../../__w/calibre/calibre/manual/template_lang.rst:352
900 msgid "**Function definition**"
901 msgstr ""
902
903 #: ../../__w/calibre/calibre/manual/template_lang.rst:354
904 msgid ""
905 "If you have code in a template that repeats then you can put that code into "
906 "a local function. The ``def`` keyword starts the definition. It is followed "
907 "by the function name, the argument list, then the code in the function. The "
908 "function definition ends with the ``fed`` keyword."
909 msgstr ""
910
911 #: ../../__w/calibre/calibre/manual/template_lang.rst:356
912 msgid ""
913 "Arguments are positional. When a function is called the supplied arguments "
914 "are matched left to right against the defined parameters, with the value of "
915 "the argument assigned to the parameter. It is an error to provide more "
916 "arguments than defined parameters. Parameters can have default values, such "
917 "as ``a = 25``. If an argument is not supplied for that parameter then the "
918 "default value is used, otherwise the parameter is set to the empty string."
919 msgstr ""
920
921 #: ../../__w/calibre/calibre/manual/template_lang.rst:358
922 msgid "The ``return`` statement can be used in a local function."
923 msgstr ""
924
925 #: ../../__w/calibre/calibre/manual/template_lang.rst:360
926 msgid "A function must be defined before it can be used."
927 msgstr ""
928
929 #: ../../__w/calibre/calibre/manual/template_lang.rst:362
930 msgid ""
931 "Example: This template computes an approximate duration in years, months, "
932 "and days from a number of days. The function ``to_plural()`` formats the "
933 "computed values. Note that the example also uses the ``&`` operator::"
934 msgstr ""
935
936 #: ../../__w/calibre/calibre/manual/template_lang.rst:377
937 msgid "**Relational operators**"
938 msgstr ""
939
940 #: ../../__w/calibre/calibre/manual/template_lang.rst:379
941 msgid ""
942 "Relational operators return ``'1'`` if the comparison is true, otherwise the"
943 " empty string ('')."
944 msgstr ""
945
946 #: ../../__w/calibre/calibre/manual/template_lang.rst:381
947 msgid ""
948 "There are two forms of relational operators: string comparisons and numeric "
949 "comparisons."
950 msgstr ""
951
952 #: ../../__w/calibre/calibre/manual/template_lang.rst:383
953 msgid ""
954 "String comparisons do case-insensitive string comparison using lexical "
955 "order. The supported string comparison operators are ``==``, ``!=``, ``<``, "
956 "``<=``, ``>``, ``>=``, ``in``, and ``inlist``. For the ``in`` operator, the "
957 "result of the left hand expression is interpreted as a regular expression "
958 "pattern. The ``in`` operator is True if the value of left-hand regular "
959 "expression matches the value of the right hand expression. The ``inlist`` "
960 "operator is true if the left hand regular expression matches any one of the "
961 "items in the right hand list where the items in the list are separated by "
962 "commas. The matches are case-insensitive."
963 msgstr ""
964
965 #: ../../__w/calibre/calibre/manual/template_lang.rst:386
966 msgid ""
967 "The numeric comparison operators are ``==#``, ``!=#``, ``<#``, ``<=#``, "
968 "``>#``, ``>=#``. The left and right expressions must evaluate to numeric "
969 "values with two exceptions: both the string value \"None\" (undefined field)"
970 " and the empty string evaluate to the value zero."
971 msgstr ""
972
973 #: ../../__w/calibre/calibre/manual/template_lang.rst:390
974 msgid ""
975 "``program: field('series') == 'foo'`` returns ``'1'`` if the book's series "
976 "is 'foo', otherwise ``''``."
977 msgstr ""
978
979 #: ../../__w/calibre/calibre/manual/template_lang.rst:391
980 msgid ""
981 "``program: 'f.o' in field('series')`` returns ``'1'`` if the book's series "
982 "matches the regular expression ``f.o`` (e.g., `foo`, `Off Onyx`, etc.), "
983 "otherwise ``''``."
984 msgstr ""
985
986 #: ../../__w/calibre/calibre/manual/template_lang.rst:392
987 msgid ""
988 "``program: 'science' inlist field('#genre')`` returns ``'1'`` if any of the "
989 "book's genres match the regular expression ``science``, e.g., `Science`, "
990 "`History of Science`, `Science Fiction` etc.), otherwise ``''``."
991 msgstr ""
992
993 #: ../../__w/calibre/calibre/manual/template_lang.rst:393
994 msgid ""
995 "``program: '^science$' inlist field('#genre')`` returns ``'1'`` if any of "
996 "the book's genres exactly match the regular expression ``^science$``, e.g., "
997 "`Science`. The genres `History of Science` and `Science Fiction` don't "
998 "match. If there isn't a match then returns ``''``."
999 msgstr ""
1000
1001 #: ../../__w/calibre/calibre/manual/template_lang.rst:394
1002 msgid ""
1003 "``program: if field('series') != 'foo' then 'bar' else 'mumble' fi`` returns"
1004 " ``'bar'`` if the book's series is not ``foo``. Otherwise it returns "
1005 "``'mumble'``."
1006 msgstr ""
1007
1008 #: ../../__w/calibre/calibre/manual/template_lang.rst:395
1009 msgid ""
1010 "``program: if field('series') == 'foo' || field('series') == '1632' then "
1011 "'yes' else 'no' fi`` returns ``'yes'`` if series is either ``'foo'`` or "
1012 "``'1632'``, otherwise ``'no'``."
1013 msgstr ""
1014
1015 #: ../../__w/calibre/calibre/manual/template_lang.rst:396
1016 msgid ""
1017 "``program: if '^(foo|1632)$' in field('series') then 'yes' else 'no' fi`` "
1018 "returns ``'yes'`` if series is either ``'foo'`` or ``'1632'``, otherwise "
1019 "``'no'``."
1020 msgstr ""
1021
1022 #: ../../__w/calibre/calibre/manual/template_lang.rst:397
1023 msgid ""
1024 "``program: if 11 > 2 then 'yes' else 'no' fi`` returns ``'no'`` because the "
1025 "``>`` operator does a lexical comparison."
1026 msgstr ""
1027
1028 #: ../../__w/calibre/calibre/manual/template_lang.rst:398
1029 msgid ""
1030 "``program: if 11 ># 2 then 'yes' else 'no' fi`` returns ``'yes'`` because "
1031 "the ``>#`` operator does a numeric comparison."
1032 msgstr ""
1033
1034 #: ../../__w/calibre/calibre/manual/template_lang.rst:400
1035 msgid "**Additional available functions**"
1036 msgstr ""
1037
1038 #: ../../__w/calibre/calibre/manual/template_lang.rst:402
1039 msgid ""
1040 "The following functions are available in addition to those described in "
1041 ":ref:`Single Function Mode <single_mode>`."
1042 msgstr ""
1043
1044 #: ../../__w/calibre/calibre/manual/template_lang.rst:404
1045 msgid ""
1046 "In `GPM` the functions described in `Single Function Mode` all require an "
1047 "additional first parameter specifying the value to operate upon. All "
1048 "parameters are expression_lists (see the grammar above)."
1049 msgstr ""
1050
1051 #: ../../__w/calibre/calibre/manual/template_lang.rst:406
1052 msgid ""
1053 "``add(x [, y]*)`` -- returns the sum of its arguments. Throws an exception "
1054 "if an argument is not a number. In most cases you can use the ``+`` operator"
1055 " instead of this function."
1056 msgstr ""
1057
1058 #: ../../__w/calibre/calibre/manual/template_lang.rst:407
1059 msgid ""
1060 "``and(value [, value]*)`` -- returns the string \"1\" if all values are not "
1061 "empty, otherwise returns the empty string. You can have as many values as "
1062 "you want. In most cases you can use the ``&&`` operator instead of this "
1063 "function. One reason not to replace ``and`` with ``&&`` is if short-"
1064 "circuiting can change the results because of side effects. For example, "
1065 "``and(a='',b=5)`` will always do both assignments, where the ``&&`` operator"
1066 " won't do the second."
1067 msgstr ""
1068
1069 #: ../../__w/calibre/calibre/manual/template_lang.rst:408
1070 msgid ""
1071 "``assign(id, val)`` -- assigns ``val`` to ``id``, then returns ``val``. "
1072 "``id`` must be an identifier, not an expression. In most cases you can use "
1073 "the ``=`` operator instead of this function."
1074 msgstr ""
1075
1076 #: ../../__w/calibre/calibre/manual/template_lang.rst:409
1077 msgid ""
1078 "``approximate_formats()`` -- return a comma-separated list of formats "
1079 "associated with the book. There is no guarantee that the list is correct, "
1080 "although it probably is. This and other zero-parameter functions can be "
1081 "called in Template Program Mode (see below) using the template "
1082 "``{:'approximate_formats()'}``. Note that resulting format names are always "
1083 "uppercase, as in EPUB. The ``approximate_formats()`` function is "
1084 "significantly faster than the ``formats_...`` functions discussed below."
1085 msgstr ""
1086
1087 #: ../../__w/calibre/calibre/manual/template_lang.rst:410
1088 msgid ""
1089 "``author_links(val_separator, pair_separator)`` -- returns a string "
1090 "containing a list of authors and those authors' link values in the form::"
1091 msgstr ""
1092
1093 #: ../../__w/calibre/calibre/manual/template_lang.rst:414
1094 msgid ""
1095 "An author is separated from its link value by the ``val_separator`` string "
1096 "with no added spaces. ``author:linkvalue`` pairs are separated by the "
1097 "``pair_separator`` string argument with no added spaces. It is up to you to "
1098 "choose separator strings that do not occur in author names or links. An "
1099 "author is included even if the author link is empty."
1100 msgstr ""
1101
1102 #: ../../__w/calibre/calibre/manual/template_lang.rst:415
1103 msgid ""
1104 "``author_sorts(val_separator)`` -- returns a string containing a list of "
1105 "author's sort values for the authors of the book. The sort is the one in the"
1106 " author metadata information (different from the author_sort in books). The "
1107 "returned list has the form ``author sort 1`` ``val_separator`` ``author sort"
1108 " 2`` etc. with no added spaces. The author sort values in this list are in "
1109 "the same order as the authors of the book. If you want spaces around "
1110 "``val_separator`` then include them in the ``val_separator`` string."
1111 msgstr ""
1112
1113 #: ../../__w/calibre/calibre/manual/template_lang.rst:416
1114 msgid ""
1115 "``booksize()`` -- returns the value of the calibre 'size' field. Returns '' "
1116 "if there are no formats."
1117 msgstr ""
1118
1119 #: ../../__w/calibre/calibre/manual/template_lang.rst:417
1120 msgid ""
1121 "``check_yes_no(field_name, is_undefined, is_false, is_true)`` -- checks if "
1122 "the value of the yes/no field named by the lookup name ``field_name`` is one"
1123 " of the values specified by the parameters, returning ``'yes'`` if a match "
1124 "is found otherwise returning the empty string. Set the parameter "
1125 "``is_undefined``, ``is_false``, or ``is_true`` to 1 (the number) to check "
1126 "that condition, otherwise set it to 0. Example:"
1127 msgstr ""
1128
1129 #: ../../__w/calibre/calibre/manual/template_lang.rst:419
1130 msgid ""
1131 "``check_yes_no(\"#bool\", 1, 0, 1)`` returns ``'yes'`` if the yes/no field "
1132 "``#bool`` is either True or undefined (neither True nor False)."
1133 msgstr ""
1134
1135 #: ../../__w/calibre/calibre/manual/template_lang.rst:421
1136 msgid ""
1137 "More than one of ``is_undefined``, ``is_false``, or ``is_true`` can be set "
1138 "to 1."
1139 msgstr ""
1140
1141 #: ../../__w/calibre/calibre/manual/template_lang.rst:422
1142 msgid ""
1143 "``ceiling(x)`` -- returns the smallest integer greater than or equal to "
1144 "``x``. Throws an exception if ``x`` is not a number."
1145 msgstr ""
1146
1147 #: ../../__w/calibre/calibre/manual/template_lang.rst:423
1148 msgid ""
1149 "``character(character_name)`` -- returns the character named by "
1150 "character_name. For example, ``character('newline')`` returns a newline "
1151 "character (``'\\n'``). The supported character names are ``newline``, "
1152 "``return``, ``tab``, and ``backslash``."
1153 msgstr ""
1154
1155 #: ../../__w/calibre/calibre/manual/template_lang.rst:424
1156 msgid ""
1157 "``cmp(x, y, lt, eq, gt)`` -- compares ``x`` and ``y`` after converting both "
1158 "to numbers. Returns ``lt`` if ``x <# y``, ``eq`` if ``x ==# y``, otherwise "
1159 "``gt``. This function can usually be replaced with one of the numeric "
1160 "compare operators (``==#``, ``<#``, ``>#``, etc)."
1161 msgstr ""
1162
1163 #: ../../__w/calibre/calibre/manual/template_lang.rst:425
1164 msgid ""
1165 "``connected_device_name(storage_location_key)`` -- if a device is connected "
1166 "then return the device name, otherwise return the empty string. Each storage"
1167 " location on a device has its own device name. The ``storage_location_key`` "
1168 "names are ``'main'``, ``'carda'`` and ``'cardb'``. This function works only "
1169 "in the GUI."
1170 msgstr ""
1171
1172 #: ../../__w/calibre/calibre/manual/template_lang.rst:426
1173 msgid ""
1174 "``connected_device_uuid(storage_location_key)`` -- if a device is connected "
1175 "then return the device uuid (unique id), otherwise return the empty string. "
1176 "Each storage location on a device has a different uuid. The "
1177 "``storage_location_key`` location names are ``'main'``, ``'carda'`` and "
1178 "``'cardb'``. This function works only in the GUI."
1179 msgstr ""
1180
1181 #: ../../__w/calibre/calibre/manual/template_lang.rst:427
1182 msgid ""
1183 "``current_library_name()`` -- return the last name on the path to the "
1184 "current calibre library."
1185 msgstr ""
1186
1187 #: ../../__w/calibre/calibre/manual/template_lang.rst:428
1188 msgid ""
1189 "``current_library_path()`` -- return the full path to the current calibre "
1190 "library."
1191 msgstr ""
1192
1193 #: ../../__w/calibre/calibre/manual/template_lang.rst:429
1194 msgid ""
1195 "``current_virtual_library_name()`` -- return the name of the current virtual"
1196 " library if there is one, otherwise the empty string. Library name case is "
1197 "preserved. Example: ``program: current_virtual_library_name()``. This "
1198 "function works only in the GUI."
1199 msgstr ""
1200
1201 #: ../../__w/calibre/calibre/manual/template_lang.rst:430
1202 msgid ""
1203 "``date_arithmetic(date, calc_spec, fmt)`` -- Calculate a new date from "
1204 "``date`` using ``calc_spec``. Return the new date formatted according to "
1205 "optional ``fmt``: if not supplied then the result will be in ISO format. The"
1206 " calc_spec is a string formed by concatenating pairs of ``vW`` "
1207 "(``valueWhat``) where ``v`` is a possibly-negative number and W is one of "
1208 "the following letters:"
1209 msgstr ""
1210
1211 #: ../../__w/calibre/calibre/manual/template_lang.rst:432
1212 msgid "``s``: add ``v`` seconds to ``date``"
1213 msgstr ""
1214
1215 #: ../../__w/calibre/calibre/manual/template_lang.rst:433
1216 msgid "``m``: add ``v`` minutes to ``date``"
1217 msgstr ""
1218
1219 #: ../../__w/calibre/calibre/manual/template_lang.rst:434
1220 msgid "``h``: add ``v`` hours to ``date``"
1221 msgstr ""
1222
1223 #: ../../__w/calibre/calibre/manual/template_lang.rst:435
1224 msgid "``d``: add ``v`` days to ``date``"
1225 msgstr ""
1226
1227 #: ../../__w/calibre/calibre/manual/template_lang.rst:436
1228 msgid "``w``: add ``v`` weeks to ``date``"
1229 msgstr ""
1230
1231 #: ../../__w/calibre/calibre/manual/template_lang.rst:437
1232 msgid "``y``: add ``v`` years to ``date``, where a year is 365 days."
1233 msgstr ""
1234
1235 #: ../../__w/calibre/calibre/manual/template_lang.rst:439
1236 msgid ""
1237 "Example: ``'1s3d-1m'`` will add 1 second, add 3 days, and subtract 1 minute "
1238 "from ``date``."
1239 msgstr ""
1240
1241 #: ../../__w/calibre/calibre/manual/template_lang.rst:440
1242 msgid ""
1243 "``days_between(date1, date2)`` -- return the number of days between "
1244 "``date1`` and ``date2``. The number is positive if ``date1`` is greater than"
1245 " ``date2``, otherwise negative. If either ``date1`` or ``date2`` are not "
1246 "dates, the function returns the empty string."
1247 msgstr ""
1248
1249 #: ../../__w/calibre/calibre/manual/template_lang.rst:441
1250 msgid ""
1251 "``divide(x, y)`` -- returns ``x / y``. Throws an exception if either ``x`` "
1252 "or ``y`` are not numbers. This function can usually be replaced by the ``/``"
1253 " operator."
1254 msgstr ""
1255
1256 #: ../../__w/calibre/calibre/manual/template_lang.rst:442
1257 msgid ""
1258 "``eval(string)`` -- evaluates the string as a program, passing the local "
1259 "variables. This permits using the template processor to construct complex "
1260 "results from local variables. In :ref:`Template Program Mode "
1261 "<template_mode>`, because the `{` and `}` characters are interpreted before "
1262 "the template is evaluated you must use `[[` for the `{` character and `]]` "
1263 "for the ``}`` character. They are converted automatically. Note also that "
1264 "prefixes and suffixes (the `|prefix|suffix` syntax) cannot be used in the "
1265 "argument to this function when using :ref:`Template Program Mode "
1266 "<template_mode>`."
1267 msgstr ""
1268
1269 #: ../../__w/calibre/calibre/manual/template_lang.rst:443
1270 msgid ""
1271 "``field(lookup_name)`` -- returns the value of the metadata field with "
1272 "lookup name ``lookup_name``."
1273 msgstr ""
1274
1275 #: ../../__w/calibre/calibre/manual/template_lang.rst:444
1276 msgid ""
1277 "``field_exists(field_name)`` -- checks if a field (column) with the lookup "
1278 "name ``field_name`` exists, returning ``'1'`` if so and the empty string if "
1279 "not."
1280 msgstr ""
1281
1282 #: ../../__w/calibre/calibre/manual/template_lang.rst:445
1283 msgid ""
1284 "``finish_formatting(val, fmt, prefix, suffix)`` -- apply the format, prefix,"
1285 " and suffix to a value in the same way as done in a template like "
1286 "``{series_index:05.2f| - |- }``. This function is provided to ease "
1287 "conversion of complex single-function- or template-program-mode templates to"
1288 " `GPM` Templates. For example, the following program produces the same "
1289 "output as the above template::"
1290 msgstr ""
1291
1292 #: ../../__w/calibre/calibre/manual/template_lang.rst:449
1293 msgid ""
1294 "Another example: for the template "
1295 "``{series:re(([^\\s])[^\\s]+(\\s|$),\\1)}{series_index:0>2s| - | - "
1296 "}{title}`` use::"
1297 msgstr ""
1298
1299 #: ../../__w/calibre/calibre/manual/template_lang.rst:458
1300 msgid ""
1301 "``first_matching_cmp(val, [ cmp, result, ]* else_result)`` -- compares ``val"
1302 " < cmp`` in sequence, returning the associated result for the first "
1303 "comparison that succeeds. Returns else_result if no comparison succeeds. "
1304 "Example::"
1305 msgstr ""
1306
1307 #: ../../__w/calibre/calibre/manual/template_lang.rst:463
1308 msgid ""
1309 "returns ``\"large\"``. The same example with a first value of 16 returns "
1310 "``\"giant\"``."
1311 msgstr ""
1312
1313 #: ../../__w/calibre/calibre/manual/template_lang.rst:465
1314 msgid ""
1315 "``first_non_empty(value [, value]*)`` -- returns the first ``value`` that is"
1316 " not empty. If all values are empty, then the empty string is returned. You "
1317 "can have as many values as you want."
1318 msgstr ""
1319
1320 #: ../../__w/calibre/calibre/manual/template_lang.rst:466
1321 msgid ""
1322 "``floor(x)`` -- returns the largest integer less than or equal to ``x``. "
1323 "Throws an exception if ``x`` is not a number."
1324 msgstr ""
1325
1326 #: ../../__w/calibre/calibre/manual/template_lang.rst:467
1327 msgid ""
1328 "``format_date(val, format_string)`` -- format the value, which must be a "
1329 "date string, using the format_string, returning a string. The formatting "
1330 "codes are:"
1331 msgstr ""
1332
1333 #: ../../__w/calibre/calibre/manual/template_lang.rst:469
1334 msgid "``d :`` the day as number without a leading zero (1 to 31)"
1335 msgstr ""
1336
1337 #: ../../__w/calibre/calibre/manual/template_lang.rst:470
1338 msgid "``dd :`` the day as number with a leading zero (01 to 31)"
1339 msgstr ""
1340
1341 #: ../../__w/calibre/calibre/manual/template_lang.rst:471
1342 msgid "``ddd :`` the abbreviated localized day name (e.g. \"Mon\" to \"Sun\")."
1343 msgstr ""
1344
1345 #: ../../__w/calibre/calibre/manual/template_lang.rst:472
1346 msgid "``dddd :`` the long localized day name (e.g. \"Monday\" to \"Sunday\")."
1347 msgstr ""
1348
1349 #: ../../__w/calibre/calibre/manual/template_lang.rst:473
1350 msgid "``M :`` the month as number without a leading zero (1 to 12)."
1351 msgstr ""
1352
1353 #: ../../__w/calibre/calibre/manual/template_lang.rst:474
1354 msgid "``MM :`` the month as number with a leading zero (01 to 12)"
1355 msgstr ""
1356
1357 #: ../../__w/calibre/calibre/manual/template_lang.rst:475
1358 msgid "``MMM :`` the abbreviated localized month name (e.g. \"Jan\" to \"Dec\")."
1359 msgstr ""
1360
1361 #: ../../__w/calibre/calibre/manual/template_lang.rst:476
1362 msgid "``MMMM :`` the long localized month name (e.g. \"January\" to \"December\")."
1363 msgstr ""
1364
1365 #: ../../__w/calibre/calibre/manual/template_lang.rst:477
1366 msgid "``yy :`` the year as two digit number (00 to 99)."
1367 msgstr ""
1368
1369 #: ../../__w/calibre/calibre/manual/template_lang.rst:478
1370 msgid "``yyyy :`` the year as four digit number."
1371 msgstr ""
1372
1373 #: ../../__w/calibre/calibre/manual/template_lang.rst:479
1374 msgid ""
1375 "``h :`` the hours without a leading 0 (0 to 11 or 0 to 23, depending on "
1376 "am/pm)"
1377 msgstr ""
1378
1379 #: ../../__w/calibre/calibre/manual/template_lang.rst:480
1380 msgid ""
1381 "``hh :`` the hours with a leading 0 (00 to 11 or 00 to 23, depending on "
1382 "am/pm)"
1383 msgstr ""
1384
1385 #: ../../__w/calibre/calibre/manual/template_lang.rst:481
1386 msgid "``m :`` the minutes without a leading 0 (0 to 59)"
1387 msgstr ""
1388
1389 #: ../../__w/calibre/calibre/manual/template_lang.rst:482
1390 msgid "``mm :`` the minutes with a leading 0 (00 to 59)"
1391 msgstr ""
1392
1393 #: ../../__w/calibre/calibre/manual/template_lang.rst:483
1394 msgid "``s :`` the seconds without a leading 0 (0 to 59)"
1395 msgstr ""
1396
1397 #: ../../__w/calibre/calibre/manual/template_lang.rst:484
1398 msgid "``ss :`` the seconds with a leading 0 (00 to 59)"
1399 msgstr ""
1400
1401 #: ../../__w/calibre/calibre/manual/template_lang.rst:485
1402 msgid ""
1403 "``ap :`` use a 12-hour clock instead of a 24-hour clock, with 'ap' "
1404 "replaced by the localized string for am or pm."
1405 msgstr ""
1406
1407 #: ../../__w/calibre/calibre/manual/template_lang.rst:486
1408 msgid ""
1409 "``AP :`` use a 12-hour clock instead of a 24-hour clock, with 'AP' "
1410 "replaced by the localized string for AM or PM."
1411 msgstr ""
1412
1413 #: ../../__w/calibre/calibre/manual/template_lang.rst:487
1414 msgid ""
1415 "``iso :`` the date with time and timezone. Must be the only format present."
1416 msgstr ""
1417
1418 #: ../../__w/calibre/calibre/manual/template_lang.rst:488
1419 msgid ""
1420 "``to_number :`` convert the date & time into a floating point number (a "
1421 "`timestamp`)"
1422 msgstr ""
1423
1424 #: ../../__w/calibre/calibre/manual/template_lang.rst:489
1425 msgid ""
1426 "``from_number :`` convert a floating point number (a `timestamp`) into an "
1427 "``iso`` formatted date. If you want a different date format then add the "
1428 "desired formatting string after ``from_number`` and a colon (``:``). "
1429 "Example: ``from_number:MMM dd yyyy``"
1430 msgstr ""
1431
1432 #: ../../__w/calibre/calibre/manual/template_lang.rst:491
1433 msgid ""
1434 "You might get unexpected results if the date you are formatting contains "
1435 "localized month names, which can happen if you changed the date format "
1436 "tweaks to contain ``MMMM``. In this case, instead of using the ``field()`` "
1437 "function as in::"
1438 msgstr ""
1439
1440 #: ../../__w/calibre/calibre/manual/template_lang.rst:495
1441 msgid "use the ``raw_field()`` function as in::"
1442 msgstr ""
1443
1444 #: ../../__w/calibre/calibre/manual/template_lang.rst:499
1445 msgid ""
1446 "``formats_modtimes(date_format_string)`` -- return a comma-separated list of"
1447 " colon-separated items ``FMT:DATE`` representing modification times for the "
1448 "formats of a book. The ``date_format_string`` parameter specifies how the "
1449 "date is to be formatted. See the ``format_date()`` function for details. You"
1450 " can use the ``select`` function to get the modification time for a specific"
1451 " format. Note that format names are always uppercase, as in EPUB."
1452 msgstr ""
1453
1454 #: ../../__w/calibre/calibre/manual/template_lang.rst:500
1455 msgid ""
1456 "``formats_paths()`` -- return a comma-separated list of colon-separated "
1457 "items ``FMT:PATH`` giving the full path to the formats of a book. You can "
1458 "use the select function to get the path for a specific format. Note that "
1459 "format names are always uppercase, as in EPUB."
1460 msgstr ""
1461
1462 #: ../../__w/calibre/calibre/manual/template_lang.rst:501
1463 msgid ""
1464 "``formats_sizes()`` -- return a comma-separated list of colon-separated "
1465 "``FMT:SIZE`` items giving the sizes in bytes of the formats of a book. You "
1466 "can use the select function to get the size for a specific format. Note that"
1467 " format names are always uppercase, as in EPUB."
1468 msgstr ""
1469
1470 #: ../../__w/calibre/calibre/manual/template_lang.rst:502
1471 msgid ""
1472 "``fractional_part(x)`` -- returns the value after the decimal point. For "
1473 "example, ``fractional_part(3.14)`` returns ``0.14``. Throws an exception if "
1474 "``x`` is not a number."
1475 msgstr ""
1476
1477 #: ../../__w/calibre/calibre/manual/template_lang.rst:503
1478 msgid ""
1479 "``has_cover()`` -- return ``'Yes'`` if the book has a cover, otherwise the "
1480 "empty string."
1481 msgstr ""
1482
1483 #: ../../__w/calibre/calibre/manual/template_lang.rst:504
1484 msgid ""
1485 "``is_marked()`` -- check whether the book is `marked` in calibre. If it is "
1486 "then return the value of the mark, either ``'true'`` (lower case) or a "
1487 "comma-separated list of named marks. Returns ``''`` (the empty string) if "
1488 "the book is not marked. This function works only in the GUI."
1489 msgstr ""
1490
1491 #: ../../__w/calibre/calibre/manual/template_lang.rst:505
1492 msgid ""
1493 "``language_codes(lang_strings)`` -- return the `language codes "
1494 "<https://www.loc.gov/standards/iso639-2/php/code_list.php>`_ for the "
1495 "language names passed in `lang_strings`. The strings must be in the language"
1496 " of the current locale. ``Lang_strings`` is a comma-separated list."
1497 msgstr ""
1498
1499 #: ../../__w/calibre/calibre/manual/template_lang.rst:506
1500 msgid ""
1501 "``list_contains(value, separator, [ pattern, found_val, ]* not_found_val)`` "
1502 "-- (Alias of ``in_list``) Interpreting the value as a list of items "
1503 "separated by ``separator``, evaluate the ``pattern`` against each value in "
1504 "the list. If the ``pattern`` matches any value then return ``found_val``, "
1505 "otherwise return ``not_found_val``. The ``pattern`` and ``found_value`` can "
1506 "be repeated as many times as desired, permitting returning different values "
1507 "depending on the search. The patterns are checked in order. The first match "
1508 "is returned. Aliases: ``in_list()``, ``list_contains()``"
1509 msgstr ""
1510
1511 #: ../../__w/calibre/calibre/manual/template_lang.rst:507
1512 msgid ""
1513 "``list_count(value, separator)`` -- interprets ``value`` as a list of items "
1514 "separated by ``separator``, returning the count of items in the list. "
1515 "Aliases: ``count()``, ``list_count()``"
1516 msgstr ""
1517
1518 #: ../../__w/calibre/calibre/manual/template_lang.rst:508
1519 msgid ""
1520 "``list_count_matching(list, pattern, separator)`` -- interprets ``list`` as "
1521 "a list of items separated by ``separator``, returning the number of items in"
1522 " the list that match the regular expression ``pattern``. Aliases: "
1523 "``list_count_matching()``, ``count_matching()``"
1524 msgstr ""
1525
1526 #: ../../__w/calibre/calibre/manual/template_lang.rst:509
1527 msgid ""
1528 "``list_difference(list1, list2, separator)`` -- return a list made by "
1529 "removing from ``list1`` any item found in ``list2`` using a case-insensitive"
1530 " comparison. The items in ``list1`` and ``list2`` are separated by "
1531 "separator, as are the items in the returned list."
1532 msgstr ""
1533
1534 #: ../../__w/calibre/calibre/manual/template_lang.rst:510
1535 msgid ""
1536 "``list_equals(list1, sep1, list2, sep2, yes_val, no_val)`` -- return "
1537 "``yes_val`` if ``list1`` and `list2` contain the same items, otherwise "
1538 "return ``no_val``. The items are determined by splitting each list using the"
1539 " appropriate separator character (``sep1`` or ``sep2``). The order of items "
1540 "in the lists is not relevant. The comparison is case-insensitive."
1541 msgstr ""
1542
1543 #: ../../__w/calibre/calibre/manual/template_lang.rst:511
1544 msgid ""
1545 "``list_intersection(list1, list2, separator)`` -- return a list made by "
1546 "removing from ``list1`` any item not found in ``list2``, using a case-"
1547 "insensitive comparison. The items in ``list1`` and ``list2`` are separated "
1548 "by separator, as are the items in the returned list."
1549 msgstr ""
1550
1551 #: ../../__w/calibre/calibre/manual/template_lang.rst:512
1552 msgid ""
1553 "``list_join(with_separator, list1, separator1 [, list2, separator2]*)`` -- "
1554 "return a list made by joining the items in the source lists (``list1`` etc) "
1555 "using ``with_separator`` between the items in the result list. Items in each"
1556 " source ``list[123...]`` are separated by the associated "
1557 "``separator[123...]``. A list can contain zero values. It can be a field "
1558 "like ``publisher`` that is single-valued, effectively a one-item list. "
1559 "Duplicates are removed using a case-insensitive comparison. Items are "
1560 "returned in the order they appear in the source lists. If items on lists "
1561 "differ only in letter case then the last is used. All separators can be more"
1562 " than one character."
1563 msgstr ""
1564
1565 #: ../../__w/calibre/calibre/manual/template_lang.rst:514
1566 #: ../../__w/calibre/calibre/manual/template_lang.rst:536
1567 msgid "Example::"
1568 msgstr ""
1569
1570 #: ../../__w/calibre/calibre/manual/template_lang.rst:519
1571 msgid ""
1572 "You can use ``list_join`` on the results of previous calls to ``list_join`` "
1573 "as follows::"
1574 msgstr ""
1575
1576 #: ../../__w/calibre/calibre/manual/template_lang.rst:525
1577 msgid ""
1578 "You can use expressions to generate a list. For example, assume you want "
1579 "items for ``authors`` and ``#genre``, but with the genre changed to the word"
1580 " \"Genre: \" followed by the first letter of the genre, i.e. the genre "
1581 "\"Fiction\" becomes \"Genre: F\". The following will do that::"
1582 msgstr ""
1583
1584 #: ../../__w/calibre/calibre/manual/template_lang.rst:530
1585 msgid ""
1586 "``list_re(src_list, separator, include_re, opt_replace)`` -- Construct a "
1587 "list by first separating ``src_list`` into items using the ``separator`` "
1588 "character. For each item in the list, check if it matches ``include_re``. If"
1589 " it does then add it to the list to be returned. If ``opt_replace`` is not "
1590 "the empty string then apply the replacement before adding the item to the "
1591 "returned list."
1592 msgstr ""
1593
1594 #: ../../__w/calibre/calibre/manual/template_lang.rst:531
1595 msgid ""
1596 "``list_re_group(src_list, separator, include_re, search_re [, "
1597 "template_for_group]*)`` -- Like list_re except replacements are not "
1598 "optional. It uses ``re_group(item, search_re, template ...)`` when doing the"
1599 " replacements."
1600 msgstr ""
1601
1602 #: ../../__w/calibre/calibre/manual/template_lang.rst:532
1603 msgid ""
1604 "``list_remove_duplicates(list, separator)`` -- return a list made by "
1605 "removing duplicate items in ``list``. If items differ only in case then the "
1606 "last is returned. The items in ``list`` are separated by ``separator``, as "
1607 "are the items in the returned list."
1608 msgstr ""
1609
1610 #: ../../__w/calibre/calibre/manual/template_lang.rst:533
1611 msgid ""
1612 "``list_sort(list, direction, separator)`` -- return ``list`` sorted using a "
1613 "case-insensitive lexical sort. If ``direction`` is zero, ``list`` is sorted "
1614 "ascending, otherwise descending. The list items are separated by "
1615 "``separator``, as are the items in the returned list."
1616 msgstr ""
1617
1618 #: ../../__w/calibre/calibre/manual/template_lang.rst:534
1619 msgid ""
1620 "``list_split(list_val, sep, id_prefix)`` -- splits ``list_val`` into "
1621 "separate values using ``sep``, then assigns the values to local variables "
1622 "named ``id_prefix_N`` where N is the position of the value in the list. The "
1623 "first item has position 0 (zero). The function returns the last element in "
1624 "the list."
1625 msgstr ""
1626
1627 #: ../../__w/calibre/calibre/manual/template_lang.rst:540
1628 msgid "is equivalent to::"
1629 msgstr ""
1630
1631 #: ../../__w/calibre/calibre/manual/template_lang.rst:546
1632 msgid ""
1633 "``list_union(list1, list2, separator)`` -- return a list made by merging the"
1634 " items in ``list1`` and ``list2``, removing duplicate items using a case-"
1635 "insensitive comparison. If items differ in case, the one in ``list1`` is "
1636 "used. The items in ``list1`` and ``list2`` are separated by ``separator``, "
1637 "as are the items in the returned list. Aliases: ``merge_lists()``, "
1638 "``list_union()``"
1639 msgstr ""
1640
1641 #: ../../__w/calibre/calibre/manual/template_lang.rst:547
1642 msgid ""
1643 "``mod(x, y)`` -- returns the ``floor`` of the remainder of ``x / y``. Throws"
1644 " an exception if either ``x`` or ``y`` is not a number."
1645 msgstr ""
1646
1647 #: ../../__w/calibre/calibre/manual/template_lang.rst:548
1648 msgid ""
1649 "``multiply(x [, y]*)`` -- returns the product of its arguments. Throws an "
1650 "exception if any argument is not a number. This function can usually be "
1651 "replaced by the ``*`` operator."
1652 msgstr ""
1653
1654 #: ../../__w/calibre/calibre/manual/template_lang.rst:549
1655 msgid ""
1656 "``not(value)`` -- returns the string \"1\" if the value is empty, otherwise "
1657 "returns the empty string. This function can usually be replaced with the "
1658 "unary not (``!``) operator."
1659 msgstr ""
1660
1661 #: ../../__w/calibre/calibre/manual/template_lang.rst:550
1662 msgid ""
1663 "``ondevice()`` -- return the string ``'Yes'`` if ``ondevice`` is set, "
1664 "otherwise return the empty string."
1665 msgstr ""
1666
1667 #: ../../__w/calibre/calibre/manual/template_lang.rst:551
1668 msgid ""
1669 "``or(value [, value]*)`` -- returns the string ``'1'`` if any value is not "
1670 "empty, otherwise returns the empty string. You can have as many values as "
1671 "you want. This function can usually be replaced by the ``||`` operator. A "
1672 "reason it cannot be replaced is if short-circuiting will change the results "
1673 "because of side effects."
1674 msgstr ""
1675
1676 #: ../../__w/calibre/calibre/manual/template_lang.rst:552
1677 msgid ""
1678 "``print(a [, b]*)`` -- prints the arguments to standard output. Unless you "
1679 "start calibre from the command line (``calibre-debug -g``), the output will "
1680 "go into a black hole. The ``print`` function always returns its first "
1681 "argument."
1682 msgstr ""
1683
1684 #: ../../__w/calibre/calibre/manual/template_lang.rst:556
1685 msgid ""
1686 "``range(start, stop, step, limit)`` -- returns a list of numbers generated "
1687 "by looping over the range specified by the parameters start, stop, and step,"
1688 " with a maximum length of limit. The first value produced is 'start'. "
1689 "Subsequent values ``next_v = current_v + step``. The loop continues while "
1690 "``next_v < stop`` assuming ``step`` is positive, otherwise while ``next_v > "
1691 "stop``. An empty list is produced if ``start`` fails the test: ``start >= "
1692 "stop`` if ``step`` is positive. The ``limit`` sets the maximum length of the"
1693 " list and has a default of 1000. The parameters ``start``, ``step``, and "
1694 "``limit`` are optional. Calling ``range()`` with one argument specifies "
1695 "``stop``. Two arguments specify ``start`` and ``stop``. Three arguments "
1696 "specify ``start``, ``stop``, and ``step``. Four arguments specify ``start``,"
1697 " ``stop``, ``step`` and ``limit``. Examples::"
1698 msgstr ""
1699
1700 #: ../../__w/calibre/calibre/manual/template_lang.rst:566
1701 msgid ""
1702 "``raw_field(lookup_name [, optional_default])`` -- returns the metadata "
1703 "field named by ``lookup_name`` without applying any formatting. It evaluates"
1704 " and returns the optional second argument ``optional_default`` if the "
1705 "field's value is undefined (``None``)."
1706 msgstr ""
1707
1708 #: ../../__w/calibre/calibre/manual/template_lang.rst:567
1709 msgid ""
1710 "``raw_list(lookup_name, separator)`` -- returns the metadata list named by "
1711 "``lookup_name`` without applying any formatting or sorting, with the items "
1712 "separated by separator."
1713 msgstr ""
1714
1715 #: ../../__w/calibre/calibre/manual/template_lang.rst:568
1716 msgid ""
1717 "``re_group(value, pattern [, template_for_group]*)`` -- return a string "
1718 "made by applying the regular expression pattern to ``value`` and replacing "
1719 "each matched instance with the the value returned by the corresponding "
1720 "template. In :ref:`Template Program Mode <template_mode>`, like for the "
1721 "``template`` and the ``eval`` functions, you use ``[[`` for ``{`` and ``]]``"
1722 " for ``}``."
1723 msgstr ""
1724
1725 #: ../../__w/calibre/calibre/manual/template_lang.rst:570
1726 msgid ""
1727 "The following example looks for a series with more than one word and "
1728 "uppercases the first word::"
1729 msgstr ""
1730
1731 #: ../../__w/calibre/calibre/manual/template_lang.rst:574
1732 msgid ""
1733 "``round(x)`` -- returns the nearest integer to ``x``. Throws an exception if"
1734 " ``x`` is not a number."
1735 msgstr ""
1736
1737 #: ../../__w/calibre/calibre/manual/template_lang.rst:575
1738 msgid "``series_sort()`` -- returns the series sort value."
1739 msgstr ""
1740
1741 #: ../../__w/calibre/calibre/manual/template_lang.rst:576
1742 msgid ""
1743 "``strcat(a [, b]*)`` -- can take any number of arguments. Returns a string "
1744 "formed by concatenating all the arguments."
1745 msgstr ""
1746
1747 #: ../../__w/calibre/calibre/manual/template_lang.rst:577
1748 msgid ""
1749 "``strcat_max(max, string1 [, prefix2, string2]*)`` -- Returns a string "
1750 "formed by concatenating the arguments. The returned value is initialized to "
1751 "``string1``. Strings made from ``prefix, string`` pairs are added to the end"
1752 " of the value as long as the resulting string length is less than ``max``. "
1753 "Prefixes can be empty. Returns ``string1`` even if ``string1`` is longer "
1754 "than ``max``. You can pass as many ``prefix, string`` pairs as you wish."
1755 msgstr ""
1756
1757 #: ../../__w/calibre/calibre/manual/template_lang.rst:578
1758 msgid ""
1759 "``strcmp(x, y, lt, eq, gt)`` -- does a case-insensitive lexical comparison "
1760 "of ``x`` and ``y``. Returns ``lt`` if ``x < y``, ``eq`` if ``x == y``, "
1761 "otherwise ``gt``. This function can often be replaced by one of the lexical "
1762 "comparison operators (``==``, ``>``, ``<``, etc.)"
1763 msgstr ""
1764
1765 #: ../../__w/calibre/calibre/manual/template_lang.rst:579
1766 msgid "``strlen(value)`` -- Returns the length of the string ``value``."
1767 msgstr ""
1768
1769 #: ../../__w/calibre/calibre/manual/template_lang.rst:580
1770 msgid ""
1771 "``substr(str, start, end)`` -- returns the ``start``'th through the "
1772 "``end``'th characters of ``str``. The first character in ``str`` is the "
1773 "zero'th character. If ``end`` is negative, then it indicates that many "
1774 "characters counting from the right. If ``end`` is zero, then it indicates "
1775 "the last character. For example, ``substr('12345', 1, 0)`` returns "
1776 "``'2345'``, and ``substr('12345', 1, -1)`` returns ``'234'``."
1777 msgstr ""
1778
1779 #: ../../__w/calibre/calibre/manual/template_lang.rst:581
1780 msgid ""
1781 "``subtract(x, y)`` -- returns ``x - y``. Throws an exception if either ``x``"
1782 " or ``y`` are not numbers. This function can usually be replaced by the "
1783 "``-`` operator."
1784 msgstr ""
1785
1786 #: ../../__w/calibre/calibre/manual/template_lang.rst:582
1787 msgid ""
1788 "``today()`` -- return a date+time string for today (now). This value is "
1789 "designed for use in `format_date` or `days_between`, but can be manipulated "
1790 "like any other string. The date is in `ISO "
1791 "<https://en.wikipedia.org/wiki/ISO_8601>`_ date/time format."
1792 msgstr ""
1793
1794 #: ../../__w/calibre/calibre/manual/template_lang.rst:583
1795 msgid ""
1796 "``template(x)`` -- evaluates ``x`` as a template. The evaluation is done in "
1797 "its own context, meaning that variables are not shared between the caller "
1798 "and the template evaluation."
1799 msgstr ""
1800
1801 #: ../../__w/calibre/calibre/manual/template_lang.rst:584
1802 msgid ""
1803 "``urls_from_identifiers(identifiers, sort_results)`` -- given a comma-"
1804 "separated list of ``identifiers``, where an `identifier` is a colon-"
1805 "separated pair of values (``id_name:id_value``), returns a comma-separated "
1806 "list of HTML URLs generated from the identifiers. The list not sorted if "
1807 "sort_results is ``0`` (character or number), otherwise it is sorted "
1808 "alphabetically by the identifier name. The URLs are generated in the same "
1809 "way as the built-in identifiers column when shown in :guilabel:`Book "
1810 "details`."
1811 msgstr ""
1812
1813 #: ../../__w/calibre/calibre/manual/template_lang.rst:589
1814 msgid "More complex programs in template expressions - Template Program Mode"
1815 msgstr ""
1816
1817 #: ../../__w/calibre/calibre/manual/template_lang.rst:591
1818 msgid ""
1819 "`Template Program Mode` (`TPM`) is a blend of :ref:`General Program Mode "
1820 "<general_mode>` and :ref:`Single Function Mode <single_mode>`. `TPM` differs"
1821 " from Single Function Mode in that it permits writing template expressions "
1822 "that refer to other metadata fields, use nested functions, modify variables,"
1823 " and do arithmetic. It differs from `General Program Mode` in that the "
1824 "template is contained between ``{`` and ``}`` characters and doesn't begin "
1825 "with the word ``program:``. The program portion of the template is a General"
1826 " Program Mode expression list."
1827 msgstr ""
1828
1829 #: ../../__w/calibre/calibre/manual/template_lang.rst:594
1830 msgid ""
1831 "Example: assume you want a template to show the series for a book if it has "
1832 "one, otherwise show the value of a custom field #genre. You cannot do this "
1833 "in the :ref:`Single Function Mode <single_mode>` because you cannot make "
1834 "reference to another metadata field within a template expression. In `TPM` "
1835 "you can, as the following expression demonstrates::"
1836 msgstr ""
1837
1838 #: ../../__w/calibre/calibre/manual/template_lang.rst:599
1839 msgid "The example shows several things:"
1840 msgstr ""
1841
1842 #: ../../__w/calibre/calibre/manual/template_lang.rst:601
1843 msgid ""
1844 "`TPM` is used if the expression begins with ``:'`` and ends with ``'``. "
1845 "Anything else is assumed to be in :ref:`Single Function Mode <single_mode>`."
1846 msgstr ""
1847
1848 #: ../../__w/calibre/calibre/manual/template_lang.rst:602
1849 msgid ""
1850 "the variable ``$`` stands for the field named in the template: the "
1851 "expression is operating upon, ``#series`` in this case."
1852 msgstr ""
1853
1854 #: ../../__w/calibre/calibre/manual/template_lang.rst:603
1855 msgid ""
1856 "functions must be given all their arguments. There is no default value. For "
1857 "example, the standard built-in functions must be given an additional initial"
1858 " parameter indicating the source field."
1859 msgstr ""
1860
1861 #: ../../__w/calibre/calibre/manual/template_lang.rst:604
1862 msgid "white space is ignored and can be used anywhere within the expression."
1863 msgstr ""
1864
1865 #: ../../__w/calibre/calibre/manual/template_lang.rst:605
1866 msgid ""
1867 "constant strings are enclosed in matching quotes, either ``'`` or ``\"``."
1868 msgstr ""
1869
1870 #: ../../__w/calibre/calibre/manual/template_lang.rst:607
1871 msgid ""
1872 "All the functions listed under `Single Function Mode` and `General Program "
1873 "Mode` can be used in `TPM`."
1874 msgstr ""
1875
1876 #: ../../__w/calibre/calibre/manual/template_lang.rst:609
1877 msgid ""
1878 "In `TPM`, using ``{`` and ``}`` characters in string literals can lead to "
1879 "errors or unexpected results because they confuse the template processor. It"
1880 " tries to treat them as template expression boundaries, not characters. In "
1881 "some but not all cases you can replace a ``{`` with ``[[`` and a ``}`` with "
1882 "`]]`. Generally, if your program contains ``{`` and ``}`` characters then "
1883 "you should use `General Program Mode`."
1884 msgstr ""
1885
1886 #: ../../__w/calibre/calibre/manual/template_lang.rst:611
1887 msgid ""
1888 "As with `General Program Mode`, for functions documented under :ref:`Single "
1889 "Function Mode <single_mode>` you must supply the value the function is to "
1890 "act upon as the first parameter in addition to the documented parameters. In"
1891 " `TPM` you can use ``$`` to access the value specified by the ``lookup "
1892 "name`` for the template expression."
1893 msgstr ""
1894
1895 #: ../../__w/calibre/calibre/manual/template_lang.rst:614
1896 msgid "Stored general program mode templates"
1897 msgstr ""
1898
1899 #: ../../__w/calibre/calibre/manual/template_lang.rst:616
1900 msgid ""
1901 ":ref:`General Program Mode <general_mode>` supports saving templates and "
1902 "calling those templates from another template, much like calling stored "
1903 "functions. You save templates using "
1904 ":guilabel:`Preferences->Advanced->Template functions`. More information is "
1905 "provided in that dialog. You call a template the same way you call a "
1906 "function, passing positional arguments if desired. An argument can be any "
1907 "expression. Examples of calling a template, assuming the stored template is "
1908 "named ``foo``:"
1909 msgstr ""
1910
1911 #: ../../__w/calibre/calibre/manual/template_lang.rst:618
1912 msgid "``foo()`` -- call the template passing no arguments."
1913 msgstr ""
1914
1915 #: ../../__w/calibre/calibre/manual/template_lang.rst:619
1916 msgid ""
1917 "``foo(a, b)`` call the template passing the values of the two variables "
1918 "``a`` and ``b``."
1919 msgstr ""
1920
1921 #: ../../__w/calibre/calibre/manual/template_lang.rst:620
1922 msgid ""
1923 "``foo(if field('series') then field('series_index') else 0 fi)`` -- if the "
1924 "book has a ``series`` then pass the ``series_index``, otherwise pass the "
1925 "value ``0``."
1926 msgstr ""
1927
1928 #: ../../__w/calibre/calibre/manual/template_lang.rst:622
1929 msgid ""
1930 "You retrieve the arguments passed in the call to the stored template using "
1931 "the ``arguments`` function. It both declares and initializes local "
1932 "variables, effectively parameters. The variables are positional; they get "
1933 "the value of the value given in the call in the same position. If the "
1934 "corresponding parameter is not provided in the call then ``arguments`` "
1935 "assigns that variable the provided default value. If there is no default "
1936 "value then the variable is set to the empty string. For example, the "
1937 "following ``arguments`` function declares 2 variables, ``key``, "
1938 "``alternate``::"
1939 msgstr ""
1940
1941 #: ../../__w/calibre/calibre/manual/template_lang.rst:626
1942 msgid "Examples, again assuming the stored template is named ``foo``:"
1943 msgstr ""
1944
1945 #: ../../__w/calibre/calibre/manual/template_lang.rst:628
1946 msgid ""
1947 "``foo('#myseries')`` -- argument ``key`` is assigned the value "
1948 "``'myseries'`` and the argument ``alternate`` is assigned the default value "
1949 "``'series'``."
1950 msgstr ""
1951
1952 #: ../../__w/calibre/calibre/manual/template_lang.rst:629
1953 msgid ""
1954 "``foo('series', '#genre')`` the variable ``key`` is assigned the value "
1955 "``'series'`` and the variable ``alternate`` is assigned the value "
1956 "``'#genre'``."
1957 msgstr ""
1958
1959 #: ../../__w/calibre/calibre/manual/template_lang.rst:630
1960 msgid ""
1961 "``foo()`` -- the variable ``key`` is assigned the empty string and the "
1962 "variable ``alternate`` is assigned the value ``'series'``."
1963 msgstr ""
1964
1965 #: ../../__w/calibre/calibre/manual/template_lang.rst:632
1966 msgid ""
1967 "An easy way to test stored templates is using the ``Template tester`` "
1968 "dialog. For ease of access give it a keyboard shortcut in "
1969 ":guilabel:`Preferences->Advanced->Keyboard shortcuts->Template tester`. "
1970 "Giving the ``Stored templates`` dialog a shortcut will help switching more "
1971 "rapidly between the tester and editing the stored template's source code."
1972 msgstr ""
1973
1974 #: ../../__w/calibre/calibre/manual/template_lang.rst:635
1975 msgid "Providing additional information to templates"
1976 msgstr ""
1977
1978 #: ../../__w/calibre/calibre/manual/template_lang.rst:637
1979 msgid ""
1980 "A developer can choose to pass additional information to the template "
1981 "processor, such as application-specific book metadata or information about "
1982 "what the processor is being asked to do. A template can access this "
1983 "information and use it during the evaluation."
1984 msgstr ""
1985
1986 #: ../../__w/calibre/calibre/manual/template_lang.rst:639
1987 msgid "**Developer: how to pass additional information**"
1988 msgstr ""
1989
1990 #: ../../__w/calibre/calibre/manual/template_lang.rst:641
1991 msgid ""
1992 "The additional information is a Python dictionary containing pairs "
1993 "``variable_name: variable_value`` where the values must be strings. The "
1994 "template can access the dict, creating template local variables named "
1995 "``variable_name`` containing the value ``variable_value``. The user cannot "
1996 "change the name so it is best to use names that won't collide with other "
1997 "template local variables, for example by prefixing the name with an "
1998 "underscore."
1999 msgstr ""
2000
2001 #: ../../__w/calibre/calibre/manual/template_lang.rst:643
2002 msgid ""
2003 "This dict is passed to the template processor (the ``formatter``) using the "
2004 "named parameter ``global_vars=your_dict``. The full method signature is::"
2005 msgstr ""
2006
2007 #: ../../__w/calibre/calibre/manual/template_lang.rst:651
2008 msgid "**Template writer: how to access the additional information**"
2009 msgstr ""
2010
2011 #: ../../__w/calibre/calibre/manual/template_lang.rst:653
2012 msgid ""
2013 "You access the additional information (the ``globals`` dict) in a template "
2014 "using the template function::"
2015 msgstr ""
2016
2017 #: ../../__w/calibre/calibre/manual/template_lang.rst:657
2018 msgid ""
2019 "where ``id`` is any legal variable name. This function checks whether the "
2020 "additional information provided by the developer contains the name. If it "
2021 "does then the function assigns the provided value to a template local "
2022 "variable with that name. If the name is not in the additional information "
2023 "and if an ``expression`` is provided, the ``expression`` is evaluated and "
2024 "the result is assigned to the local variable. If neither a value nor an "
2025 "expression is provided, the function assigns the empty string (``''``) to "
2026 "the local variable."
2027 msgstr ""
2028
2029 #: ../../__w/calibre/calibre/manual/template_lang.rst:659
2030 msgid ""
2031 "A template can set a value in the ``globals`` dict using the template "
2032 "function::"
2033 msgstr ""
2034
2035 #: ../../__w/calibre/calibre/manual/template_lang.rst:663
2036 msgid ""
2037 "This function sets the ``globals`` dict key:value pair ``id:value`` where "
2038 "``value`` is the value of the template local variable ``id``. If that local "
2039 "variable doesn't exist then ``value`` is set to the result of evaluating "
2040 "``expression``."
2041 msgstr ""
2042
2043 #: ../../__w/calibre/calibre/manual/template_lang.rst:666
2044 msgid "Notes on the difference between modes"
2045 msgstr ""
2046
2047 #: ../../__w/calibre/calibre/manual/template_lang.rst:668
2048 msgid ""
2049 "The three program modes, :ref:`Single Function Mode <single_mode>` (SFM), "
2050 ":ref:`Template Program Mode <template_mode>` (`TPM`), and :ref:`General "
2051 "Program Mode <general_mode>` (`GPM`), work differently. SFM is intended to "
2052 "be 'simple' so it hides a lot of programming language bits."
2053 msgstr ""
2054
2055 #: ../../__w/calibre/calibre/manual/template_lang.rst:670
2056 msgid "Differences:"
2057 msgstr ""
2058
2059 #: ../../__w/calibre/calibre/manual/template_lang.rst:672
2060 msgid ""
2061 "In SFM the value of the column is always passed as an 'invisible' first "
2062 "argument to a function included in the template."
2063 msgstr ""
2064
2065 #: ../../__w/calibre/calibre/manual/template_lang.rst:673
2066 msgid ""
2067 "SFM doesn't support the difference between variables and strings; all values"
2068 " are strings."
2069 msgstr ""
2070
2071 #: ../../__w/calibre/calibre/manual/template_lang.rst:674
2072 msgid ""
2073 "The following SFM template returns either the series name or the string \"no"
2074 " series\"::"
2075 msgstr ""
2076
2077 #: ../../__w/calibre/calibre/manual/template_lang.rst:678
2078 msgid "The equivalent template in `TPM` is ::"
2079 msgstr ""
2080
2081 #: ../../__w/calibre/calibre/manual/template_lang.rst:682
2082 msgid "The equivalent template in `GPM` is::"
2083 msgstr ""
2084
2085 #: ../../__w/calibre/calibre/manual/template_lang.rst:686
2086 msgid ""
2087 "The first argument to ``ifempty`` is the value of the field ``series``. The "
2088 "second argument is the string ``no series``. In SFM the first argument, the "
2089 "value of the field, is automatically passed (the invisible argument)."
2090 msgstr ""
2091
2092 #: ../../__w/calibre/calibre/manual/template_lang.rst:687
2093 msgid ""
2094 "Several template functions, for example ``booksize()`` and "
2095 "``current_library_name()``, take no arguments. Because of the 'invisible "
2096 "argument' you cannot use these functions in SFM."
2097 msgstr ""
2098
2099 #: ../../__w/calibre/calibre/manual/template_lang.rst:688
2100 msgid ""
2101 "Nested functions, where a function calls another function to compute an "
2102 "argument, cannot be used in SFM. For example this template, intended to "
2103 "return the first 5 characters of the series value uppercased, won't work in "
2104 "SFM::"
2105 msgstr ""
2106
2107 #: ../../__w/calibre/calibre/manual/template_lang.rst:692
2108 msgid ""
2109 "`TPM` and `GPM` support nested functions. The above template in `TPM` would "
2110 "be::"
2111 msgstr ""
2112
2113 #: ../../__w/calibre/calibre/manual/template_lang.rst:696
2114 msgid "In `GPM` it would be::"
2115 msgstr ""
2116
2117 #: ../../__w/calibre/calibre/manual/template_lang.rst:700
2118 msgid ""
2119 "As noted in the above :ref:`Template Program Mode <template_mode>` section, "
2120 "using ``{`` and ``}`` characters in `TPM` string literals can lead to errors"
2121 " or unexpected results because they confuse the template processor. It tries"
2122 " to treat them as template boundaries, not characters. In some but not all "
2123 "cases you can replace a ``{`` with ``[[`` and a ``}`` with `]]`. Generally, "
2124 "if your program contains ``{`` and ``}`` characters then you should use "
2125 "`General Program Mode`."
2126 msgstr ""
2127
2128 #: ../../__w/calibre/calibre/manual/template_lang.rst:704
2129 msgid "User-defined Python template functions"
2130 msgstr ""
2131
2132 #: ../../__w/calibre/calibre/manual/template_lang.rst:706
2133 msgid ""
2134 "You can add your own Python functions to the template processor. Such "
2135 "functions can be used in any of the three template programming modes. The "
2136 "functions are added by going to :guilabel:`Preferences -> Advanced -> "
2137 "Template functions`. Instructions are shown in that dialog."
2138 msgstr ""
2139
2140 #: ../../__w/calibre/calibre/manual/template_lang.rst:709
2141 msgid "Special notes for save/send templates"
2142 msgstr ""
2143
2144 #: ../../__w/calibre/calibre/manual/template_lang.rst:711
2145 msgid ""
2146 "Special processing is applied when a template is used in a `save to disk` or"
2147 " `send to device` template. The values of the fields are cleaned, replacing "
2148 "characters that are special to file systems with underscores, including "
2149 "slashes. This means that field text cannot be used to create folders. "
2150 "However, slashes are not changed in prefix or suffix strings, so slashes in "
2151 "these strings will cause folders to be created. Because of this, you can "
2152 "create variable-depth folder structure."
2153 msgstr ""
2154
2155 #: ../../__w/calibre/calibre/manual/template_lang.rst:713
2156 msgid ""
2157 "For example, assume we want the folder structure `series/series_index - "
2158 "title`, with the caveat that if series does not exist, then the title should"
2159 " be in the top folder. The template to do this is::"
2160 msgstr ""
2161
2162 #: ../../__w/calibre/calibre/manual/template_lang.rst:717
2163 msgid "The slash and the hyphen appear only if series is not empty."
2164 msgstr ""
2165
2166 #: ../../__w/calibre/calibre/manual/template_lang.rst:719
2167 msgid ""
2168 "The lookup function lets us do even fancier processing. For example, assume "
2169 "that if a book has a series, then we want the folder structure "
2170 "`series/series index - title.fmt`. If the book does not have a series then "
2171 "we want the folder structure `genre/author_sort/title.fmt`. If the book has "
2172 "no genre then we want to use 'Unknown'. We want two completely different "
2173 "paths, depending on the value of series."
2174 msgstr ""
2175
2176 #: ../../__w/calibre/calibre/manual/template_lang.rst:721
2177 msgid "To accomplish this, we:"
2178 msgstr ""
2179
2180 #: ../../__w/calibre/calibre/manual/template_lang.rst:723
2181 msgid ""
2182 "Create a composite field (give it lookup name #aa) containing "
2183 "``{series}/{series_index} - {title}``. If the series is not empty, then this"
2184 " template will produce `series/series_index - title`."
2185 msgstr ""
2186
2187 #: ../../__w/calibre/calibre/manual/template_lang.rst:724
2188 msgid ""
2189 "Create a composite field (give it lookup name #bb) containing "
2190 "``{#genre:ifempty(Unknown)}/{author_sort}/{title}``. This template produces "
2191 "`genre/author_sort/title`, where an empty genre is replaced with `Unknown`."
2192 msgstr ""
2193
2194 #: ../../__w/calibre/calibre/manual/template_lang.rst:725
2195 msgid ""
2196 "Set the save template to ``{series:lookup(.,#aa,#bb}``. This template "
2197 "chooses composite field ``#aa`` if series is not empty and composite field "
2198 "``#bb`` if series is empty. We therefore have two completely different save "
2199 "paths, depending on whether or not `series` is empty."
2200 msgstr ""
2201
2202 #: ../../__w/calibre/calibre/manual/template_lang.rst:728
2203 msgid "Templates and plugboards"
2204 msgstr ""
2205
2206 #: ../../__w/calibre/calibre/manual/template_lang.rst:730
2207 msgid ""
2208 "Plugboards are used for changing the metadata written into books during "
2209 "send-to-device and save-to-disk operations. A plugboard permits you to "
2210 "specify a template to provide the data to write into the book's metadata. "
2211 "You can use plugboards to modify the following fields: authors, author_sort,"
2212 " language, publisher, tags, title, title_sort. This feature helps people who"
2213 " want to use different metadata in books on devices to solve sorting or "
2214 "display issues."
2215 msgstr ""
2216
2217 #: ../../__w/calibre/calibre/manual/template_lang.rst:732
2218 msgid ""
2219 "When you create a plugboard, you specify the format and device for which the"
2220 " plugboard is to be used. A special device is provided, ``save_to_disk``, "
2221 "that is used when saving formats (as opposed to sending them to a device). "
2222 "Once you have chosen the format and device, you choose the metadata fields "
2223 "to change, providing templates to supply the new values. These templates are"
2224 " `connected` to their destination fields, hence the name `plugboards`. You "
2225 "can of course use composite columns in these templates."
2226 msgstr ""
2227
2228 #: ../../__w/calibre/calibre/manual/template_lang.rst:734
2229 msgid ""
2230 "When a plugboard might apply (Content server, save to disk, or send to "
2231 "device), calibre searches the defined plugboards to choose the correct one "
2232 "for the given format and device. For example, to find the appropriate "
2233 "plugboard for an EPUB book being sent to an ANDROID device, calibre searches"
2234 " the plugboards using the following search order:"
2235 msgstr ""
2236
2237 #: ../../__w/calibre/calibre/manual/template_lang.rst:738
2238 msgid ""
2239 "a plugboard with an exact match on format and device, e.g., ``EPUB`` and "
2240 "``ANDROID``"
2241 msgstr ""
2242
2243 #: ../../__w/calibre/calibre/manual/template_lang.rst:739
2244 msgid ""
2245 "a plugboard with an exact match on format and the special ``any device`` "
2246 "choice, e.g., ``EPUB`` and ``any device``"
2247 msgstr ""
2248
2249 #: ../../__w/calibre/calibre/manual/template_lang.rst:740
2250 msgid ""
2251 "a plugboard with the special ``any format`` choice and an exact match on "
2252 "device, e.g., ``any format`` and ``ANDROID``"
2253 msgstr ""
2254
2255 #: ../../__w/calibre/calibre/manual/template_lang.rst:741
2256 msgid "a plugboard with ``any format`` and ``any device``"
2257 msgstr ""
2258
2259 #: ../../__w/calibre/calibre/manual/template_lang.rst:743
2260 msgid ""
2261 "The tags and authors fields have special treatment, because both of these "
2262 "fields can hold more than one item. A book can have many tags and many "
2263 "authors. When you specify that one of these two fields is to be changed, the"
2264 " template's result is examined to see if more than one item is there. For "
2265 "tags, the result is cut apart wherever calibre finds a comma. For example, "
2266 "if the template produces the value ``Thriller, Horror``, then the result "
2267 "will be two tags, ``Thriller`` and ``Horror``. There is no way to put a "
2268 "comma in the middle of a tag."
2269 msgstr ""
2270
2271 #: ../../__w/calibre/calibre/manual/template_lang.rst:746
2272 msgid ""
2273 "The same thing happens for authors, but using a different character for the "
2274 "cut, a `&` (ampersand) instead of a comma. For example, if the template "
2275 "produces the value ``Blogs, Joe&Posts, Susan``, then the book will end up "
2276 "with two authors, ``Blogs, Joe`` and ``Posts, Susan``. If the template "
2277 "produces the value ``Blogs, Joe;Posts, Susan``, then the book will have one "
2278 "author with a rather strange name."
2279 msgstr ""
2280
2281 #: ../../__w/calibre/calibre/manual/template_lang.rst:748
2282 msgid ""
2283 "Plugboards affect the metadata written into the book when it is saved to "
2284 "disk or written to the device. Plugboards do not affect the metadata used by"
2285 " ``save to disk`` and ``send to device`` to create the file names. Instead, "
2286 "file names are constructed using the templates entered on the appropriate "
2287 "preferences window."
2288 msgstr ""
2289
2290 #: ../../__w/calibre/calibre/manual/template_lang.rst:751
2291 msgid "Tips"
2292 msgstr ""
2293
2294 #: ../../__w/calibre/calibre/manual/template_lang.rst:753
2295 msgid ""
2296 "Use the Template Tester to test templates. Add the tester to the context "
2297 "menu for books in the library and/or give it a keyboard shortcut."
2298 msgstr ""
2299
2300 #: ../../__w/calibre/calibre/manual/template_lang.rst:754
2301 msgid ""
2302 "Templates can use other templates by referencing composite columns built "
2303 "with the desired template. Alternatively, you can use Stored Templates."
2304 msgstr ""
2305
2306 #: ../../__w/calibre/calibre/manual/template_lang.rst:755
2307 msgid ""
2308 "In a plugboard, you can set a field to empty (or whatever is equivalent to "
2309 "empty) by using the special template ``{}``. This template will always "
2310 "evaluate to an empty string."
2311 msgstr ""
2312
2313 #: ../../__w/calibre/calibre/manual/template_lang.rst:756
2314 msgid ""
2315 "The technique described above to show numbers even if they have a zero value"
2316 " works with the standard field series_index."
2317 msgstr ""
2318
2319 #: ../../__w/calibre/calibre/manual/template_lang.rst:761
2320 msgid "Function reference"
2321 msgstr ""