| 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 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2018 |
| 7 |
# Jonatan Nyberg, 2026 |
| 8 |
# Jonatan Nyberg, 2016-2017,2021-2024,2026 |
| 9 |
# Jonatan Nyberg, 2019-2021 |
| 10 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2018 |
| 11 |
# Jonatan Nyberg, 2026 |
| 12 |
# Merarom <[email protected]>, 2014-2016 |
| 13 |
msgid "" |
| 14 |
msgstr "" |
| 15 |
"Project-Id-Version: calibre\n" |
| 16 |
"Report-Msgid-Bugs-To: \n" |
| 17 |
"POT-Creation-Date: 2026-09-16 15:05+0000\n" |
| 18 |
"PO-Revision-Date: 2014-11-21 02:54+0000\n" |
| 19 |
"Last-Translator: Jonatan Nyberg, 2026\n" |
| 20 |
"Language-Team: Swedish (http://app.transifex.com/calibre/calibre/language/sv/)\n" |
| 21 |
"MIME-Version: 1.0\n" |
| 22 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 23 |
"Content-Transfer-Encoding: 8bit\n" |
| 24 |
"Language: sv\n" |
| 25 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
| 26 |
|
| 27 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:2 |
| 28 |
msgid "Function mode for Search & replace in the Editor" |
| 29 |
msgstr "Funktionsläge för Sök & ersätt i redigeraren" |
| 30 |
|
| 31 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:4 |
| 32 |
msgid "" |
| 33 |
"The :guilabel:`Search & replace` tool in the editor supports a *function " |
| 34 |
"mode*. In this mode, you can combine regular expressions (see :doc:`regexp`)" |
| 35 |
" with arbitrarily powerful Python functions to do all sorts of advanced text" |
| 36 |
" processing." |
| 37 |
msgstr "Verktyget :guilabel:`Sök & ersätt` i redigeraren stöder ett *funktionsläge*. I det här läget kan du kombinera reguljära uttryck (se :doc:`regexp`) med Python-funktioner av valfri komplexitet för att utföra alla möjliga slags avancerad textbehandling." |
| 38 |
|
| 39 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:9 |
| 40 |
msgid "" |
| 41 |
"In the standard *regexp* mode for search and replace, you specify both a " |
| 42 |
"regular expression to search for as well as a template that is used to " |
| 43 |
"replace all found matches. In function mode, instead of using a fixed " |
| 44 |
"template, you specify an arbitrary function, in the `Python programming " |
| 45 |
"language <https://docs.python.org>`_. This allows you to do lots of things " |
| 46 |
"that are not possible with simple templates." |
| 47 |
msgstr "I standardläget *regexp* för sök och ersätt anger du både ett reguljärt sökuttryck och en mall som används för att ersätta alla hittade träffar. I funktionsläget anger du i stället för en fast mall en valfri funktion i `programmeringsspråket Python <https://docs.python.org>`_. Det gör det möjligt att utföra många uppgifter som inte går att lösa med enkla mallar." |
| 48 |
|
| 49 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:16 |
| 50 |
msgid "" |
| 51 |
"Techniques for using function mode and the syntax will be described by means" |
| 52 |
" of examples, showing you how to create functions to perform progressively " |
| 53 |
"more complex tasks." |
| 54 |
msgstr "Tekniker för att använda funktionsläge och syntaxen beskrivs med hjälp av exempel, som visar dig hur du skapar funktioner för att utföra allt mer komplexa uppgifter." |
| 55 |
|
| 56 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:21 |
| 57 |
msgid "The Function mode" |
| 58 |
msgstr "Funktionsläget" |
| 59 |
|
| 60 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:26 |
| 61 |
msgid "Automatically fixing the case of headings in the document" |
| 62 |
msgstr "Justera automatiskt skiftläget i dokumentets rubriker" |
| 63 |
|
| 64 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:28 |
| 65 |
msgid "" |
| 66 |
"Here, we will leverage one of the builtin functions in the editor to " |
| 67 |
"automatically change the case of all text inside heading tags to title " |
| 68 |
"case::" |
| 69 |
msgstr "Här använder vi en av redigerarens inbyggda funktioner för att automatiskt ändra texten i alla rubriktaggar till inledande versaler::" |
| 70 |
|
| 71 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:33 |
| 72 |
msgid "" |
| 73 |
"For the function, simply choose the :guilabel:`Title-case text (ignore " |
| 74 |
"tags)` builtin function. This will change titles that look like: ``<h1>some " |
| 75 |
"titLE</h1>`` to ``<h1>Some Title</h1>``. It will work even if there are " |
| 76 |
"other HTML tags inside the heading tags." |
| 77 |
msgstr "Välj den inbyggda funktionen :guilabel:`Title-case text (ignore tags)`. Den ändrar rubriker som ``<h1>some titLE</h1>`` till ``<h1>Some Title</h1>``. Det fungerar även om rubriktaggarna innehåller andra HTML-taggar." |
| 78 |
|
| 79 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:40 |
| 80 |
msgid "Your first custom function - smartening hyphens" |
| 81 |
msgstr "Din första anpassade funktion – förbättra bindestreck" |
| 82 |
|
| 83 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:42 |
| 84 |
msgid "" |
| 85 |
"The real power of function mode comes from being able to create your own " |
| 86 |
"functions to process text in arbitrary ways. The Smarten Punctuation tool in" |
| 87 |
" the editor leaves individual hyphens alone, so you can use this function to" |
| 88 |
" replace them with em-dashes." |
| 89 |
msgstr "Den verkliga styrkan i funktionsläget är möjligheten att skapa egna funktioner som bearbetar text på valfria sätt. Verktyget Förbättra skiljetecken i redigeraren lämnar enskilda bindestreck oförändrade, så du kan använda den här funktionen för att ersätta dem med långa tankstreck." |
| 90 |
|
| 91 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:47 |
| 92 |
msgid "" |
| 93 |
"To create a new function, simply click the :guilabel:`Create/edit` button to" |
| 94 |
" create a new function and copy the Python code from below." |
| 95 |
msgstr "Skapa en ny funktion genom att klicka på knappen :guilabel:`Skapa/redigera` och kopiera Python-koden nedan." |
| 96 |
|
| 97 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:55 |
| 98 |
msgid "" |
| 99 |
"Every :guilabel:`Search & replace` custom function must have a unique name " |
| 100 |
"and consist of a Python function named replace, that accepts all the " |
| 101 |
"arguments shown above. For the moment, we won't worry about all the " |
| 102 |
"different arguments to ``replace()`` function. Just focus on the ``match`` " |
| 103 |
"argument. It represents a match when running a search and replace. Its full " |
| 104 |
"documentation in available `here " |
| 105 |
"<https://docs.python.org/library/re.html#match-objects>`_. ``match.group()``" |
| 106 |
" simply returns all the matched text and all we do is replace hyphens in " |
| 107 |
"that text with em-dashes, first replacing double hyphens and then single " |
| 108 |
"hyphens." |
| 109 |
msgstr "Varje anpassad funktion för :guilabel:`Sök & ersätt` måste ha ett unikt namn och bestå av en Python-funktion med namnet replace som tar emot alla argument som visas ovan. För tillfället behöver vi inte gå igenom alla argument till funktionen ``replace()``. Fokusera på argumentet ``match``. Det representerar en träff när du söker och ersätter. Fullständig dokumentation finns `här <https://docs.python.org/library/re.html#match-objects>`_. ``match.group()`` returnerar all matchad text. Det enda vi gör är att ersätta bindestreck i den texten med långa tankstreck: först dubbla bindestreck och sedan enkla." |
| 110 |
|
| 111 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:65 |
| 112 |
msgid "Use this function with the find regular expression::" |
| 113 |
msgstr "Använd funktionen med följande reguljära sökuttryck::" |
| 114 |
|
| 115 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:69 |
| 116 |
msgid "" |
| 117 |
"And it will replace all hyphens with em-dashes, but only in actual text and " |
| 118 |
"not inside HTML tag definitions." |
| 119 |
msgstr "Då ersätts alla bindestreck med långa tankstreck, men bara i själva texten och inte inuti HTML-taggdefinitioner." |
| 120 |
|
| 121 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:74 |
| 122 |
msgid "" |
| 123 |
"The power of function mode - using a spelling dictionary to fix mis-" |
| 124 |
"hyphenated words" |
| 125 |
msgstr "Funktionslägets möjligheter – rätta felaktigt avstavade ord med en stavningsordbok" |
| 126 |
|
| 127 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:76 |
| 128 |
msgid "" |
| 129 |
"Often, e-books created from scans of printed books contain mis-hyphenated " |
| 130 |
"words -- words that were split at the end of the line on the printed page. " |
| 131 |
"We will write a simple function to automatically find and fix such words." |
| 132 |
msgstr "E-böcker som skapats genom att skanna tryckta böcker innehåller ofta felaktigt avstavade ord – ord som delades vid radslutet på den tryckta sidan. Vi ska skriva en enkel funktion som automatiskt hittar och rättar sådana ord." |
| 133 |
|
| 134 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:101 |
| 135 |
msgid "Use this function with the same find expression as before, namely::" |
| 136 |
msgstr "Använd denna funktion med samma sökuttryck som tidigare, det vill säga::" |
| 137 |
|
| 138 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:105 |
| 139 |
msgid "" |
| 140 |
"And it will magically fix all mis-hyphenated words in the text of the book. " |
| 141 |
"The main trick is to use one of the useful extra arguments to the replace " |
| 142 |
"function, ``dictionaries``. This refers to the dictionaries the editor " |
| 143 |
"itself uses to spell check text in the book. What this function does is look" |
| 144 |
" for words separated by a hyphen, remove the hyphen and check if the " |
| 145 |
"dictionary recognizes the composite word, if it does, the original words are" |
| 146 |
" replaced by the hyphen free composite word." |
| 147 |
msgstr "Då rättas alla felaktigt avstavade ord i bokens text som genom ett trollslag. Knepet är att använda ett av de användbara extraargumenten till funktionen replace: ``dictionaries``. Det avser de ordböcker som redigeraren själv använder för att stavningskontrollera bokens text. Funktionen letar efter ord som skiljs åt av ett bindestreck, tar bort bindestrecket och kontrollerar om ordboken känner igen det sammansatta ordet. Om den gör det ersätts de ursprungliga orden med det sammansatta ordet utan bindestreck." |
| 148 |
|
| 149 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:113 |
| 150 |
msgid "" |
| 151 |
"Note that one limitation of this technique is it will only work for mono-" |
| 152 |
"lingual books, because, by default, ``dictionaries.recognized()`` uses the " |
| 153 |
"main language of the book." |
| 154 |
msgstr "Observera att en begränsning av denna teknik är att den bara fungerar för enspråkiga böcker, eftersom ``dictionaries.recognized()`` som standard använder bokens huvudspråk." |
| 155 |
|
| 156 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:119 |
| 157 |
msgid "Auto numbering sections" |
| 158 |
msgstr "Numrera avsnitt automatiskt" |
| 159 |
|
| 160 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:121 |
| 161 |
msgid "" |
| 162 |
"Now we will see something a little different. Suppose your HTML file has " |
| 163 |
"many sections, each with a heading in an :code:`<h2>` tag that looks like " |
| 164 |
":code:`<h2>Some text</h2>`. You can create a custom function that will " |
| 165 |
"automatically number these headings with consecutive section numbers, so " |
| 166 |
"that they look like :code:`<h2>1. Some text</h2>`." |
| 167 |
msgstr "Nu ska vi se något lite annorlunda. Anta att din HTML-fil har många avsnitt, vart och ett med en rubrik i en :code:`<h2>`-tagg som ser ut så här: :code:`<h2>Some text</h2>`. Du kan skapa en anpassad funktion som automatiskt numrerar dessa rubriker med avsnittsnummer i följd, så att de ser ut så här: :code:`<h2>1. Some text</h2>`." |
| 168 |
|
| 169 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:137 |
| 170 |
msgid "Use it with the find expression::" |
| 171 |
msgstr "Använd det med sökuttrycket::" |
| 172 |
|
| 173 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:141 |
| 174 |
msgid "" |
| 175 |
"Place the cursor at the top of the file and click :guilabel:`Replace all`." |
| 176 |
msgstr "Placera markören överst i filen och klicka på :guilabel:`Ersätt alla`." |
| 177 |
|
| 178 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:143 |
| 179 |
msgid "" |
| 180 |
"This function uses another of the useful extra arguments to ``replace()``: " |
| 181 |
"the ``number`` argument. When doing a :guilabel:`Replace All` number is " |
| 182 |
"automatically incremented for every successive match." |
| 183 |
msgstr "Den här funktionen använder ett annat av de användbara extraargumenten till ``replace()``: argumentet ``number``. När du kör :guilabel:`Ersätt alla` ökas numret automatiskt för varje efterföljande träff." |
| 184 |
|
| 185 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:147 |
| 186 |
msgid "" |
| 187 |
"Another new feature is the use of ``replace.file_order`` -- setting that to " |
| 188 |
"``'spine'`` means that if this search is run on multiple HTML files, the " |
| 189 |
"files are processed in the order in which they appear in the book. See " |
| 190 |
":ref:`file_order_replace_all` for details." |
| 191 |
msgstr "En annan nyhet är användningen av ``replace.file_order``. Om du anger värdet ``'spine'`` och kör sökningen på flera HTML-filer bearbetas filerna i den ordning de förekommer i boken. Se :ref:`file_order_replace_all` för detaljer." |
| 192 |
|
| 193 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:154 |
| 194 |
msgid "Auto create a Table of Contents" |
| 195 |
msgstr "Skapa automatiskt en innehållsförteckning" |
| 196 |
|
| 197 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:156 |
| 198 |
msgid "" |
| 199 |
"Finally, let's try something a little more ambitious. Suppose your book has " |
| 200 |
"headings in ``h1`` and ``h2`` tags that look like ``<h1 id=\"someid\">Some " |
| 201 |
"Text</h1>``. We will auto-generate an HTML Table of Contents based on these " |
| 202 |
"headings. Create the custom function below:" |
| 203 |
msgstr "Låt oss slutligen prova något lite mer ambitiöst. Anta att boken har rubriker i taggarna ``h1`` och ``h2`` som ser ut så här: ``<h1 id=\"someid\">Some Text</h1>``. Vi ska automatiskt skapa en HTML-innehållsförteckning utifrån dessa rubriker. Skapa den anpassade funktionen nedan:" |
| 204 |
|
| 205 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:199 |
| 206 |
msgid "And use it with the find expression::" |
| 207 |
msgstr "Och använd den med sökuttrycket::" |
| 208 |
|
| 209 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:203 |
| 210 |
msgid "" |
| 211 |
"Run the search on :guilabel:`All text files` and at the end of the search, a" |
| 212 |
" window will popup with \"Debug output from your function\" which will have " |
| 213 |
"the HTML Table of Contents, ready to be pasted into :file:`toc.html`." |
| 214 |
msgstr "Kör sökningen på :guilabel:`Alla textfiler`. När sökningen är klar visas ett fönster med felsökningsutmatningen från din funktion. Det innehåller HTML-innehållsförteckningen, färdig att klistras in i :file:`toc.html`." |
| 215 |
|
| 216 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:207 |
| 217 |
msgid "" |
| 218 |
"The function above is heavily commented, so it should be easy to follow. The" |
| 219 |
" key new feature is the use of another useful extra argument to the " |
| 220 |
"``replace()`` function, the ``data`` object. The ``data`` object is a Python" |
| 221 |
" *dictionary* that persists between all successive invocations of " |
| 222 |
"``replace()`` during a single :guilabel:`Replace All` operation." |
| 223 |
msgstr "Funktionen ovan är utförligt kommenterad och bör därför vara lätt att följa. Den viktigaste nyheten är användningen av ännu ett extraargument till funktionen ``replace()``: objektet ``data``. Objektet ``data`` är en Python-*uppslagstabell* som bevaras mellan alla efterföljande anrop av ``replace()`` under en och samma :guilabel:`Ersätt alla`-åtgärd." |
| 224 |
|
| 225 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:213 |
| 226 |
msgid "" |
| 227 |
"Another new feature is the use of ``call_after_last_match`` -- setting that " |
| 228 |
"to ``True`` on the ``replace()`` function means that the editor will call " |
| 229 |
"``replace()`` one extra time after all matches have been found. For this " |
| 230 |
"extra call, the match object will be ``None``." |
| 231 |
msgstr "En annan nyhet är användningen av ``call_after_last_match``. Om detta attribut sätts till ``True`` på funktionen ``replace()`` anropar redigeraren ``replace()`` en extra gång efter att alla träffar har hittats. Vid detta extra anrop är träffobjektet ``None``." |
| 232 |
|
| 233 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:218 |
| 234 |
msgid "" |
| 235 |
"This was just a demonstration to show you the power of function mode, if you" |
| 236 |
" really needed to generate a Table of Contents from headings in your book, " |
| 237 |
"you would be better off using the dedicated Table of Contents tool in " |
| 238 |
":guilabel:`Tools->Table of Contents`." |
| 239 |
msgstr "Det här var bara en demonstration av funktionslägets möjligheter. Om du faktiskt behöver skapa en innehållsförteckning från bokens rubriker är det bättre att använda det särskilda verktyget under :guilabel:`Verktyg->Innehållsförteckning`." |
| 240 |
|
| 241 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:224 |
| 242 |
msgid "The API for the function mode" |
| 243 |
msgstr "API för funktionsläget" |
| 244 |
|
| 245 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:226 |
| 246 |
msgid "" |
| 247 |
"All function mode functions must be Python functions named replace, with the" |
| 248 |
" following signature::" |
| 249 |
msgstr "Alla funktioner i funktionsläget måste vara Python-funktioner med namnet replace och följande signatur::" |
| 250 |
|
| 251 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:232 |
| 252 |
msgid "" |
| 253 |
"When a find/replace is run, for every match that is found, the ``replace()``" |
| 254 |
" function will be called, it must return the replacement string for that " |
| 255 |
"match. If no replacements are to be done, it should return ``match.group()``" |
| 256 |
" which is the original string. The various arguments to the ``replace()`` " |
| 257 |
"function are documented below." |
| 258 |
msgstr "När en sökning och ersättning körs anropas funktionen ``replace()`` för varje träff som hittas. Funktionen måste returnera ersättningssträngen för träffen. Om ingen ersättning ska göras ska den returnera ``match.group()``, vilket är den ursprungliga strängen. De olika argumenten till funktionen ``replace()`` dokumenteras nedan." |
| 259 |
|
| 260 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:239 |
| 261 |
msgid "The ``match`` argument" |
| 262 |
msgstr "Argumentet ``match``" |
| 263 |
|
| 264 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:241 |
| 265 |
msgid "" |
| 266 |
"The ``match`` argument represents the currently found match. It is a `Python" |
| 267 |
" Match object <https://docs.python.org/library/re.html#match-objects>`_. Its" |
| 268 |
" most useful method is ``group()`` which can be used to get the matched text" |
| 269 |
" corresponding to individual capture groups in the search regular " |
| 270 |
"expression." |
| 271 |
msgstr "Argumentet ``match`` representerar den matchning som har hittats. Det är ett `Python Match-objekt <https://docs.python.org/library/re.html#match-objects>`_. Dess mest användbara metod är ``group()``, som kan användas för att hämta den matchade text som motsvarar enskilda fångstgrupper i det reguljära sökuttrycket." |
| 272 |
|
| 273 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:248 |
| 274 |
msgid "The ``number`` argument" |
| 275 |
msgstr "Argumentet ``number``" |
| 276 |
|
| 277 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:250 |
| 278 |
msgid "" |
| 279 |
"The ``number`` argument is the number of the current match. When you run " |
| 280 |
":guilabel:`Replace All`, every successive match will cause ``replace()`` to " |
| 281 |
"be called with an increasing number. The first match has number 1." |
| 282 |
msgstr "Argumentet ``number`` är numret på den aktuella träffen. När du kör :guilabel:`Ersätt alla` anropas ``replace()`` med ett allt högre nummer för varje efterföljande träff. Den första träffen har nummer 1." |
| 283 |
|
| 284 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:255 |
| 285 |
msgid "The ``file_name`` argument" |
| 286 |
msgstr "Argumentet ``file_name``" |
| 287 |
|
| 288 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:257 |
| 289 |
msgid "" |
| 290 |
"This is the filename of the file in which the current match was found. When " |
| 291 |
"searching inside marked text, the ``file_name`` is empty. The ``file_name`` " |
| 292 |
"is in canonical form, a path relative to the root of the book, using ``/`` " |
| 293 |
"as the path separator." |
| 294 |
msgstr "Det här är filnamnet på filen där den aktuella träffen hittades. När du söker inuti markerad text är ``file_name`` tom. ``file_name`` är i kanonisk form, en relativ sökväg till roten av boken, med ``/`` som sökvägsavgränsare." |
| 295 |
|
| 296 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:263 |
| 297 |
msgid "The ``metadata`` argument" |
| 298 |
msgstr "Argumentet ``metadata``" |
| 299 |
|
| 300 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:265 |
| 301 |
msgid "" |
| 302 |
"This represents the metadata of the current book, such as title, authors, " |
| 303 |
"language, etc. It is an object of class " |
| 304 |
":class:`calibre.ebooks.metadata.book.base.Metadata`. Useful attributes " |
| 305 |
"include, ``title``, ``authors`` (a list of authors) and ``language`` (the " |
| 306 |
"language code)." |
| 307 |
msgstr "Detta representerar den aktuella bokens metadata, såsom titel, författare och språk. Det är ett objekt av klassen :class:`calibre.ebooks.metadata.book.base.Metadata`. Användbara attribut är bland annat ``title``, ``authors`` (en lista med författare) och ``language`` (språkkoden)." |
| 308 |
|
| 309 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:271 |
| 310 |
msgid "The ``dictionaries`` argument" |
| 311 |
msgstr "Argumentet ``dictionaries``" |
| 312 |
|
| 313 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:273 |
| 314 |
msgid "" |
| 315 |
"This represents the collection of dictionaries used for spell checking the " |
| 316 |
"current book. Its most useful method is ``dictionaries.recognized(word)`` " |
| 317 |
"which will return ``True`` if the passed in word is recognized by the " |
| 318 |
"dictionary for the current book's language." |
| 319 |
msgstr "Detta representerar samlingen av ordböcker som används för att stavningskontrollera den aktuella boken. Dess mest användbara metod är ``dictionaries.recognized(word)``, som returnerar ``True`` om det angivna ordet känns igen av ordboken för bokens språk." |
| 320 |
|
| 321 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:279 |
| 322 |
msgid "The ``data`` argument" |
| 323 |
msgstr "``data``-argumentet" |
| 324 |
|
| 325 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:281 |
| 326 |
msgid "" |
| 327 |
"This a simple Python ``dictionary``. When you run :guilabel:`Replace all`, " |
| 328 |
"every successive match will cause ``replace()`` to be called with the same " |
| 329 |
"``dictionary`` as data. You can thus use it to store arbitrary data between " |
| 330 |
"invocations of ``replace()`` during a :guilabel:`Replace all` operation." |
| 331 |
msgstr "Detta är en enkel uppslagstabell (``dictionary``) i Python. När du kör :guilabel:`Ersätt alla` anropas ``replace()`` för varje efterföljande träff med samma ``dictionary`` som data. Du kan därför använda den för att lagra valfria data mellan anrop av ``replace()`` under en :guilabel:`Ersätt alla`-åtgärd." |
| 332 |
|
| 333 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:288 |
| 334 |
msgid "The ``functions`` argument" |
| 335 |
msgstr "``functions``-argumentet" |
| 336 |
|
| 337 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:290 |
| 338 |
msgid "" |
| 339 |
"The ``functions`` argument gives you access to all other user defined " |
| 340 |
"functions. This is useful for code re-use. You can define utility functions " |
| 341 |
"in one place and re-use them in all your other functions. For example, " |
| 342 |
"suppose you create a function named ``My Function`` like this:" |
| 343 |
msgstr "Argumentet ``functions`` ger dig åtkomst till alla andra användardefinierade funktioner. Det är användbart för återanvändning av kod. Du kan definiera hjälpfunktioner på ett ställe och återanvända dem i alla dina andra funktioner. Anta till exempel att du skapar en funktion med namnet ``My Function`` så här:" |
| 344 |
|
| 345 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:303 |
| 346 |
msgid "" |
| 347 |
"Then, in another function, you can access the ``utility()`` function like " |
| 348 |
"this:" |
| 349 |
msgstr "I en annan funktion kan du sedan komma åt funktionen ``utility()`` så här:" |
| 350 |
|
| 351 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:311 |
| 352 |
msgid "" |
| 353 |
"You can also use the functions object to store persistent data, that can be " |
| 354 |
"re-used by other functions. For example, you could have one function that " |
| 355 |
"when run with :guilabel:`Replace All` collects some data and another " |
| 356 |
"function that uses it when it is run afterwards. Consider the following two " |
| 357 |
"functions:" |
| 358 |
msgstr "Du kan också använda objektet functions för att lagra beständiga data som kan återanvändas av andra funktioner. Du kan till exempel ha en funktion som samlar in data när den körs med :guilabel:`Ersätt alla` och en annan funktion som använder dessa data när den körs efteråt. Betrakta följande två funktioner:" |
| 359 |
|
| 360 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:331 |
| 361 |
msgid "Debugging your functions" |
| 362 |
msgstr "Felsökning av dina funktioner" |
| 363 |
|
| 364 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:333 |
| 365 |
msgid "" |
| 366 |
"You can debug the functions you create by using the standard ``print()`` " |
| 367 |
"function from Python. The output of print will be displayed in a popup " |
| 368 |
"window after the Find/replace has completed. You saw an example of using " |
| 369 |
"``print()`` to output an entire table of contents above." |
| 370 |
msgstr "Du kan felsöka funktionerna du skapar med Pythons standardfunktion ``print()``. Utmatningen från print visas i ett extrafönster när sökningen och ersättningen är klar. Ovan såg du ett exempel där ``print()`` används för att mata ut en hel innehållsförteckning." |
| 371 |
|
| 372 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:341 |
| 373 |
msgid "Choose file order when running on multiple HTML files" |
| 374 |
msgstr "Välj filordning när flera HTML-filer bearbetas" |
| 375 |
|
| 376 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:343 |
| 377 |
msgid "" |
| 378 |
"When you run a :guilabel:`Replace all` on multiple HTML files, the order in " |
| 379 |
"which the files are processed depends on what files you have open for " |
| 380 |
"editing. You can force the search to process files in the order in which " |
| 381 |
"they appear by setting the ``file_order`` attribute on your function, like " |
| 382 |
"this:" |
| 383 |
msgstr "När du kör :guilabel:`Ersätt alla` i flera HTML-filer beror filernas bearbetningsordning på vilka filer du har öppnat för redigering. Du kan tvinga sökningen att bearbeta filerna i den ordning de förekommer genom att ange attributet ``file_order`` för funktionen så här:" |
| 384 |
|
| 385 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:355 |
| 386 |
msgid "" |
| 387 |
"``file_order`` accepts two values, ``spine`` and ``spine-reverse`` which " |
| 388 |
"cause the search to process multiple files in the order they appear in the " |
| 389 |
"book, either forwards or backwards, respectively." |
| 390 |
msgstr "``file_order`` kan ha två värden: ``spine`` och ``spine-reverse``. De får sökningen att bearbeta filerna i bokens läsordning, framåt respektive bakåt." |
| 391 |
|
| 392 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:360 |
| 393 |
msgid "" |
| 394 |
"Having your function called an extra time after the last match is found" |
| 395 |
msgstr "Anropa funktionen en extra gång efter den sista träffen" |
| 396 |
|
| 397 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:362 |
| 398 |
msgid "" |
| 399 |
"Sometimes, as in the auto generate table of contents example above, it is " |
| 400 |
"useful to have your function called an extra time after the last match is " |
| 401 |
"found. You can do this by setting the ``call_after_last_match`` attribute on" |
| 402 |
" your function, like this:" |
| 403 |
msgstr "Ibland är det användbart att anropa funktionen en extra gång efter att den sista träffen har hittats, som i exemplet ovan där en innehållsförteckning skapas automatiskt. Du kan göra detta genom att ange attributet ``call_after_last_match`` för funktionen så här:" |
| 404 |
|
| 405 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:376 |
| 406 |
msgid "Appending the output from the function to marked text" |
| 407 |
msgstr "Lägg till funktionens utmatning sist i den markerade texten" |
| 408 |
|
| 409 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:378 |
| 410 |
msgid "" |
| 411 |
"When running search and replace on marked text, it is sometimes useful to " |
| 412 |
"append some text to the end of the marked text. You can do that by setting " |
| 413 |
"the ``append_final_output_to_marked`` attribute on your function (note that " |
| 414 |
"you also need to set ``call_after_last_match``), like this:" |
| 415 |
msgstr "När du kör sök och ersätt på markerad text kan det ibland vara praktiskt att lägga till text i slutet av den markerade texten. Det kan du göra genom att ange attributet ``append_final_output_to_marked`` för funktionen (observera att du även måste ange ``call_after_last_match``) så här:" |
| 416 |
|
| 417 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:393 |
| 418 |
msgid "Suppressing the result dialog when performing searches on marked text" |
| 419 |
msgstr "Undertryck resultatdialogrutan vid sökning i markerad text" |
| 420 |
|
| 421 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:395 |
| 422 |
msgid "" |
| 423 |
"You can also suppress the result dialog (which can slow down the repeated " |
| 424 |
"application of a search/replace on many blocks of text) by setting the " |
| 425 |
"``suppress_result_dialog`` attribute on your function, like this:" |
| 426 |
msgstr "Du kan också undertrycka resultatdialogrutan, som kan sakta ner upprepade sökningar och ersättningar i många textblock, genom att ange attributet ``suppress_result_dialog`` för funktionen så här:" |
| 427 |
|
| 428 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:408 |
| 429 |
msgid "More examples" |
| 430 |
msgstr "Fler exempel" |
| 431 |
|
| 432 |
#: ../../../__w/calibre/calibre/manual/function_mode.rst:410 |
| 433 |
msgid "" |
| 434 |
"More useful examples, contributed by calibre users, can be found in the " |
| 435 |
"`calibre E-book editor forum " |
| 436 |
"<https://www.mobileread.com/forums/showthread.php?t=237181>`_." |
| 437 |
msgstr "Fler användbara exempel från calibre-användare finns i `forumet för calibres e-bokredigerare <https://www.mobileread.com/forums/showthread.php?t=237181>`_." |