Debian Codegraph @

translations/manual/xpath.pot

raw
1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) Kovid Goyal
3 # This file is distributed under the same license as the calibre package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: calibre 9.14.0\n"
10 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2026-08-28 07:17+0530\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <[email protected]>\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #: ../../../home/kovid/work/calibre/manual/xpath.rst:4
20 msgid "XPath tutorial"
21 msgstr ""
22
23 #: ../../../home/kovid/work/calibre/manual/xpath.rst:6
24 msgid "In this tutorial, you will be given a gentle introduction to `XPath <https://en.wikipedia.org/wiki/XPath>`_, a query language that can be used to select arbitrary parts of `HTML <https://en.wikipedia.org/wiki/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."
25 msgstr ""
26
27 #: ../../../home/kovid/work/calibre/manual/xpath.rst:16
28 msgid "Contents"
29 msgstr ""
30
31 #: ../../../home/kovid/work/calibre/manual/xpath.rst:19
32 msgid "Selecting by tag name"
33 msgstr ""
34
35 #: ../../../home/kovid/work/calibre/manual/xpath.rst:21
36 msgid "The simplest form of selection is to select tags by name. For example, suppose you want to select all the ``<h2>`` tags in a document. The XPath query for this is simply::"
37 msgstr ""
38
39 #: ../../../home/kovid/work/calibre/manual/xpath.rst:27
40 msgid "The prefix `//` means *search at any level of the document*. Now suppose you want to search for ``<span>`` tags that are inside ``<a>`` tags. That can be achieved with::"
41 msgstr ""
42
43 #: ../../../home/kovid/work/calibre/manual/xpath.rst:33
44 msgid "If you want to search for tags at a particular level in the document, change the prefix::"
45 msgstr ""
46
47 #: ../../../home/kovid/work/calibre/manual/xpath.rst:39
48 msgid "This will match only ``<p>A very short e-book to demonstrate the use of XPath.</p>`` in the :ref:`sample_ebook` but not any of the other ``<p>`` 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."
49 msgstr ""
50
51 #: ../../../home/kovid/work/calibre/manual/xpath.rst:45
52 msgid "Now suppose you want to select both ``<h1>`` and ``<h2>`` 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::"
53 msgstr ""
54
55 #: ../../../home/kovid/work/calibre/manual/xpath.rst:53
56 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."
57 msgstr ""
58
59 #: ../../../home/kovid/work/calibre/manual/xpath.rst:62
60 msgid "Selecting by attributes"
61 msgstr ""
62
63 #: ../../../home/kovid/work/calibre/manual/xpath.rst:64
64 msgid "To select tags based on their attributes, the use of predicates is required::"
65 msgstr ""
66
67 #: ../../../home/kovid/work/calibre/manual/xpath.rst:70
68 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."
69 msgstr ""
70
71 #: ../../../home/kovid/work/calibre/manual/xpath.rst:76
72 msgid "Selecting by tag content"
73 msgstr ""
74
75 #: ../../../home/kovid/work/calibre/manual/xpath.rst:78
76 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()`::"
77 msgstr ""
78
79 #: ../../../home/kovid/work/calibre/manual/xpath.rst:84
80 msgid "Here the ``.`` operator refers to the contents of the tag, just as the ``@`` operator referred to its attributes."
81 msgstr ""
82
83 #: ../../../home/kovid/work/calibre/manual/xpath.rst:90
84 msgid "Sample e-book"
85 msgstr ""
86
87 #: ../../../home/kovid/work/calibre/manual/xpath.rst:96
88 msgid "XPath built-in functions"
89 msgstr ""
90
91 #: ../../../home/kovid/work/calibre/manual/xpath.rst:99
92 msgid "name()"
93 msgstr ""
94
95 #: ../../../home/kovid/work/calibre/manual/xpath.rst:101
96 msgid "The name of the current tag."
97 msgstr ""
98
99 #: ../../../home/kovid/work/calibre/manual/xpath.rst:102
100 msgid "contains()"
101 msgstr ""
102
103 #: ../../../home/kovid/work/calibre/manual/xpath.rst:104
104 msgid "``contains(s1, s2)`` returns `true` if s1 contains s2."
105 msgstr ""
106
107 #: ../../../home/kovid/work/calibre/manual/xpath.rst:105
108 msgid "re:test()"
109 msgstr ""
110
111 #: ../../../home/kovid/work/calibre/manual/xpath.rst:107
112 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 <https://docs.python.org/library/re.html>`_"
113 msgstr ""