# SOME DESCRIPTIVE TITLE. # Copyright (C) Kovid Goyal # This file is distributed under the same license as the calibre package. # # Translators: # efef6ec5b435a041fce803c7f8af77d2_2341d43, 2017 # Jonatan Nyberg, 2026 # Jonatan Nyberg, 2016-2017,2021-2022 # Jonatan Nyberg, 2019-2021 # efef6ec5b435a041fce803c7f8af77d2_2341d43, 2017 # Jonatan Nyberg, 2026 # Merarom , 2014-2015 msgid "" msgstr "" "Project-Id-Version: calibre\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-16 15:05+0000\n" "PO-Revision-Date: 2014-06-17 08:35+0000\n" "Last-Translator: Jonatan Nyberg, 2026\n" "Language-Team: Swedish (http://app.transifex.com/calibre/calibre/language/sv/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: sv\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../../../__w/calibre/calibre/manual/xpath.rst:4 msgid "XPath tutorial" msgstr "XPath-introduktion" #: ../../../__w/calibre/calibre/manual/xpath.rst:6 msgid "" "In this tutorial, you will be given a gentle introduction to `XPath " "`_, a query language that can be used " "to select arbitrary parts of `HTML `_ " "documents in calibre. XPath is a widely used standard, and googling it will " "yield a ton of information. This tutorial, however, focuses on using XPath " "for e-book related tasks like finding chapter headings in an unstructured " "HTML document." msgstr "I den här handledningen får du en lättillgänglig introduktion till `XPath `_, ett frågespråk som kan användas för att välja valfria delar av `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." #: ../../../__w/calibre/calibre/manual/xpath.rst:16 msgid "Contents" msgstr "Innehåll" #: ../../../__w/calibre/calibre/manual/xpath.rst:19 msgid "Selecting by tag name" msgstr "Välja efter taggnamn" #: ../../../__w/calibre/calibre/manual/xpath.rst:21 msgid "" "The simplest form of selection is to select tags by name. For example, " "suppose you want to select all the ``

`` tags in a document. The XPath " "query for this is simply::" msgstr "Det enklaste är att välja taggar efter namn. Anta till exempel att du vill välja alla ``

``-taggar i ett dokument. XPath-uttrycket är då helt enkelt::" #: ../../../__w/calibre/calibre/manual/xpath.rst:27 msgid "" "The prefix `//` means *search at any level of the document*. Now suppose you" " want to search for ```` tags that are inside ```` tags. That can " "be achieved with::" msgstr "Prefixet `//` betyder *sök på valfri nivå i dokumentet*. Anta nu att du vill söka efter ````-taggar som finns inuti ````-taggar. Det kan göras med::" #: ../../../__w/calibre/calibre/manual/xpath.rst:33 msgid "" "If you want to search for tags at a particular level in the document, change" " the prefix::" msgstr "Om du vill söka efter taggar på en viss nivå i dokumentet ändrar du prefixet::" #: ../../../__w/calibre/calibre/manual/xpath.rst:39 msgid "" "This will match only ``

A very short e-book to demonstrate the use of " "XPath.

`` in the :ref:`sample_ebook` but not any of the other ``

`` " "tags. The ``h:`` prefix in the above examples is needed to match XHTML tags." " This is because internally, calibre represents all content as XHTML. In " "XHTML tags have a *namespace*, and ``h:`` is the namespace prefix for HTML " "tags." msgstr "Detta matchar endast ``

A very short e-book to demonstrate the use of XPath.

`` i :ref:`sample_ebook`, inte någon av de andra ``

``-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." #: ../../../__w/calibre/calibre/manual/xpath.rst:45 msgid "" "Now suppose you want to select both ``

`` and ``

`` tags. To do that, " "we need an XPath construct called *predicate*. A :dfn:`predicate` is simply " "a test that is used to select tags. Tests can be arbitrarily powerful and as" " this tutorial progresses, you will see more powerful examples. A predicate " "is created by enclosing the test expression in square brackets::" msgstr "Anta nu att du vill välja både ``

``- och ``

``-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::" #: ../../../__w/calibre/calibre/manual/xpath.rst:53 msgid "" "There are several new features in this XPath expression. The first is the " "use of the wildcard ``*``. It means *match any tag*. Now look at the test " "expression ``name()='h1' or name()='h2'``. :term:`name()` is an example of a" " *built-in function*. It simply evaluates to the name of the tag. So by " "using it, we can select tags whose names are either `h1` or `h2`. Note that " "the :term:`name()` function ignores namespaces so that there is no need for " "the ``h:`` prefix. XPath has several useful built-in functions. A few more " "will be introduced in this tutorial." 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." #: ../../../__w/calibre/calibre/manual/xpath.rst:62 msgid "Selecting by attributes" msgstr "Välja efter attribut" #: ../../../__w/calibre/calibre/manual/xpath.rst:64 msgid "" "To select tags based on their attributes, the use of predicates is " "required::" msgstr "För att välja taggar utifrån deras attribut krävs predikat::" #: ../../../__w/calibre/calibre/manual/xpath.rst:70 msgid "" "Here, the ``@`` operator refers to the attributes of the tag. You can use " "some of the `XPath built-in functions`_ to perform more sophisticated " "matching on attribute values." 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." #: ../../../__w/calibre/calibre/manual/xpath.rst:75 msgid "" "When XPath expressions are used for conversion options such as chapter " "detection or the start reading at position, they are evaluated against the " "*input* document, before calibre flattens the CSS. CSS flattening rewrites " "class names, so the class names you see in the converted output (things like" " ``calibre1``) do not exist yet when your expression runs. Copy class names " "from the input document, not from the converted book. If in doubt, match on " "tag names and text content instead, as these are not changed by the " "conversion." msgstr "" #: ../../../__w/calibre/calibre/manual/xpath.rst:86 msgid "Selecting by tag content" msgstr "Välja efter tagginnehåll" #: ../../../__w/calibre/calibre/manual/xpath.rst:88 msgid "" "Using XPath, you can even select tags based on the text they contain. The " "best way to do this is to use the power of *regular expressions* via the " "built-in function :term:`re:test()`::" 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()`::" #: ../../../__w/calibre/calibre/manual/xpath.rst:94 msgid "" "Here the ``.`` operator refers to the contents of the tag, just as the ``@``" " operator referred to its attributes." msgstr "Här hänvisar ``.``-operatören till innehållet i taggen, precis som ``@``-operatören avser dess attribut." #: ../../../__w/calibre/calibre/manual/xpath.rst:100 msgid "Sample e-book" msgstr "Exempel-e-bok" #: ../../../__w/calibre/calibre/manual/xpath.rst:106 msgid "XPath built-in functions" msgstr "XPaths inbyggda funktioner" #: ../../../__w/calibre/calibre/manual/xpath.rst:109 msgid "name()" msgstr "name()" #: ../../../__w/calibre/calibre/manual/xpath.rst:111 msgid "The name of the current tag." msgstr "Namnet på den aktuella taggen." #: ../../../__w/calibre/calibre/manual/xpath.rst:112 msgid "contains()" msgstr "contains()" #: ../../../__w/calibre/calibre/manual/xpath.rst:114 msgid "``contains(s1, s2)`` returns `true` if s1 contains s2." msgstr "``contains(s1, s2)`` returnerar `true` om s1 innehåller s2." #: ../../../__w/calibre/calibre/manual/xpath.rst:115 msgid "re:test()" msgstr "re:test()" #: ../../../__w/calibre/calibre/manual/xpath.rst:117 msgid "" "``re:test(src, pattern, flags)`` returns `true` if the string `src` matches " "the regular expression `pattern`. A particularly useful flag is ``i``, it " "makes matching case insensitive. A good primer on the syntax for regular " "expressions can be found at `regexp syntax " "`_" 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 `_."