Debian Codegraph @

translations/manual/gl/function_mode.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 # Xosé, 2015
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: calibre\n"
10 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2021-10-07 03:23+0000\n"
12 "PO-Revision-Date: 2021-10-03 01:41+0000\n"
13 "Last-Translator: Kovid Goyal <[email protected]>\n"
14 "Language-Team: Galician (http://www.transifex.com/calibre/calibre/language/gl/)\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Language: gl\n"
19 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
21 #: ../../__w/calibre/calibre/manual/function_mode.rst:2
22 msgid "Function mode for Search & replace in the Editor"
23 msgstr ""
24
25 #: ../../__w/calibre/calibre/manual/function_mode.rst:4
26 msgid ""
27 "The :guilabel:`Search & replace` tool in the editor support a *function "
28 "mode*. In this mode, you can combine regular expressions (see :doc:`regexp`)"
29 " with arbitrarily powerful Python functions to do all sorts of advanced text"
30 " processing."
31 msgstr ""
32
33 #: ../../__w/calibre/calibre/manual/function_mode.rst:9
34 msgid ""
35 "In the standard *regexp* mode for search and replace, you specify both a "
36 "regular expression to search for as well as a template that is used to "
37 "replace all found matches. In function mode, instead of using a fixed "
38 "template, you specify an arbitrary function, in the `Python programming "
39 "language <https://docs.python.org>`_. This allows you to do lots of things "
40 "that are not possible with simple templates."
41 msgstr ""
42
43 #: ../../__w/calibre/calibre/manual/function_mode.rst:16
44 msgid ""
45 "Techniques for using function mode and the syntax will be described by means"
46 " of examples, showing you how to create functions to perform progressively "
47 "more complex tasks."
48 msgstr ""
49
50 #: ../../__w/calibre/calibre/manual/function_mode.rstNone
51 msgid "The Function mode"
52 msgstr ""
53
54 #: ../../__w/calibre/calibre/manual/function_mode.rst:26
55 msgid "Automatically fixing the case of headings in the document"
56 msgstr ""
57
58 #: ../../__w/calibre/calibre/manual/function_mode.rst:28
59 msgid ""
60 "Here, we will leverage one of the builtin functions in the editor to "
61 "automatically change the case of all text inside heading tags to title "
62 "case::"
63 msgstr ""
64
65 #: ../../__w/calibre/calibre/manual/function_mode.rst:33
66 msgid ""
67 "For the function, simply choose the :guilabel:`Title-case text (ignore "
68 "tags)` builtin function. The will change titles that look like: ``<h1>some "
69 "TITLE</h1>`` to ``<h1>Some Title</h1>``. It will work even if there are "
70 "other HTML tags inside the heading tags."
71 msgstr ""
72
73 #: ../../__w/calibre/calibre/manual/function_mode.rst:40
74 msgid "Your first custom function - smartening hyphens"
75 msgstr ""
76
77 #: ../../__w/calibre/calibre/manual/function_mode.rst:42
78 msgid ""
79 "The real power of function mode comes from being able to create your own "
80 "functions to process text in arbitrary ways. The Smarten Punctuation tool in"
81 " the editor leaves individual hyphens alone, so you can use the this "
82 "function to replace them with em-dashes."
83 msgstr ""
84
85 #: ../../__w/calibre/calibre/manual/function_mode.rst:47
86 msgid ""
87 "To create a new function, simply click the :guilabel:`Create/edit` button to"
88 " create a new function and copy the Python code from below."
89 msgstr ""
90
91 #: ../../__w/calibre/calibre/manual/function_mode.rst:55
92 msgid ""
93 "Every :guilabel:`Search & replace` custom function must have a unique name "
94 "and consist of a Python function named replace, that accepts all the "
95 "arguments shown above. For the moment, we won't worry about all the "
96 "different arguments to ``replace()`` function. Just focus on the ``match`` "
97 "argument. It represents a match when running a search and replace. Its full "
98 "documentation in available `here <https://docs.python.org/library/re.html"
99 "#match-objects>`_. ``match.group()`` simply returns all the matched text and"
100 " all we do is replace hyphens in that text with em-dashes, first replacing "
101 "double hyphens and then single hyphens."
102 msgstr ""
103
104 #: ../../__w/calibre/calibre/manual/function_mode.rst:65
105 msgid "Use this function with the find regular expression::"
106 msgstr ""
107
108 #: ../../__w/calibre/calibre/manual/function_mode.rst:69
109 msgid ""
110 "And it will replace all hyphens with em-dashes, but only in actual text and "
111 "not inside HTML tag definitions."
112 msgstr ""
113
114 #: ../../__w/calibre/calibre/manual/function_mode.rst:74
115 msgid ""
116 "The power of function mode - using a spelling dictionary to fix mis-"
117 "hyphenated words"
118 msgstr ""
119
120 #: ../../__w/calibre/calibre/manual/function_mode.rst:76
121 msgid ""
122 "Often, e-books created from scans of printed books contain mis-hyphenated "
123 "words -- words that were split at the end of the line on the printed page. "
124 "We will write a simple function to automatically find and fix such words."
125 msgstr ""
126
127 #: ../../__w/calibre/calibre/manual/function_mode.rst:101
128 msgid "Use this function with the same find expression as before, namely::"
129 msgstr ""
130
131 #: ../../__w/calibre/calibre/manual/function_mode.rst:105
132 msgid ""
133 "And it will magically fix all mis-hyphenated words in the text of the book. "
134 "The main trick is to use one of the useful extra arguments to the replace "
135 "function, ``dictionaries``. This refers to the dictionaries the editor "
136 "itself uses to spell check text in the book. What this function does is look"
137 " for words separated by a hyphen, remove the hyphen and check if the "
138 "dictionary recognizes the composite word, if it does, the original words are"
139 " replaced by the hyphen free composite word."
140 msgstr ""
141
142 #: ../../__w/calibre/calibre/manual/function_mode.rst:113
143 msgid ""
144 "Note that one limitation of this technique is it will only work for mono-"
145 "lingual books, because, by default, ``dictionaries.recognized()`` uses the "
146 "main language of the book."
147 msgstr ""
148
149 #: ../../__w/calibre/calibre/manual/function_mode.rst:119
150 msgid "Auto numbering sections"
151 msgstr ""
152
153 #: ../../__w/calibre/calibre/manual/function_mode.rst:121
154 msgid ""
155 "Now we will see something a little different. Suppose your HTML file has "
156 "many sections, each with a heading in an :code:`<h2>` tag that looks like "
157 ":code:`<h2>Some text</h2>`. You can create a custom function that will "
158 "automatically number these headings with consecutive section numbers, so "
159 "that they look like :code:`<h2>1. Some text</h2>`."
160 msgstr ""
161
162 #: ../../__w/calibre/calibre/manual/function_mode.rst:137
163 msgid "Use it with the find expression::"
164 msgstr ""
165
166 #: ../../__w/calibre/calibre/manual/function_mode.rst:141
167 msgid ""
168 "Place the cursor at the top of the file and click :guilabel:`Replace all`."
169 msgstr ""
170
171 #: ../../__w/calibre/calibre/manual/function_mode.rst:143
172 msgid ""
173 "This function uses another of the useful extra arguments to ``replace()``: "
174 "the ``number`` argument. When doing a :guilabel:`Replace All` number is "
175 "automatically incremented for every successive match."
176 msgstr ""
177
178 #: ../../__w/calibre/calibre/manual/function_mode.rst:147
179 msgid ""
180 "Another new feature is the use of ``replace.file_order`` -- setting that to "
181 "``'spine'`` means that if this search is run on multiple HTML files, the "
182 "files are processed in the order in which they appear in the book. See "
183 ":ref:`file_order_replace_all` for details."
184 msgstr ""
185
186 #: ../../__w/calibre/calibre/manual/function_mode.rst:154
187 msgid "Auto create a Table of Contents"
188 msgstr ""
189
190 #: ../../__w/calibre/calibre/manual/function_mode.rst:156
191 msgid ""
192 "Finally, lets try something a little more ambitious. Suppose your book has "
193 "headings in ``h1`` and ``h2`` tags that look like ``<h1 id=\"someid\">Some "
194 "Text</h1>``. We will auto-generate an HTML Table of Contents based on these "
195 "headings. Create the custom function below:"
196 msgstr ""
197
198 #: ../../__w/calibre/calibre/manual/function_mode.rst:199
199 msgid "And use it with the find expression::"
200 msgstr ""
201
202 #: ../../__w/calibre/calibre/manual/function_mode.rst:203
203 msgid ""
204 "Run the search on :guilabel:`All text files` and at the end of the search, a"
205 " window will popup with \"Debug output from your function\" which will have "
206 "the HTML Table of Contents, ready to be pasted into :file:`toc.html`."
207 msgstr ""
208
209 #: ../../__w/calibre/calibre/manual/function_mode.rst:207
210 msgid ""
211 "The function above is heavily commented, so it should be easy to follow. The"
212 " key new feature is the use of another useful extra argument to the "
213 "``replace()`` function, the ``data`` object. The ``data`` object is a Python"
214 " *dict* that persists between all successive invocations of ``replace()`` "
215 "during a single :guilabel:`Replace All` operation."
216 msgstr ""
217
218 #: ../../__w/calibre/calibre/manual/function_mode.rst:213
219 msgid ""
220 "Another new feature is the use of ``call_after_last_match`` -- setting that "
221 "to ``True`` on the ``replace()`` function means that the editor will call "
222 "``replace()`` one extra time after all matches have been found. For this "
223 "extra call, the match object will be ``None``."
224 msgstr ""
225
226 #: ../../__w/calibre/calibre/manual/function_mode.rst:218
227 msgid ""
228 "This was just a demonstration to show you the power of function mode, if you"
229 " really needed to generate a Table of Contents from headings in your book, "
230 "you would be better off using the dedicated Table of Contents tool in "
231 ":guilabel:`Tools->Table of Contents`."
232 msgstr ""
233
234 #: ../../__w/calibre/calibre/manual/function_mode.rst:224
235 msgid "The API for the function mode"
236 msgstr ""
237
238 #: ../../__w/calibre/calibre/manual/function_mode.rst:226
239 msgid ""
240 "All function mode functions must be Python functions named replace, with the"
241 " following signature::"
242 msgstr ""
243
244 #: ../../__w/calibre/calibre/manual/function_mode.rst:232
245 msgid ""
246 "When a find/replace is run, for every match that is found, the ``replace()``"
247 " function will be called, it must return the replacement string for that "
248 "match. If no replacements are to be done, it should return ``match.group()``"
249 " which is the original string. The various arguments to the ``replace()`` "
250 "function are documented below."
251 msgstr ""
252
253 #: ../../__w/calibre/calibre/manual/function_mode.rst:239
254 msgid "The ``match`` argument"
255 msgstr "O argumento «match»"
256
257 #: ../../__w/calibre/calibre/manual/function_mode.rst:241
258 msgid ""
259 "The ``match`` argument represents the currently found match. It is a `Python"
260 " Match object <https://docs.python.org/library/re.html#match-objects>`_. Its"
261 " most useful method is ``group()`` which can be used to get the matched text"
262 " corresponding to individual capture groups in the search regular "
263 "expression."
264 msgstr ""
265
266 #: ../../__w/calibre/calibre/manual/function_mode.rst:248
267 msgid "The ``number`` argument"
268 msgstr "O argumento «number»"
269
270 #: ../../__w/calibre/calibre/manual/function_mode.rst:250
271 msgid ""
272 "The ``number`` argument is the number of the current match. When you run "
273 ":guilabel:`Replace All`, every successive match will cause ``replace()`` to "
274 "be called with an increasing number. The first match has number 1."
275 msgstr ""
276
277 #: ../../__w/calibre/calibre/manual/function_mode.rst:255
278 msgid "The ``file_name`` argument"
279 msgstr "O argumento «file_name»"
280
281 #: ../../__w/calibre/calibre/manual/function_mode.rst:257
282 msgid ""
283 "This is the filename of the file in which the current match was found. When "
284 "searching inside marked text, the ``file_name`` is empty. The ``file_name`` "
285 "is in canonical form, a path relative to the root of the book, using ``/`` "
286 "as the path separator."
287 msgstr ""
288
289 #: ../../__w/calibre/calibre/manual/function_mode.rst:263
290 msgid "The ``metadata`` argument"
291 msgstr "O argumento «metadata»"
292
293 #: ../../__w/calibre/calibre/manual/function_mode.rst:265
294 msgid ""
295 "This represents the metadata of the current book, such as title, authors, "
296 "language, etc. It is an object of class "
297 ":class:`calibre.ebooks.metadata.book.base.Metadata`. Useful attributes "
298 "include, ``title``, ``authors`` (a list of authors) and ``language`` (the "
299 "language code)."
300 msgstr ""
301
302 #: ../../__w/calibre/calibre/manual/function_mode.rst:271
303 msgid "The ``dictionaries`` argument"
304 msgstr "O argumento «dictionaries»"
305
306 #: ../../__w/calibre/calibre/manual/function_mode.rst:273
307 msgid ""
308 "This represents the collection of dictionaries used for spell checking the "
309 "current book. Its most useful method is ``dictionaries.recognized(word)`` "
310 "which will return ``True`` if the passed in word is recognized by the "
311 "dictionary for the current book's language."
312 msgstr ""
313
314 #: ../../__w/calibre/calibre/manual/function_mode.rst:279
315 msgid "The ``data`` argument"
316 msgstr "O argumento «data»"
317
318 #: ../../__w/calibre/calibre/manual/function_mode.rst:281
319 msgid ""
320 "This a simple Python ``dict``. When you run :guilabel:`Replace all`, every "
321 "successive match will cause ``replace()`` to be called with the same "
322 "``dict`` as data. You can thus use it to store arbitrary data between "
323 "invocations of ``replace()`` during a :guilabel:`Replace all` operation."
324 msgstr ""
325
326 #: ../../__w/calibre/calibre/manual/function_mode.rst:288
327 msgid "The ``functions`` argument"
328 msgstr "O argumento «functions»"
329
330 #: ../../__w/calibre/calibre/manual/function_mode.rst:290
331 msgid ""
332 "The ``functions`` argument gives you access to all other user defined "
333 "functions. This is useful for code re-use. You can define utility functions "
334 "in one place and re-use them in all your other functions. For example, "
335 "suppose you create a function name ``My Function`` like this:"
336 msgstr ""
337
338 #: ../../__w/calibre/calibre/manual/function_mode.rst:303
339 msgid ""
340 "Then, in another function, you can access the ``utility()`` function like "
341 "this:"
342 msgstr ""
343
344 #: ../../__w/calibre/calibre/manual/function_mode.rst:311
345 msgid ""
346 "You can also use the functions object to store persistent data, that can be "
347 "re-used by other functions. For example, you could have one function that "
348 "when run with :guilabel:`Replace All` collects some data and another "
349 "function that uses it when it is run afterwards. Consider the following two "
350 "functions:"
351 msgstr ""
352
353 #: ../../__w/calibre/calibre/manual/function_mode.rst:331
354 msgid "Debugging your functions"
355 msgstr "Depuración de funcións"
356
357 #: ../../__w/calibre/calibre/manual/function_mode.rst:333
358 msgid ""
359 "You can debug the functions you create by using the standard ``print()`` "
360 "function from Python. The output of print will be displayed in a popup "
361 "window after the Find/replace has completed. You saw an example of using "
362 "``print()`` to output an entire table of contents above."
363 msgstr ""
364
365 #: ../../__w/calibre/calibre/manual/function_mode.rst:341
366 msgid "Choose file order when running on multiple HTML files"
367 msgstr ""
368
369 #: ../../__w/calibre/calibre/manual/function_mode.rst:343
370 msgid ""
371 "When you run a :guilabel:`Replace all` on multiple HTML files, the order in "
372 "which the files are processes depends on what files you have open for "
373 "editing. You can force the search to process files in the order in which the"
374 " appear by setting the ``file_order`` attribute on your function, like this:"
375 msgstr ""
376
377 #: ../../__w/calibre/calibre/manual/function_mode.rst:355
378 msgid ""
379 "``file_order`` accepts two values, ``spine`` and ``spine-reverse`` which "
380 "cause the search to process multiple files in the order they appear in the "
381 "book, either forwards or backwards, respectively."
382 msgstr ""
383
384 #: ../../__w/calibre/calibre/manual/function_mode.rst:360
385 msgid ""
386 "Having your function called an extra time after the last match is found"
387 msgstr ""
388
389 #: ../../__w/calibre/calibre/manual/function_mode.rst:362
390 msgid ""
391 "Sometimes, as in the auto generate table of contents example above, it is "
392 "useful to have your function called an extra time after the last match is "
393 "found. You can do this by setting the ``call_after_last_match`` attribute on"
394 " your function, like this:"
395 msgstr ""
396
397 #: ../../__w/calibre/calibre/manual/function_mode.rst:376
398 msgid "Appending the output from the function to marked text"
399 msgstr ""
400
401 #: ../../__w/calibre/calibre/manual/function_mode.rst:378
402 msgid ""
403 "When running search and replace on marked text, it is sometimes useful to "
404 "append so text to the end of the marked text. You can do that by setting the"
405 " ``append_final_output_to_marked`` attribute on your function (note that you"
406 " also need to set ``call_after_last_match``), like this:"
407 msgstr ""
408
409 #: ../../__w/calibre/calibre/manual/function_mode.rst:393
410 msgid "Suppressing the result dialog when performing searches on marked text"
411 msgstr ""
412
413 #: ../../__w/calibre/calibre/manual/function_mode.rst:395
414 msgid ""
415 "You can also suppress the result dialog (which can slow down the repeated "
416 "application of a search/replace on many blocks of text) by setting the "
417 "``suppress_result_dialog`` attribute on your function, like this:"
418 msgstr ""
419
420 #: ../../__w/calibre/calibre/manual/function_mode.rst:408
421 msgid "More examples"
422 msgstr ""
423
424 #: ../../__w/calibre/calibre/manual/function_mode.rst:410
425 msgid ""
426 "More useful examples, contributed by calibre users, can be found in the "
427 "`calibre E-book editor forum "
428 "<https://www.mobileread.com/forums/showthread.php?t=237181>`_."
429 msgstr ""