| 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, 2017 |
| 7 |
# Jonatan Nyberg, 2026 |
| 8 |
# Jonatan Nyberg, 2016-2017,2021-2022 |
| 9 |
# Jonatan Nyberg, 2019-2021 |
| 10 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2017 |
| 11 |
# Jonatan Nyberg, 2026 |
| 12 |
# Merarom <[email protected]>, 2014-2015 |
| 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-06-17 08:35+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/xpath.rst:4 |
| 28 |
msgid "XPath tutorial" |
| 29 |
msgstr "XPath-introduktion" |
| 30 |
|
| 31 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:6 |
| 32 |
msgid "" |
| 33 |
"In this tutorial, you will be given a gentle introduction to `XPath " |
| 34 |
"<https://en.wikipedia.org/wiki/XPath>`_, a query language that can be used " |
| 35 |
"to select arbitrary parts of `HTML <https://en.wikipedia.org/wiki/HTML>`_ " |
| 36 |
"documents in calibre. XPath is a widely used standard, and googling it will " |
| 37 |
"yield a ton of information. This tutorial, however, focuses on using XPath " |
| 38 |
"for e-book related tasks like finding chapter headings in an unstructured " |
| 39 |
"HTML document." |
| 40 |
msgstr "I den här handledningen får du en lättillgänglig introduktion till `XPath <https://en.wikipedia.org/wiki/XPath>`_, ett frågespråk som kan användas för att välja valfria delar av `HTML <https://en.wikipedia.org/wiki/HTML>`_-dokument i calibre. XPath är en etablerad standard och det finns mycket information om språket på internet. Den här handledningen fokuserar på hur XPath används för e-boksrelaterade uppgifter, till exempel för att hitta kapitelrubriker i ett ostrukturerat HTML-dokument." |
| 41 |
|
| 42 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:16 |
| 43 |
msgid "Contents" |
| 44 |
msgstr "Innehåll" |
| 45 |
|
| 46 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:19 |
| 47 |
msgid "Selecting by tag name" |
| 48 |
msgstr "Välja efter taggnamn" |
| 49 |
|
| 50 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:21 |
| 51 |
msgid "" |
| 52 |
"The simplest form of selection is to select tags by name. For example, " |
| 53 |
"suppose you want to select all the ``<h2>`` tags in a document. The XPath " |
| 54 |
"query for this is simply::" |
| 55 |
msgstr "Det enklaste är att välja taggar efter namn. Anta till exempel att du vill välja alla ``<h2>``-taggar i ett dokument. XPath-uttrycket är då helt enkelt::" |
| 56 |
|
| 57 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:27 |
| 58 |
msgid "" |
| 59 |
"The prefix `//` means *search at any level of the document*. Now suppose you" |
| 60 |
" want to search for ``<span>`` tags that are inside ``<a>`` tags. That can " |
| 61 |
"be achieved with::" |
| 62 |
msgstr "Prefixet `//` betyder *sök på valfri nivå i dokumentet*. Anta nu att du vill söka efter ``<span>``-taggar som finns inuti ``<a>``-taggar. Det kan göras med::" |
| 63 |
|
| 64 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:33 |
| 65 |
msgid "" |
| 66 |
"If you want to search for tags at a particular level in the document, change" |
| 67 |
" the prefix::" |
| 68 |
msgstr "Om du vill söka efter taggar på en viss nivå i dokumentet ändrar du prefixet::" |
| 69 |
|
| 70 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:39 |
| 71 |
msgid "" |
| 72 |
"This will match only ``<p>A very short e-book to demonstrate the use of " |
| 73 |
"XPath.</p>`` in the :ref:`sample_ebook` but not any of the other ``<p>`` " |
| 74 |
"tags. The ``h:`` prefix in the above examples is needed to match XHTML tags." |
| 75 |
" This is because internally, calibre represents all content as XHTML. In " |
| 76 |
"XHTML tags have a *namespace*, and ``h:`` is the namespace prefix for HTML " |
| 77 |
"tags." |
| 78 |
msgstr "Detta matchar endast ``<p>A very short e-book to demonstrate the use of XPath.</p>`` i :ref:`sample_ebook`, inte någon av de andra ``<p>``-taggarna. Prefixet ``h:`` i exemplen ovan krävs för att matcha XHTML-taggar. Det beror på att calibre internt representerar allt innehåll som XHTML. I XHTML tillhör taggar en *namnrymd*, och ``h:`` är namnrymdsprefixet för HTML-taggar." |
| 79 |
|
| 80 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:45 |
| 81 |
msgid "" |
| 82 |
"Now suppose you want to select both ``<h1>`` and ``<h2>`` tags. To do that, " |
| 83 |
"we need an XPath construct called *predicate*. A :dfn:`predicate` is simply " |
| 84 |
"a test that is used to select tags. Tests can be arbitrarily powerful and as" |
| 85 |
" this tutorial progresses, you will see more powerful examples. A predicate " |
| 86 |
"is created by enclosing the test expression in square brackets::" |
| 87 |
msgstr "Anta nu att du vill välja både ``<h1>``- och ``<h2>``-taggar. Då behöver vi en XPath-konstruktion som kallas *predikat*. Ett :dfn:`predikat` är ett villkor som används för att välja taggar. Villkoren kan vara godtyckligt avancerade, och längre fram i handledningen visas kraftfullare exempel. Ett predikat skapas genom att omge villkorsuttrycket med hakparenteser::" |
| 88 |
|
| 89 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:53 |
| 90 |
msgid "" |
| 91 |
"There are several new features in this XPath expression. The first is the " |
| 92 |
"use of the wildcard ``*``. It means *match any tag*. Now look at the test " |
| 93 |
"expression ``name()='h1' or name()='h2'``. :term:`name()` is an example of a" |
| 94 |
" *built-in function*. It simply evaluates to the name of the tag. So by " |
| 95 |
"using it, we can select tags whose names are either `h1` or `h2`. Note that " |
| 96 |
"the :term:`name()` function ignores namespaces so that there is no need for " |
| 97 |
"the ``h:`` prefix. XPath has several useful built-in functions. A few more " |
| 98 |
"will be introduced in this tutorial." |
| 99 |
msgstr "Det finns flera nya delar i XPath-uttrycket. Den första är jokertecknet ``*``, som betyder *matcha valfri tagg*. Titta sedan på villkorsuttrycket ``name()='h1' or name()='h2'``. :term:`name()` är en *inbyggd funktion* som returnerar taggens namn. Med den kan vi välja taggar vars namn är antingen `h1` eller `h2`. Funktionen :term:`name()` ignorerar namnrymder, så prefixet ``h:`` behövs inte. XPath har flera användbara inbyggda funktioner. Några fler presenteras i den här handledningen." |
| 100 |
|
| 101 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:62 |
| 102 |
msgid "Selecting by attributes" |
| 103 |
msgstr "Välja efter attribut" |
| 104 |
|
| 105 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:64 |
| 106 |
msgid "" |
| 107 |
"To select tags based on their attributes, the use of predicates is " |
| 108 |
"required::" |
| 109 |
msgstr "För att välja taggar utifrån deras attribut krävs predikat::" |
| 110 |
|
| 111 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:70 |
| 112 |
msgid "" |
| 113 |
"Here, the ``@`` operator refers to the attributes of the tag. You can use " |
| 114 |
"some of the `XPath built-in functions`_ to perform more sophisticated " |
| 115 |
"matching on attribute values." |
| 116 |
msgstr "Här hänvisar operatorn ``@`` till taggens attribut. Du kan använda några av `XPaths inbyggda funktioner`_ för att göra mer avancerade matchningar av attributvärden." |
| 117 |
|
| 118 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:75 |
| 119 |
msgid "" |
| 120 |
"When XPath expressions are used for conversion options such as chapter " |
| 121 |
"detection or the start reading at position, they are evaluated against the " |
| 122 |
"*input* document, before calibre flattens the CSS. CSS flattening rewrites " |
| 123 |
"class names, so the class names you see in the converted output (things like" |
| 124 |
" ``calibre1``) do not exist yet when your expression runs. Copy class names " |
| 125 |
"from the input document, not from the converted book. If in doubt, match on " |
| 126 |
"tag names and text content instead, as these are not changed by the " |
| 127 |
"conversion." |
| 128 |
msgstr "" |
| 129 |
|
| 130 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:86 |
| 131 |
msgid "Selecting by tag content" |
| 132 |
msgstr "Välja efter tagginnehåll" |
| 133 |
|
| 134 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:88 |
| 135 |
msgid "" |
| 136 |
"Using XPath, you can even select tags based on the text they contain. The " |
| 137 |
"best way to do this is to use the power of *regular expressions* via the " |
| 138 |
"built-in function :term:`re:test()`::" |
| 139 |
msgstr "Med XPath kan du även välja taggar utifrån den text de innehåller. Det bästa sättet är att använda *reguljära uttryck* via den inbyggda funktionen :term:`re:test()`::" |
| 140 |
|
| 141 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:94 |
| 142 |
msgid "" |
| 143 |
"Here the ``.`` operator refers to the contents of the tag, just as the ``@``" |
| 144 |
" operator referred to its attributes." |
| 145 |
msgstr "Här hänvisar ``.``-operatören till innehållet i taggen, precis som ``@``-operatören avser dess attribut." |
| 146 |
|
| 147 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:100 |
| 148 |
msgid "Sample e-book" |
| 149 |
msgstr "Exempel-e-bok" |
| 150 |
|
| 151 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:106 |
| 152 |
msgid "XPath built-in functions" |
| 153 |
msgstr "XPaths inbyggda funktioner" |
| 154 |
|
| 155 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:109 |
| 156 |
msgid "name()" |
| 157 |
msgstr "name()" |
| 158 |
|
| 159 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:111 |
| 160 |
msgid "The name of the current tag." |
| 161 |
msgstr "Namnet på den aktuella taggen." |
| 162 |
|
| 163 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:112 |
| 164 |
msgid "contains()" |
| 165 |
msgstr "contains()" |
| 166 |
|
| 167 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:114 |
| 168 |
msgid "``contains(s1, s2)`` returns `true` if s1 contains s2." |
| 169 |
msgstr "``contains(s1, s2)`` returnerar `true` om s1 innehåller s2." |
| 170 |
|
| 171 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:115 |
| 172 |
msgid "re:test()" |
| 173 |
msgstr "re:test()" |
| 174 |
|
| 175 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:117 |
| 176 |
msgid "" |
| 177 |
"``re:test(src, pattern, flags)`` returns `true` if the string `src` matches " |
| 178 |
"the regular expression `pattern`. A particularly useful flag is ``i``, it " |
| 179 |
"makes matching case insensitive. A good primer on the syntax for regular " |
| 180 |
"expressions can be found at `regexp syntax " |
| 181 |
"<https://docs.python.org/library/re.html>`_" |
| 182 |
msgstr "``re:test(src, pattern, flags)`` returnerar `true` om strängen `src` matchar det reguljära uttrycket `pattern`. En särskilt användbar flagga är ``i``, som gör matchningen skiftlägesokänslig. En bra introduktion till syntaxen finns i `Python-dokumentationen <https://docs.python.org/library/re.html>`_." |