Debian Codegraph @

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