| 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 |
# akihiko tanae (tanaeakihiko), 2025-2026 |
| 7 |
# Asakura, 2015 |
| 8 |
# Asakura, 2015 |
| 9 |
# toshi oota <[email protected]>, 2021 |
| 10 |
msgid "" |
| 11 |
msgstr "" |
| 12 |
"Project-Id-Version: calibre\n" |
| 13 |
"Report-Msgid-Bugs-To: \n" |
| 14 |
"POT-Creation-Date: 2026-09-16 15:05+0000\n" |
| 15 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 16 |
"Last-Translator: akihiko tanae (tanaeakihiko), 2025-2026\n" |
| 17 |
"Language-Team: Japanese (http://app.transifex.com/calibre/calibre/language/ja/)\n" |
| 18 |
"MIME-Version: 1.0\n" |
| 19 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 20 |
"Content-Transfer-Encoding: 8bit\n" |
| 21 |
"Language: ja\n" |
| 22 |
"Plural-Forms: nplurals=1; plural=0;\n" |
| 23 |
|
| 24 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:4 |
| 25 |
msgid "XPath tutorial" |
| 26 |
msgstr "XPath のチュートリアル" |
| 27 |
|
| 28 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:6 |
| 29 |
msgid "" |
| 30 |
"In this tutorial, you will be given a gentle introduction to `XPath " |
| 31 |
"<https://en.wikipedia.org/wiki/XPath>`_, a query language that can be used " |
| 32 |
"to select arbitrary parts of `HTML <https://en.wikipedia.org/wiki/HTML>`_ " |
| 33 |
"documents in calibre. XPath is a widely used standard, and googling it will " |
| 34 |
"yield a ton of information. This tutorial, however, focuses on using XPath " |
| 35 |
"for e-book related tasks like finding chapter headings in an unstructured " |
| 36 |
"HTML document." |
| 37 |
msgstr "このチュートリアルでは、 calibre の `HTML <https://en.wikipedia.org/wiki/HTML>`_ ドキュメントの中から任意の部分を選択するために利用できる `XPath <https://en.wikipedia.org/wiki/XPath>`_ というクエリ言語に関して軽く紹介します。XPath は広く使用されている標準で、Google などで検索すると山ほどの情報が出てきます。しかしこのチュートリアルでは、構造化されていない HTML ドキュメントの中から章見出しを探す方法のような、電子書籍に特化した XPath の利用法に焦点を当てています。" |
| 38 |
|
| 39 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:16 |
| 40 |
msgid "Contents" |
| 41 |
msgstr "目次" |
| 42 |
|
| 43 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:19 |
| 44 |
msgid "Selecting by tag name" |
| 45 |
msgstr "タグ名で選択" |
| 46 |
|
| 47 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:21 |
| 48 |
msgid "" |
| 49 |
"The simplest form of selection is to select tags by name. For example, " |
| 50 |
"suppose you want to select all the ``<h2>`` tags in a document. The XPath " |
| 51 |
"query for this is simply::" |
| 52 |
msgstr "選択の一番簡単な方法はタグを名前で選択することです。たとえば、ドキュメント内のすべての ``<h2>`` を選択したいとしましょう。そのための XPath は次のようにすればよいのです::" |
| 53 |
|
| 54 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:27 |
| 55 |
msgid "" |
| 56 |
"The prefix `//` means *search at any level of the document*. Now suppose you" |
| 57 |
" want to search for ``<span>`` tags that are inside ``<a>`` tags. That can " |
| 58 |
"be achieved with::" |
| 59 |
msgstr "プリフィックス `//` は *ドキュメント内の任意のレベルの検索* を意味します。``<a>`` タグの中にある ``<span>`` タグを検索したいとしましょう。これを実現するには、次のようにします::" |
| 60 |
|
| 61 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:33 |
| 62 |
msgid "" |
| 63 |
"If you want to search for tags at a particular level in the document, change" |
| 64 |
" the prefix::" |
| 65 |
msgstr "ドキュメント内のある特定のレベルのタグを検索したい場合には、プリフィックスを変更します::" |
| 66 |
|
| 67 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:39 |
| 68 |
msgid "" |
| 69 |
"This will match only ``<p>A very short e-book to demonstrate the use of " |
| 70 |
"XPath.</p>`` in the :ref:`sample_ebook` but not any of the other ``<p>`` " |
| 71 |
"tags. The ``h:`` prefix in the above examples is needed to match XHTML tags." |
| 72 |
" This is because internally, calibre represents all content as XHTML. In " |
| 73 |
"XHTML tags have a *namespace*, and ``h:`` is the namespace prefix for HTML " |
| 74 |
"tags." |
| 75 |
msgstr "これは :ref:`sample_ebook` の中にある ``<p>XPath の使用を実演してみせるための非常に短い電子書籍です。</p>`` にのみマッチして、他の ``<p>`` タグ内のものにはマッチしません。上記の例では XHTML タグにマッチさせるために ``h:`` プリフィックスが必要です。なぜなら calibre は内部的にはすべてのコンテンツを XHTML で表現しているためです。XHTML においてタグには *名前空間が* 存在し、``h:`` が HTML タグの名前空間プレフィックスです。" |
| 76 |
|
| 77 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:45 |
| 78 |
msgid "" |
| 79 |
"Now suppose you want to select both ``<h1>`` and ``<h2>`` tags. To do that, " |
| 80 |
"we need an XPath construct called *predicate*. A :dfn:`predicate` is simply " |
| 81 |
"a test that is used to select tags. Tests can be arbitrarily powerful and as" |
| 82 |
" this tutorial progresses, you will see more powerful examples. A predicate " |
| 83 |
"is created by enclosing the test expression in square brackets::" |
| 84 |
msgstr "では ``<h1>`` と ``<h2>`` タブの両方を選択したいとしましょう。これをするには *述語* と呼ばれる XPath の構造体が必要になります。:dfn:`述語` とはタグの選択に使用される単なるテストです。テストは自ずと強力であり、チュートリアルを進めるにつれて、より強力な使用例を目にするでしょう。述語はテストの式を角カッコで囲むことで作成します::" |
| 85 |
|
| 86 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:53 |
| 87 |
msgid "" |
| 88 |
"There are several new features in this XPath expression. The first is the " |
| 89 |
"use of the wildcard ``*``. It means *match any tag*. Now look at the test " |
| 90 |
"expression ``name()='h1' or name()='h2'``. :term:`name()` is an example of a" |
| 91 |
" *built-in function*. It simply evaluates to the name of the tag. So by " |
| 92 |
"using it, we can select tags whose names are either `h1` or `h2`. Note that " |
| 93 |
"the :term:`name()` function ignores namespaces so that there is no need for " |
| 94 |
"the ``h:`` prefix. XPath has several useful built-in functions. A few more " |
| 95 |
"will be introduced in this tutorial." |
| 96 |
msgstr "この XPath 式にはいくつかの新しい機能があります。ひとつはワイルドカード ``*`` の使用です。これは *すべてのタグにマッチ* することを意味します。では、テスト式 ``name()='h1' or name()='h2'`` を見てみましょう。:term:`name()` は *ビルトイン関数* の例です。これは単にタグの名前を評価します。したがってこれを使用することで、名前が `h1` または `h2` であるタグを選択できます。:term:`name()` は名前空間を無視するため、``h:`` プリフィックスは必要ありません。XPath にはいくつもの便利なビルトイン関数があります。このチュートリアルの中で、さらにいくつか紹介します。" |
| 97 |
|
| 98 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:62 |
| 99 |
msgid "Selecting by attributes" |
| 100 |
msgstr "属性で選択" |
| 101 |
|
| 102 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:64 |
| 103 |
msgid "" |
| 104 |
"To select tags based on their attributes, the use of predicates is " |
| 105 |
"required::" |
| 106 |
msgstr "属性に基づいてタグを選択するには、述語を使用する必要があります::" |
| 107 |
|
| 108 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:70 |
| 109 |
msgid "" |
| 110 |
"Here, the ``@`` operator refers to the attributes of the tag. You can use " |
| 111 |
"some of the `XPath built-in functions`_ to perform more sophisticated " |
| 112 |
"matching on attribute values." |
| 113 |
msgstr "ここでは ``@` 演算子がタグの属性を参照します。`XPath ビルトイン関数`_ を使用すれば、属性値に対してさらに高度な比較を行うことができます。" |
| 114 |
|
| 115 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:75 |
| 116 |
msgid "" |
| 117 |
"When XPath expressions are used for conversion options such as chapter " |
| 118 |
"detection or the start reading at position, they are evaluated against the " |
| 119 |
"*input* document, before calibre flattens the CSS. CSS flattening rewrites " |
| 120 |
"class names, so the class names you see in the converted output (things like" |
| 121 |
" ``calibre1``) do not exist yet when your expression runs. Copy class names " |
| 122 |
"from the input document, not from the converted book. If in doubt, match on " |
| 123 |
"tag names and text content instead, as these are not changed by the " |
| 124 |
"conversion." |
| 125 |
msgstr "章の検出や読み始め位置の指定といった変換オプションでXPath式を使用する場合、それらはcalibreがCSSをフラット化(統合・単純化)する前の *入力* ドキュメントに対して評価されます。CSSのフラット化によってクラス名が書き換えられるため、変換後の出力で見られるクラス名( ```calibre1``` など)は、XPath式が実行される時点ではまだ存在しません。したがって、変換後の電子書籍からではなく、入力ドキュメントからクラス名をコピーするようにしてください。判断に迷う場合は、変換によって変更されないタグ名やテキスト内容を条件に指定するとよいでしょう。" |
| 126 |
|
| 127 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:86 |
| 128 |
msgid "Selecting by tag content" |
| 129 |
msgstr "タグの内容で選択" |
| 130 |
|
| 131 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:88 |
| 132 |
msgid "" |
| 133 |
"Using XPath, you can even select tags based on the text they contain. The " |
| 134 |
"best way to do this is to use the power of *regular expressions* via the " |
| 135 |
"built-in function :term:`re:test()`::" |
| 136 |
msgstr "XPath を使えば、タグに含まれているテキストに基づいてタグを選択することもできます。これを行うのに一番よいのは、ビルトイン関数 :term:`re:test()` を通じて正規表現の力を利用することです::" |
| 137 |
|
| 138 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:94 |
| 139 |
msgid "" |
| 140 |
"Here the ``.`` operator refers to the contents of the tag, just as the ``@``" |
| 141 |
" operator referred to its attributes." |
| 142 |
msgstr "ここでは ``@`` 演算子が属性を参照するのと同様に、``.`` 演算子がタグの内容を参照します。" |
| 143 |
|
| 144 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:100 |
| 145 |
msgid "Sample e-book" |
| 146 |
msgstr "サンプル電子書籍" |
| 147 |
|
| 148 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:106 |
| 149 |
msgid "XPath built-in functions" |
| 150 |
msgstr "XPath ビルトイン関数" |
| 151 |
|
| 152 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:109 |
| 153 |
msgid "name()" |
| 154 |
msgstr "name()" |
| 155 |
|
| 156 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:111 |
| 157 |
msgid "The name of the current tag." |
| 158 |
msgstr "現在のタグの名前" |
| 159 |
|
| 160 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:112 |
| 161 |
msgid "contains()" |
| 162 |
msgstr "contains()" |
| 163 |
|
| 164 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:114 |
| 165 |
msgid "``contains(s1, s2)`` returns `true` if s1 contains s2." |
| 166 |
msgstr "``contains(s1, s2)`` は s1 に s2 が含まれているときに `true` を返します。" |
| 167 |
|
| 168 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:115 |
| 169 |
msgid "re:test()" |
| 170 |
msgstr "re:test()" |
| 171 |
|
| 172 |
#: ../../../__w/calibre/calibre/manual/xpath.rst:117 |
| 173 |
msgid "" |
| 174 |
"``re:test(src, pattern, flags)`` returns `true` if the string `src` matches " |
| 175 |
"the regular expression `pattern`. A particularly useful flag is ``i``, it " |
| 176 |
"makes matching case insensitive. A good primer on the syntax for regular " |
| 177 |
"expressions can be found at `regexp syntax " |
| 178 |
"<https://docs.python.org/library/re.html>`_" |
| 179 |
msgstr "``re:test(src, pattern, flags)`` は 文字列 `src` が正規表現 `pattern` にマッチしたとき `true` を返します。特に便利なフラグは ``i`` で、大文字と小文字を区別せずに比較するようになります。正規表現の構文に関しては、 `regexp syntax <https://docs.python.org/library/re.html>`_ がよい入門書となります。" |