ブラウザの JavaScript がオフ(ブロックまたは許可しない)に設定されているため、このページは正常に機能しません。
Anki日本語マニュアル Wiki*
[
ホーム
]
一覧
最終更新
バックアップ
ヘルプ
Top
> 2.0 >
CardsAndTemplates
>
複製
?
ms
2.0/CardsAndTemplates をテンプレートにして作成
これらのキーワードがハイライトされています:
開始行:
TITLE:カードとテンプレート (Cards and Templates)
原文 = https://apps.ankiweb.net/docs/manual.html#cards-and-templates
----
目次
#contents
&br;&br;
[[基本のカードタイプ>2.0/TheBasics#card-types]] セクションで述べたように、Anki はユーザーが追加したカードに基づき、カードを自動的に生成します。(以下の説明は 基本 セクションを読み終えていることを想定して書かれています。まだであれば、先にそ
//As mentioned in the [[basics :http://ankisrs.net/docs/manual.html#cardtypes]] section, Anki creates cards automatically, based on the notes you add. (Please read the basics section if you have not done so already, as the rest of this sect
&ref(card.png,,テンプレート編集画面);
マテリアルの追加・編集時に "カード..." (Cards…) ボタンをクリックすることで、Anki が生成するカードや、表示され方の設定を行うことができます。ウィンドウの上部にはタブの集まりがあり、それぞれカードタイプを示します。右の "+" をクリックすること
//You can configure the cards Anki should create and what should be shown on them when adding or editing material by clicking on the “Cards…” button. At the top of the window you’ll see a set of tabs, one for each card type. You can click t
左上には 表面のテンプレート (front template)、左下には 裏面のテンプレート (back template)、それらの間には カードの書式 (styling) 部があります。
//On the top left is the front template, on the bottom left is the back template, and in between them is the card styling section.
Anki では、Web ページを書く際に用いる言語である、HTML を使ってテンプレートを書きます。書式指定には Web ページの表示スタイル指定に用いる CSS を使います。
//In Anki, templates are written in HTML, which is the language that web pages are written in. The styling section is CSS, which is the language used for styling web pages.
右側には、現在選択されているカードの表面と裏面のプレビューが表示されています。ノートの追加中にウィンドウを開いた場合、ノートの 追加 (Add Notes) ウィンドウに入力したテキストの内容に基づいてプレビューが表示されます。ノートの編集中にウィンドウ
//On the right is a preview of the front and back of the currently selected card. If you opened the window while adding notes, the preview will be based on the text you had typed into the Add Notes window. If you opened the window while edi
ウィンドウの下部の もっと (More) ボタンからは、カードの名称変更と順番変更、そして以下の2機能が利用できます。
//At the bottom of the window is a More button that gives you options to rename or reorder the cards, as well as the following two options:
-''単語帳を指定'' (Deck Override) オプションでは、現在のカードタイプから生成されるカードが入れられる単語帳を変更することができます。デフォルトでは、カードはノートの 追加 ウィンドウで指定した単語帳に入ります。ここで単語帳を指定した場合、カー
//-The '''Deck Override''' option allows you to change the deck that cards generated from the current card type will be placed into. By default, cards are placed into the deck you provide in the Add Notes window. If you set a deck here, tha
-''ブラウザーの表示設定'' (Browser Appearance) オプションでは、ブラウザーの 質問 (Question) と 解答 (Answer) 列の表示用に、通常より簡略化したテンプレートを設定することができます。詳細は [[ブラウザーの表示設定>2.0/CardsAndTemplates#browser-a
//-The '''Browser Appearance''' option allows you to set different (perhaps simplified) templates for display in the Question and Answer columns of the browser; see [[browser appearance :http://ankisrs.net/docs/manual.html#columntemplates]]
* 反転カード [#reverse-cards]
//* Reverse Cards
YouTube に [[反転カードに関するVideo :http://www.youtube.com/watch?v=DnbKwHEQ1mA]] があります。
//You can watch [[a video about reversing cards :http://www.youtube.com/watch?v=DnbKwHEQ1mA]] on YouTube.
どちらの方向へもカードを作りたい場合(例:"big" → "大きい", "大きい" → "big")、いくつかの方法があります。最も簡単なのは標準ノートタイプの“Basic (and reversed card)”を選択することです。これは両方の方向への2枚のカードを生成します。
//If you want to create cards that go in both directions (e.g., both “ookii”→“big” and “big”→“ookii”), you have several options. The simplest is to select the “Basic (and reversed card)” built-in note type. This will generate two cards, one
特定のマテリアルに対してだけ反転カードを生成したい場合(重要な内容のみ反転カードを学習するのに時間を割きたい場合や、反転カードが意味をなさない場合)、“Basic (optional reversed card)”ノートタイプを使うことができます。このノートタイプでは最初
//If you want to generate reverse cards for only some of your material (perhaps you only want to take the time to study reverses for the most important material, or some of your cards don’t make sense reversed), you can select the “Basic (o
追加した反転カードが不要であると後で判断した場合、“Add Reverse”フィールドからテキストを削除することでそのカードを削除することができます。同様に、反転カードを追加したい場合、“Add Reverse”フィールドにテキストを追加してください。最初にノートタ
//If you later decide you don’t want a reverse card that you added, you can delete it by removing the text from the “Add Reverse” field. Similarly, if you want to add a reverse card, you can add text to the “Add Reverse” field. If you didn’
>''ノート''
//>''Note''
>編集ミスによりスケジュール情報を失うのを避けるため、“Add Reverse”フィールドからテキストを削除してもカードを自動的には削除しません。削除を完了するには、メインウィンドウから ツール→白紙... (Tools→Empty Cards) を実行してください。
//>To avoid loss of scheduling information if you make an editing mistake, Anki does not automatically delete cards after you remove the text from the “add reverse” field. To complete the deletion, run Tools → Empty Cards from the main wind
もっと複雑なノートタイプを使っていて(例えば1つのノートタイプに対して3つのカードなど)、特定の場合にだけ特定のカードを生成したい場合、[[条件付き置換>2.0/CardsAndTemplates#conditional-replacement]] を参照してください。
//If you’re using a more complex note type (for instance, one with three cards) and you wish to generate specific cards only in certain situations, please see the [[conditional replacement :http://ankisrs.net/docs/manual.html#conditionalrep
* 基本的なテンプレート [#basic-templates]
//* Basic Templates
最も基本的なテンプレートはこのようになります:
//The most basic template looks something like this:
{{Front}}
波カッコの中にテキストを入れると、Anki はその名前を持つフィールドを探し、テキストをフィールドの実際の内容で置き換えます。好きなだけ多くのフィールドを含めることができます。
//When you place text within curly brackets, Anki looks for a field by that name, and replaces the text with the actual content of the field. You can include as many fields as you wish.
>''ノート''
>フィールド名は大文字・小文字を区別します。'''Front''' という名前のフィールドがある場合、{{'''front'''}} という記載では正しく動作しません。
//>''Note''
//>Field names are case sensitive. If you have a field named '''Front''', writing {{'''front'''}} will not work properly.
テンプレートに含めるのはフィールドのリストのみではありません。任意のテキストもテンプレートに含むことができます。例えば首都を学習していて、“国”フィールドのあるノートタイプを作成した場合、テンプレートをこのようにすることができます:
//Your templates are not limited to a list of fields. You can also include arbitrary text on your templates. For example, if you’re studying capital cities, and you’ve created a note type with a “Country” field, you might create a front tem
{{国}}の首都は?
// What's the capital city of {{Country}}?
デフォルトの裏面のテンプレートはこのようになります:
//The default back template will look something like this:
{{FrontSide}}
<hr id=answer>
{{Back}}
これの意味は“表面のテキストを表示し、水平線を引いて、Back フィールドを表示せよ”となります。
//This means “show me the text that’s on the front side, then a divider line, and then the Back field”.
'''id=answer''' の部分は質問と解答の間の水平線の位置を Anki に伝えます。これにより、長いカードで '''show answer''' ボタンを押したときに Anki は自動的に解答の開始位置までスクロールします。(特に画面の小さいモバイルデバイスで有効です。)解答
//The '''id=answer''' part tells Anki where the divider is between the question and the answer. This allows Anki to automatically scroll to the spot where the answer starts when you press '''show answer''' on a long card (especially useful
* 回答の確認 [#checking-your-answer]
//* Checking Your Answer
YouTube に [[回答のタイプ入力に関するVideo :http://www.youtube.com/watch?v=5tYObQ3ocrw]] があります。
//You can watch [[a video about this feature :http://www.youtube.com/watch?v=5tYObQ3ocrw]] on YouTube.
&ref(checking-answer.png,,回答タイプ入力の編集画面);
解答をタイプ入力して、入力が実際の答えに正しいか判定させたいと思うかもしれません。テンプレートを変更することにより、これが可能です。表面と裏面のテンプレートが次のようだったとします:
//If you’d like to type in the answer and have Anki compare your input to the real answer, you can do so by changing your template. Imagine your front and back templates look like:
{{Native Word}}
{{FrontSide}}
<hr id=answer>
{{Foreign Word}}
外国語の単語を入力して正しいか確認するには、表面のテンプレートを編集してこのようにします:
//To type in the foreign word and check if you are correct, you need to edit your front template so that it looks like this:
{{Native Word}}
{{type:Foreign Word}}
比較したいフィールドの前に "type:" を追加したことに注意してください。FrontSide は カードの裏面であることから、解答ボックスは裏面にも同様に表示されます。(カードの裏面に FrontSide がない場合、解答側にも "type:" を同様に追加する必要があります
//Note that we have added '''type''': in front of the field we want to compare. Since FrontSide is on the back of the card, the type answer box will appear on the back as well. (If you don’t have FrontSide on the back of your card, you will
復習の際は、文字列を入力できるテキストボックスが表示され、エンターキーを押すか解答を表示ボタンを押すと、どの部分が正しく、どの部分が間違っているかが表示されます。テキストボックスのフォントサイズはフィールドで設定したサイズ(編集時に フィー
//When reviewing, Anki will display a text box where you can type in the answer, and upon hitting enter or showing the answer, Anki will show you which parts you got right and which parts you got wrong. The text box’s font size will be the
この機能では、どのようにカードに解答するかは変わりません。よってどの程度覚えられていたかの判断は依然ユーザー次第です。
//This feature does not change how the cards are answered, so it’s still up to you to decide how well you remembered or not.
>''ノート''
//>''Note''
>カードにつき、1つのタイプ入力比較のみが可能です。上記のテキストを複数回記載した場合、動作しません。単一行のみがサポートされており、複数行で構成されるフィールドの比較にはうまく使えません。
//>Only one typing comparison can be used on a card. If you add the above text multiple times, it will not work. It also only supports a single line, so it is not useful for comparing against a field that is comprised on multiple lines.
解答比較には等幅フォントが使われ、「与えられた」部分と「正しい」部分が並んで表示されます(?((Anki uses a monospaced font for the answer comparison so that the “provided” and “correct” sections line up.)))フォントを上書きしたければ、書式セ
//Anki uses a monospaced font for the answer comparison so that the “provided” and “correct” sections line up. If you wish to override the font, you can put the following at the bottom of your styling section:
code#typeans { font-family: "myfontname"; }
高度なユーザーは標準の type-answer 色を CSS クラス '''typeGood''', '''typeBad''', '''typeMissed''' により変更することができます。このマニュアルの作成時点では、Anki のコンピュータ版のみがこれらのクラスをサポートしています。
//Advanced users can override the default type-answer colours with the css classes '''typeGood''', '''typeBad''' and '''typeMissed'''. At the time of writing, only the computer version of Anki supports these classes.
穴埋め問題カードについても回答をタイプ入力することが可能です。これをするには、{{type:cloze:Text}} を表面と裏面テンプレートに追加し、裏面テンプレートは以下のようになります:
//It is also possible to type in the answer for cloze deletion cards. To do this, add {{type:cloze:Text}} to both the front and back template, so the back looks something like this:
{{cloze:Text}}
{{type:cloze:Text}}
{{Extra}}
穴埋めノートタイプでは FrontSide を使わないため、表面と裏面の両方にこれを追加する必要があります。
//Note that since the cloze type does not use FrontSide, this must be added to both sides on a cloze note type.
複数の穴埋めされた部分がある場合、解答をテキストボックスにカンマ "," で分離して入力することができます。
//If there are multiple sections elided, you can separate the answers in the text box with a comma.
>''ノート''
//>''Note''
>回答入力ボックスはブラウザーの [[プレビューダイアログ>2.0/Browser#current-note]] には表示されません。復習時や、カードタイプウィンドウでプレビューする場合には、表示されます。
//>Type answer boxes will not appear in the [["preview" dialog :http://ankisrs.net/docs/manual.html#currentnote-preview]] in the browser. When you review or look at the preview in the card types window, they will display.
* 改行 [#newlines]
//* Newlines
テンプレート中で改行するには、特別なコマンドが必要です。例えばテンプレートに次を記載した場合:
//The template language needs a special command to create a new line. For example, if you wrote the following in the template:
one
two
プレビューではこのように表示されます:
//In the preview, you’d actually see:
one two
改行するには、行の末尾に <br> コードをこのように追加すつ必要があります:
//To add a new line, you need to add a <br> code to the end of a line, like so:
one<br>
two
br は、改行を表す英単語 "(line) br(eak)" から名づけられました。
//The br code stands for "(line) br(eak)".
フィールドについても同様です。2つのフィールドを別の行に表示したい場合、次のようにしてください。
//The same applies for fields. If you want to display two fields, one on each line, you would use
{{Field 1}}<br>
{{Field 2}}
* カードの表示書式 [#card-styling]
//* Card Styling
YouTube に [[カードの書式に関するVideo :http://www.youtube.com/watch?v=F1j1Zx0mXME]] があります。
//You can watch [[a video about styling cards :http://www.youtube.com/watch?v=F1j1Zx0mXME]] on YouTube.
表面テンプレートと裏面テンプレートの間には、書式があります。ここでは背景色やデフォルトのフォント、テキストの行揃えなどを変更することができます。
//In between the front and back template is the card styling. Here you can change the background colour of the card, the default font, the text alignment, and so on.
>''ノート''
>タイプ入力解答の比較、回答のタイプ入力、編集のテキストボックスのフォントを変更するのはここではありません。これらのフォントを変更するには、checking your answer と customizing fieldsの項目を参照してください。
//NOTE: This is 'not' where you change the font for type answer
//comparisons, type answer textboxes, or editing textboxes; to learn how to
//change these fonts, please see the <<typinganswers,checking your answer>> and
//<<fields,customizing fields>> sections.
利用可能な標準オプションは以下の通りです:
//The standard options available to you are:
:font-family|
:|カードで使うフォントの名称。フォント名にスペースが含まれる場合(例:"MS Unicode")、ダブルクォーテーション(")でフォント名を囲む必要があります。1枚のカードで複数のフォントを使うことも可能です。詳細は以下を参照してください。
//:|The name of the font to use on the card. If your font has spaces in it like "MS Unicode", then you need to surround the font name in double quotes as in this sentence. It is also possible to use multiple fonts on one card; for informati
:font-size|
:|フォントのサイズです(単位:ピクセル)。変更する場合は、後ろの "px" を残してください。
//:|The size of the font in pixels. When changing it, make sure you leave px at the end.
:text-align|
:|テキストの行揃えを指定します(center, left, right)。
//:|Whether the text should be aligned in the center, left, or right.
:color|
:|文字の色です。'''blue''' や '''lightyellow''' などといった色名や、HTML の 色コードで任意の色を指定することもできます。詳細は他の Web ページを参照してください。
//:|The color of the text. Simple color names like '''blue''', '''lightyellow''', and so on will work, or you can use HTML color codes to select arbitrary colors. Please see this webpage for more information.
:background-color|
:|カードの背景の色です。
//:|The color of the card background.
書式にはどのような CSS も用いることができます。高度なユーザーは背景画像を追加したりグラデーションにすることもできます。ある書式をどのように実現できるかを知りたければ、Web で CSS に関する情報を検索すれば、素晴らしい説明文書が数多くみつかりま
//Any CSS can be placed in the styling section - advanced users may wish to do things like add a background image or gradient, for example. If you’re wondering how to get some particular formatting, please search the web for information abo
書式は全てのカード間で共有されます。即ち、ここでの変更はそのノートタイプをもつ全てのカードに影響します。ですがまた、カード特有の書式を指定することも可能です。以下の例は1番目のカードを除くすべてのカードの背景色を黄色にします:
//The styling is shared between all cards, which means that when you make an adjustment it will affect all cards for that note type. It is also possible to specify card-specific styling, however. The following example will use a yellow back
.card { background-color: yellow; }
.card1 { background-color: blue; }
標準では Anki は画像をスクリーンに収まるように縮小することに注意してください。この挙動は、書式の最後に次を指定することで変更できます:
//One other thing to note is that Anki shrinks images to fit the screen by default. You can change this by adding the following to the bottom of your styling section:
img { max-width: none; max-height: none; }
もし画像のスタイルを変更しようとしてマーク付きのカードに表示される星の画像も影響されてしまう場合(たとえば拡大されるなど)、以下のように星の画像を指定できます:
//If you try to change the style for images and find that the star that appears on marked cards is affected (for instance, it becomes way too large), you can target it with the following:
img#star { ... }
* フィールドの表示書式 [#field-styling]
//* Field Styling
デフォルトの書式はカード全体に適用されます。特定のフィールドやカードの一部で異なるフォントや色などを使うようにすることもできます。これは特に外国語を学習する際に重要であり、Anki では正しいフォントが選択されないと文字を正しく表示できない場合
//The default styling applies to the whole card. You can also make certain fields or part of the card use a different font, color, and so on. This is particularly important when studying foreign languages, as Anki will sometimes be unable t
"Expression" フィールドがあり、これに OSX のタイ語フォント "Ayuthaya" を適用させたいとします。テンプレートがすでにこのようになっていることを考えてください:
//Say you have an “Expression” field, and you want to give it the OSX Thai font “Ayuthaya”. Imagine your template already reads:
What is {{Expression}}?
{{Notes}}
必要なことは、書式を用いたいテキストを HTML で囲うことです。以下をテキストの前に追加します:
//What we need to do is wrap the text we want to style in some HTML. We will put the following in front of the text:
<div class=mystyle1>
そして以下をテキストの後ろに追加します:
//And the following behind it:
</div>
上記のようにテキストを囲うことで、囲われたテキストに "mystyle1" というカスタム書式を適用するよう指示することができます。このカスタム書式は後ほど作成します。
//By wrapping the text like the above, we tell Anki to style the wrapped text with a custom style called “mystyle1”, which we will create later.
よって "What is …?" という表現全体にタイ語フォントを適用したければ、以下のようになります:
//Thus if we wanted the entire “What is …?” expression to use the Thai font, we would use:
<div class=mystyle1>What is {{Expression}}?</div>
{{Notes}}
タイ語フォントを expressin フィールドにのみ適用したければ、こうなります:
//And if we wanted only the expression field itself to use the Thai font, we’d use:
What is <div class=mystyle1>{{Expression}}</div>?
{{Notes}}
テンプレートの編集が終わったので、テンプレートの間にある 書式 の欄に移りましょう。編集前には、書式はこのようになっています:
//After we’ve edited the template, we now need to move to the Styling section between the templates. Before editing it, it should look something like:
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
新しいスタイルを下部に付け加え、このようにします:
//Add your new style to the bottom, so it looks like:
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
.mystyle1 {
font-family: ayuthaya;
}
スタイルには望む書式はどのようなものも含めることができます。フォントサイズも変更したければ、 mystyle1 セクションを次のように変更します:
//You can include any styling you want in the style. If you wanted to increase the font size too, you’d change the mystyle1 section to look like:
.mystyle1 {
font-family: ayuthaya;
font-size: 30px;
}
カスタムのフォントを単語帳に含めることも可能であり、この場合コンピュータやモバイル端末にフォントをインストールする必要はありません。詳細は [[フォントのインストール>2.0/CardsAndTemplates#installing-fonts]] を参照してください。
//It’s also possible to bundle custom fonts with your deck, so you don’t need to install them on your computer or mobile device. Please see the [[installing fonts :http://ankisrs.net/docs/manual.html#installingfonts]] section for more info.
ここで使うことのできる書式についての詳細は [[カードの書式>2.0/CardsAndTemplates#card-styling]] を参照してください。
//Please see the [[card styling :http://ankisrs.net/docs/manual.html#cardstyling]] section for more information on the styling options you can use here.
* ヒントフィールド [#hint-fields]
//* Hint Fields
カードの表面または裏面に追加したフィールドを、明示的に表示させるまで隠しておくことが可能です。これは ''ヒントフィールド'' (hint field) とよばれます。ヒントを追加する前に、質問に答えるのを簡単にすればするほど実際の生活で質問に出会った際に思
//It’s possible to add a field to the front or back of a card, but make it hidden until you explicitly show it. We call this a '''hint field'''. Before adding a hint, please bear in mind that the easier you make it to answer a question in A
最初に、ヒントを記入するフィールドを追加してください。やり方がわからなければ [[フィールド>2.0/AddingMaterial#customizing-fields]] の項目を参照してください。
//First, you’ll need to add a field to store the hint in if you have not already. Please see the [[fields :http://ankisrs.net/docs/manual.html#fields]] section if you’re not sure how to do this.
"MyField" という名前のフィールドを追加したとすると、次のようにしてカードにヒントフィールドを表示できます:
//Assuming you’ve created a field called MyField, you can tell Anki to include it on the card but hide it by default by adding the following to your template:
{{hint:MyField}}
これにより "show hint" というリンクが追加されます。これをクリックすると、フィールドの内容がカードに表示されます。(MyField が空白であれば、何も表示されません。)
//This will show a link labeled “show hint”; when you click it, the content of the field will be displayed on the card. (If MyField is empty, nothing will be shown.)
ヒントを表示してから解答を表示すると、ヒントはもう一度隠れます。解答表示時に常にヒントを表示したければ、裏面のテンプレートから {{FrontSide}} を削除して手動で表示したいフィールドを追加する必要があります。
//If you show the hint on the question and then reveal the answer, the hint will be hidden again. If you want to have the hint always revealed when the answer is shown, you will need to remove {{FrontSide}} from your back template and manua
>''ノート''
//>''Note''
>ヒントフィールドを音声で使うことはできません。音声はヒントのリンクをクリックしたかどうかにかかわらず常に再生されます。
//>It is not currently possible to use a hint field for audio ― the audio will play regardless of whether you’ve clicked on the hint link.
* 特別なフィールド [#special-fields]
//* Special Fields
テンプレートで利用可能な、特別なフィールドがあります:
//There are some special fields you can include in your templates:
ノートのタグ: {{Tags}}
ノートのタイプ: {{Type}}
カードの含まれる単語帳: {{Deck}}
カードの含まれる最下層の単語帳: {{Subdeck}}
カードのタイプ("Forward" など): {{Card}}
フロント面テンプレート内容(バック面テンプレートでのみ有効): {{FrontSide}}
// The note's tags: {{Tags}}
//
// The type of note: {{Type}}
//
// The card's deck: {{Deck}}
//
// The card's subdeck: {{Subdeck}}
//
// The type of card ("Forward", etc): {{Card}}
//
// The content of the front template (only valid in back template): {{FrontSide}}
FrontSide には、カードのフロント面にあった音声は含まれません。カードのフロントとバックで同じ音声の再生を行いたい場合、バック面にも手動で音声フィールドを追加する必要があります。
//FrontSide will not include any audio that was on the front side of the card. If you wish to have the same audio play on both the front and back of the card, you’ll need to manually include the audio fields on the back as well.
他のフィールドと同様に、特別なフィールド名も大文字・小文字を区別します。
//As with other fields, special field names are case sensitive.
* カードの生成と削除 [#card-generation-and-deletion]
//* Card Generation & Deletion
カードの表面が空白の場合、そのカードは生成されません。よって例えば "My Field" が空欄であり表面テンプレートがそのフィールドのみしか含まない場合、そのカードは生成されません。
//Anki will not create cards with empty front sides. Thus if “My Field” was empty, and one card’s front template included only that field, the card would not be created.
全ての表面が空白でありカードが1枚も作れない場合、Add Notes ウィンドウは警告を表示し、少なくとも1枚のカードが生成されるまでノートの追加をすることはできません。
//If no cards can be created because all of the cards would have empty front sides, then the Add Notes window will warn you and not allow the note to be added until at least one card would be generated.
以前に追加したノートを編集し、前回は空白であったカードが今回は空白ではなくなった場合、追加のカードが自動的に生成されます。反対に今回の編集で空白に変わった場合には、そのカードはすぐには削除されず、間違いによるデータ喪失を防止します。空白のカ
//When you edit a previously added note, Anki will automatically create extra cards if they were previously blank but no longer are. If your edits have made some cards blank when they previously were not, however, Anki will not delete them
カードの生成の動作の仕方により、手動で個々のカードを削除するのは不可能です(次回にノートが編集された際に自動的に再生成されてしまいます)。代わりに関係する条件付き置換フィールドを空白にし、Empty Cards オプションを使うべきです。(カードの生成
//Because of the way that card generation works, it is not possible to manually delete individual cards (they would just end up being recreated the next time the note was edited). Instead, you should make the relevant conditional replacemen
カード生成には特別なフィールドやフィールドではないテキストは考慮しません。よって表面テンプレートが次の場合、"国名" フィールドが空白であればカードは生成されません:
//Anki does not consider special fields or non-field text for the purposes of card generation. Thus if your front template looked like the following, no card would be generated if Country was empty:
{{国名}} は地図のどこにある?
// Where is {{Country}} on the map?
* 選択的なカード生成 [#selective-card-generation]
//* Selective Card Generation
これを読む前に、前の [[カードの生成と削除>2.0/CardsAndTemplates#card-generation-and-deletion]] の項目を読んでください。
//Please read the previous section on [[card generation and deletion :http://ankisrs.net/docs/manual.html#cardgeneration]] before you read this.
マテリアルの一部についてのみ追加のカードを生成したい場合があると思います。例えば重要な単語についてのみ想起できるかをテストしたい場合などです。これを実現するには、ノートにフィールドを追加し、追加カードが欲しい場合にはそのフィールドに何かの文
//Sometimes you may want to generate extra cards for only some of your material, such as testing your ability to recall the most important words of a set. You can accomplish this by adding an extra field to your note, and adding some text i
* メディア参照とLaTeX参照 [#media-and-latex-references]
//* Media & LaTeX References
Anki ではテンプレートでのメディア参照を解析しません。そうすると動作が遅くなるからです。これにより、テンプレートにメディアを含める場合には制約事項が発生します。
//Anki does not scan templates for media references, because it is slow to do so. This has implications for including media on the template.
** 静的な音声や画像 [#static-sounds-or-images]
//** Static Sounds/Images
全てのカードに共通な画像や音声を追加したければ(例:前カードの上部に会社のロゴを表示するなど):
//If you wish to include images or sounds on your cards that are the same for every card (eg, a company logo at the top of each card):
+ファイルの名前を下線で始まる名前に変更する(例:"_logo.jpg")。下線のついたファイル名は、テンプレートに使われており、公開された単語帳へのエクスポートに含まれるべきだという意味になります。
+表面または裏面テンプレートで、メディアへの参照を追加します:
//+Rename the file so it starts with an underscore, eg "_logo.jpg". The underscore tells Anki that the file is used by the template and it should be exported when sharing the deck.
//+Add a reference to the media on your front or back template, like:
<img src="_logo.jpg">
** フィールド参照 [#field-references]
//** Field References
フィールドへのメディア参照は認められていません。復習中に表示されるかは不明であり、未使用メディアのチェックや、インポートやエクスポートなどの機能で正しく動作しません。動かない例としては:
//Media references to fields are not allowed. They may or may not display during review, and will not work when checking for unused media, importing/exporting, and so on. Examples that won’t work:
<img src="{{Expression}}.jpg">
[sound:{{Word}}]
[latex]{{Field 1}}[/latex]
代わりに、フィールドにメディア参照を追加すべきです。詳しくは [[インポート>2.0/Importing]] の項目を参照してください。
//Instead, you should include the media references in the field. Please see the [[importing :http://ankisrs.net/docs/manual.html#importing]] section for more information.
* 条件付き置換 [#conditional-replacement]
//* Conditional Replacement
フィールドが空白の場合、または空白でない場合にのみ特定の文字列やフィールド、HTML を追加することが可能です。例えば:
//It is possible to include certain text, fields, or HTML on your cards only if a field is empty or not empty. An example:
// This text is always shown.
この文字列は常に表示されます。
{{#FieldName}}
// This text is only shown if FieldName has text in it
この文字列は FieldName に文字列がある場合にのみ表示されます。
{{/FieldName}}
{{^FieldName}}
// This text is only shown if FieldName is empty
この文字列は FieldName が空白の場合にのみ表示されます。
{{/FieldName}}
実際の例としては、フィールドが空白でない場合にのみラベルを表示するような場合があります:
//A real life example is only showing a label if the field is not empty:
{{#Tags}}タグ: {{Tags}}{{/Tags}}
// {{#Tags}}Tags: {{Tags}}{{/Tags}}
Note フィールドを含むカードについてだけ、表面の特定フィールドを青く表示したい場合(例えば記憶のために Note を追加しており、回答の想起に時間をかけたい場合)、フィールドを次のように書式設定することができます:
//Or say you want to display a specific field in blue on the front of your card if there are extra notes on the back (perhaps the fact that there are notes serves as a reminder that you should spend more time thinking about the answer). You
{{#Notes}}<span style="color:blue;">{{/Notes}}
{{FieldToFormat}}
{{#Notes}}</span>{{/Notes}}
どのカードが生成されるのかをコントロールするため、条件付き置換を使うことができます。カードの表面が空白の場合には [[カードが生成されない>2.0/CardsAndTemplates#card-generation-and-deletion]] ことを利用しています。例えば、表面に2つのフィールド
//You can also use conditional replacement to control which cards are generated. This works since Anki will not [[generate cards :http://ankisrs.net/docs/manual.html#cardgeneration]] which would have a blank front side. For example, conside
{{Expression}}
{{Notes}}
通常、Expression と Note フィールドのいずれかに文字列がある場合にカードが生成されます。Expression が空白でない場合にのみカードを生成したければ、テンプレートをこのように変更できます:
//Normally a card would be generated if either the expression or notes field had text in it. If you only wanted a card generated if expression was not empty, then you could change the template to this:
{{#Expression}}
{{Expression}}
{{Notes}}
{{/Expression}}
両方のフィールドが必要であれば、2つの条件付き置換を使うことができます:
//And if you wanted to require both fields, you could use two conditional replacements:
{{#Expression}}
{{#Notes}}
{{Expression}}
{{Notes}}
{{/Notes}}
{{/Expression}}
[[カードの生成>2.0/CardsAndTemplates#card-generation-and-deletion]] で述べたように、これは条件付き置換のコードをカードの ''''表面'''' に置いた場合にのみ動作することに注意してください。裏面でこれを行うと、単にカードの裏面が空白となるだけです
//Keep in mind that, as mentioned in the [[card generation :http://ankisrs.net/docs/manual.html#cardgeneration]] section, this only works when you place the conditional replacement code on the ''''front'''' of the card; if you do this on th
{{#Expression}}
{{Expression}}
{{/Expression}}
{{Notes}}
デフォルトでの動作は "OR" 条件だと考えることができます。カードが生成されるのは、最初のフィールドが空白でなく、または 2つ目のフィールドが空白でなく・・・という場合です。上記の例での動作は "AND" 条件だと考えることができます。カードが生成され
//The default behaviour can be thought of as an "OR" condition - cards are created if the first field is non-empty, OR the second field is non-empty, and so on. The behaviour above can be thought of as an "AND" condition - cards are created
Anki では AND と OR の条件を混ぜて使うことはできない点に注意してください。よって、「Expression と Note、または Field 3 が必要」を意図した次のテンプレートは動作しません。
//A caveat: Anki is not currently able to mix AND and OR conditions. Thus the following template, which says "require expression and notes, or field 3", would not work:
{{#Expression}}
{{#Notes}}
{{Expression}}
{{Notes}}
{{/Notes}}
{{/Expression}}
{{Field 3}}
カード生成をコントロールするために否定表現を使うことはできないことにも注意してください。つまり、テンプレートを {{^Field}} で囲んでも期待したような動作をしません。
//Another caveat is that negated expressions can not be used to control card generation. That is, wrapping a template in {{^Field}} will not do what you expect.
* 穴埋めテンプレート [#cloze-templates]
//* Cloze Templates
背景情報は [[穴埋め問題>2.0/Editing#cloze-deletion]] の項目を参照してください。
//Please see the [[cloze deletion :http://ankisrs.net/docs/manual.html#cloze]] section for background info.
穴埋めノートタイプは、通常のノートタイプとは異なった動作をします。カードタイプの数がカスタマイズ可能な代わりに、穴埋めノートには全ての穴埋め問題で共有される単一のタイプを持ちます。
//The cloze note type functions differently from regular note types. Instead of a customizable number of card types, it has a single type which is shared by all cloze deletions on a note.
上記のカード生成の項目で述べたように、通常のカードが生成されるかどうかは質問の1つ以上のフィールドが空白でないことに依存します。穴埋めノートタイプでは異なって生成されます:
//As mentioned in the card generation section above, generation of regular cards depends on one or more fields on the question being non-empty. Cloze deletion note types are generated differently:
-表面テンプレートから1つ以上の穴埋め置換({{cloze:FieldName}} など)を探します。
-FieldName フィールドで全ての穴埋め参照({{c1::text}} など)を探します。
-別々の番号のそれぞれについて、カードが生成されます。
//-Anki looks on the front template for one or more cloze replacements, like {{cloze:FieldName}}.
//-It then looks in the FieldName field for all cloze references, like {{c1::text}}.
//-For each separate number, a card will be generated.
条件付き生成では特別なフィールドが提供され、どのカードが表示されるのかを判断できます。最初の穴埋めには "ヒント1" フィールド、2つ目の穴埋めには "ヒント2" フィールドを表示させたければ、次のテンプレートが使えます。
//Conditional generation provides a special field so you can check which card you are rendering. If you wanted to display the "hint1" field on the first cloze, and "hint2" field on the second cloze for example, you could use the following t
{{cloze:Text}}
{{#c1}}
{{ヒント1}}
// {{Hint1}}
{{/c1}}
{{#c2}}
{{ヒント2}}
// {{Hint2}}
{{/c2}}
* 他のHTML [#other-html]
//* Other HTML
テンプレートでは任意のHTMLを使用することができます。よってインターネットの Web ページで利用可能な全てのレイアウトを、カードでも用いることができます。表、リスト、画像、外部ページへのリンクなどもすべてサポートされます。例えば表を用いてレイア
//Your templates can contain arbitrary HTML, which means that all the layout possibilities used on internet web pages can also be used on your cards. Things like tables, lists, images, links to external pages and so on are all supported. Wi
全ての HTML の機能を説明するのは、このマニュアルの範囲外です。HTML についてもっと知りたい場合、Web 上には HTML の良い説明資料が多数あります。
//Covering all of HTML’s features is outside the scope of this manual, but there are plenty of good introductory guides to HTML available on the web if you’d like to learn more.
* 辞書へのリンク [#dictionary-links]
//* Dictionary Links
フィールドの置換を利用して、辞書へのリンクを作成できます。言語の学習中をしており、オンラインの辞書が次のような URL を使った単語検索に対応している場合を想像してください:
//You can also use field replacement to create dictionary links. Imagine you’re studying a language and your favourite online dictionary allows you to search for text using a web URL like:
http://example.com/search?q=myword
次のテンプレートで、リンクを自動的に生成することができます:
//You could add an automatic link by doing the following in your template:
{{Expression}}
<a href="http://example.com/search?q={{Expression}}">check in dictionary</a>
上のテンプレートにより、復習中にリンクをクリックすることで、各ノートの表現を検索することができます。これには注意事項があり、次のセクションも確認してください。
//The template above would allow you to search for each note’s expression by clicking on the link while reviewing. There is a caveat however, so please see the next section.
* HTMLの除去 [#html-stripping]
//* HTML Stripping
テンプレートと同様に、フィールドは HTML で保存されます。上記の辞書リンク例では、expressionが "myword" という単語を書式なしで保持していれば、HTML も同様に "myword" です。しかしフィールドに書式指定が含まれていれば、フィールドには追加の HTML
//Like templates, fields are stored in HTML. In the dictionary link example above, if the expression contained the word "myword" without any formatting, then the HTML would be the same: "myword". But when you include formatting in your fiel
辞書リンクなどにおいては、これが問題となります。上記の HTML を含む例では、辞書リンクはこうなります:
//This can present a problem for things like dictionary links. In the above example, the dictionary link would end up being:
<a href="http://example.com/search?q=<b>myword</b>">check in dictionary</a>
リンクでの余分な文字は辞書サイトを混乱させ、マッチした情報を得られないでしょう。
//The extra characters in the link would likely confuse the dictionary site, and you’re likely not to get any matches.
これを解決するため、Anki では置換時にフィールドから書式指定を除去する機能が用意されています。フィールド名のに "text:" を追加すると、いかなる書式も含まれません。よって書式付きのフィールドでも動作する辞書へのリンクはこうなります:
//To solve this, Anki provides the ability to strip formatting from fields when they are replaced. If you prefix a field name with text:, Anki will not include any formatting. So a dictionary link that worked even with formatted text would
<a href="http://example.com/search?q={{text:Expression}}">check in dictionary</a>
* ブラウザーの表示設定 [#browser-appearance]
//* Browser Appearance
カードのテンプレートが複雑な場合、[[カードリスト>2.0/Browser#card-list]] の 質問 (question) と 解答 (answer) 列を読むのが難しくなります。''ブラウザーの表示設定'' (browser appearance) オプションではブラウザーでのみ使用されるカスタムのテンプ
//If your card templates are complex, it may be difficult to read the question and answer columns (called "Front" and "Back") in the [[card list :http://ankisrs.net/docs/manual.html#cardlist]]. The "browser appearance" option allows you to
* RTL (right to left) テキスト [#templatertl]
//* RTL (right to left) text
右から左へと読む言語を勉強している場合、テンプレートをこのように調整する必要があります。
//If you’re learning a language that reads from right to left, you’ll need to adjust the template like so:
<div dir=rtl>{{FieldThatHasRTLTextInIt}}</div>
もしリンクから直接この説明まで飛んできた場合、更なる情報はこのページの最初を確認してください。
//If you were linked directly here, please see the start of this section for more information.
* プラットフォーム固有のCSS [#platform-specific-css]
//* Platform-Specific CSS
Anki では、プラットフォームごとに異なる書式を定義するため、特別な CSS クラスを定義しています。例えば以下ではプラットフォームに応じて復習中の表示フォントを変更します。
//Anki defines some special CSS classes that allow you to define different styling for different platforms. The example below shows how to vary the font depending on where you’re reviewing:
.win .jp { font-family: "MS Mincho"; }
.mac .jp { font-family: "Hiragino Mincho Pro"; }
.linux .jp { font-family: "Kochi Mincho"; }
.mobile .jp { font-family: "Hiragino Mincho ProN"; }
テンプレートでは:
//And in the template:
<div class=jp>{{Field}}</div>
For different iOS devices, you can use '.iphone' and '.ipad'.
AnkiWeb を Web ブラウザーで利用中には .gecko, .opera, .ie のプロパティも使うことができます。オプションの全リストは http://rafael.adm.br/css_browser_selector/ を参照してください。
//You can also use properties like .gecko, .opera, and .ie to select particular browsers when using AnkiWeb. Please see http://rafael.adm.br/css_browser_selector/ for a full list of options.
* フォントのインストール [#installing-fonts]
//* Installing Fonts
Anki を職場や学校のコンピュータで使っており、新しいフォントのインストールをする権限がない場合や、Anki をモバイル端末で使っている場合には、Anki に直接フォントを追加することができます。
//If you’re using Anki on a work or school computer where you don’t have permission to install new fonts, or you’re using Anki on a mobile device, it’s possible to add fonts directly to Anki.
Anki にフォントを追加するには、TrueType フォントでなければなりません。TrueType フォントのファイル名は .ttf で終わります(例:Arial.ttf)。一度 TrueType フォントを配置したら、それをメディアフォルダーに追加する必要があります:
//To add a font to Anki, it must be in the TrueType format. TrueType fonts have a filename ending in .ttf, such as "Arial.ttf". Once you’ve located a TrueType font, we’ll need to add it to the media folder:
+ファイル名を最初に下線のついた名称に変更します(例:"_arial.ttf")。下線の追加はそのファイルがテンプレートで使われていることを意味し、未使用メディアのチェックで削除されません。
+コンピュータのファイルブラウザで "Documents" フォルダーの中の Anki フォルダーを開いてください。その中の"User 1" という名前(プロファイルの変更・追加をしている場合にはプロファイル名)のフォルダーを開いてください。
+フォルダー内部に "collection.media" というフォルダーがあります。名称を変更したファイルをそのフォルダーに入れてください。
//+Rename the file, adding an underscore at the start, so it becomes like "_arial.ttf". Adding an underscore will tell Anki that this file will be used on a template, and should not be deleted when checking for unused media.
//+In your computer’s file browser, go to your Documents folder, then the Anki folder inside it, and then a folder called "User 1" (or your profile name if you’ve renamed/added profiles).
//+Inside the folder, you should see a folder called collection.media. Drag the renamed file to that folder.
これを終えたら、テンプレートを更新する必要があります:
//After that, we need to update the template:
+メイン画面の上部から "Add" をクリックし、左上のボタンから変更したいノートタイプを選択してください。
+"Cards" をクリックします。
+書式セクションで、下 (after the last "}" character) に次のテキストを追加します("_arial.ttf" をメディアフォルダーにコピーしたファイル名に置き換えてください)。
//+Click ''Add'' at the top of the main screen, and then select the note type you want to change with the top left button.
//+Click ''Cards''.
//+In the styling section, add the following text to the bottom (after the last "}" character), replacing "_arial.ttf" with the name of the file you copied into your media folder:
@font-face { font-family: myfont; src: url('_arial.ttf'); }
>''ノート''
>"arial" の部分だけを変更し、"myfont" の部分は変更しないでください。
//>''Note''
//>Only change the "arial" part, not the "myfont" part.
この後、フォントを全てのカードに適用することも、個々のフィールドに適用することも可能です。すべてのコードのフォントを変えるには、.card セクションに "font-family:" の行を追加してフォントを "myfont" に変更してください。特定のフィールドのみのフ
//After that, you can either change the font for the entire card, or for individual fields. To change the font for the entire card, simply locate the font-family: line in the .card section and change the font to "myfont". To change the font
>''ノート''
//>''Note''
>ファイル名が正確に一致することを確認してください。ファイル名が arial.TTF であり、カードのテンプレートに arial.ttf と書いた場合には、うまく動作しません。
//>Please make sure the filenames match exactly. If the file is called arial.TTF and you write arial.ttf in your card templates, it will not work.
** Macでのフォント [#fonts-on-a-mac]
//** Fonts on a Mac
埋め込みフォントは今のところ OS X では動作しません。カスタムのフォントを使うことは可能ですが、システム側にインストールされている必要があります。
//Embedded fonts currently do not work on OS X. It is still possible to use custom fonts, but they need to be installed system wide.
システムにフォントをインストールするには、http://support.apple.com/kb/HT2435?viewlocale=en_US&locale=en_US を参照してください。
//To install a font on your system, please see http://support.apple.com/kb/HT2435?viewlocale=en_US&locale=en_US
Mac ではシステムフォント、他の環境では組み込みフォントを使うように設定できます。
//You can set up Anki to use the system font on a Mac computer, and an embedded font elsewhere.
表面と背面のテンプレートで、書式を変えたいフィールドを次のコードで囲ってください("FieldName" を実際のフィールド名に変えてください):
//On your front or back template, wrap the field you want to style in the following code, replacing "FieldName" with the name of your field.
<span class="mystyle">{{FieldName}}</span>
書式セクションでは、上述の font-face 行に加え、以下を追加します:
//In the styling section, in addition to the font-face line described above, add the following:
.mystyle { font-family: myfont; }
.mac .mystyle { font-family: Helvetica; }
"Helvetica" をシステムにインストールしたフォント名で置き換えてください。"myfont" はあなたが組み込んだフォントへの参照であるため、変えずにそのままにしてください。
//Replace "Helvetica" with the name of the font you installed on your system. Keep "myfont" as is, as it references the font you embedded.
* ナイトモード [#Night Mode] [#y6441335]
//* Night Mode
設定画面で夜間モードが有効になっている場合のテンプレートの表示方法をカスタマイズできます。
黒ではなく灰色の背景が必要な場合は、次のようなものを使用できます。
.card.nightMode {background-color:#555; }
myclassスタイルがある場合、夜間モードが有効になっていると、次のテキストが黄色で表示されます。
.nightMode .myclass {色:黄色; }
* Javascript [#javascript]
//* Javascript
Anki カードは Web ページとして取り扱われるため、カードに Javascript をインラインスクリプトタグとして埋め込むことが可能です (loading external files using src= is not supported)。これは高度な機能であり、特定の Javascript が動作することを保証
//As Anki cards are treated like webpages, it is possible to embed some Javascript on your cards via inline script tags in the template (loading external files using src= is not supported). As this is an advanced feature, we can not guarant
カード表示の実装は Anki クライアントごとに異なっており、プラットフォームごとに動作のテストをする必要があります。多くのクライアントでは長い期間 Webページを保持し、カードの復習時に動的に部分をアップデートします。よって Javascript では documen
//Each Anki client may implement card display differently, so you will need to test the behaviour across platforms. A number of clients are implemented by keeping a long running webpage and dynamically updating parts of it as cards are revi
window.alert のような関数も利用できません。Anki は Javascript エラーをターミナルに出力するので、Mac や Windows コンピュータを使用している場合、手動でエラーをキャッチしてファイルに書き出し、内容を確認する必要があります。デバッガは利用不可能
//Functions like window.alert are also not available. Anki will write javascript errors to the terminal, so if you’re running on a Mac or Windows computer, you’ll need to manually catch the errors and write them to the document to see them.
終了行:
TITLE:カードとテンプレート (Cards and Templates)
原文 = https://apps.ankiweb.net/docs/manual.html#cards-and-templates
----
目次
#contents
&br;&br;
[[基本のカードタイプ>2.0/TheBasics#card-types]] セクションで述べたように、Anki はユーザーが追加したカードに基づき、カードを自動的に生成します。(以下の説明は 基本 セクションを読み終えていることを想定して書かれています。まだであれば、先にそ
//As mentioned in the [[basics :http://ankisrs.net/docs/manual.html#cardtypes]] section, Anki creates cards automatically, based on the notes you add. (Please read the basics section if you have not done so already, as the rest of this sect
&ref(card.png,,テンプレート編集画面);
マテリアルの追加・編集時に "カード..." (Cards…) ボタンをクリックすることで、Anki が生成するカードや、表示され方の設定を行うことができます。ウィンドウの上部にはタブの集まりがあり、それぞれカードタイプを示します。右の "+" をクリックすること
//You can configure the cards Anki should create and what should be shown on them when adding or editing material by clicking on the “Cards…” button. At the top of the window you’ll see a set of tabs, one for each card type. You can click t
左上には 表面のテンプレート (front template)、左下には 裏面のテンプレート (back template)、それらの間には カードの書式 (styling) 部があります。
//On the top left is the front template, on the bottom left is the back template, and in between them is the card styling section.
Anki では、Web ページを書く際に用いる言語である、HTML を使ってテンプレートを書きます。書式指定には Web ページの表示スタイル指定に用いる CSS を使います。
//In Anki, templates are written in HTML, which is the language that web pages are written in. The styling section is CSS, which is the language used for styling web pages.
右側には、現在選択されているカードの表面と裏面のプレビューが表示されています。ノートの追加中にウィンドウを開いた場合、ノートの 追加 (Add Notes) ウィンドウに入力したテキストの内容に基づいてプレビューが表示されます。ノートの編集中にウィンドウ
//On the right is a preview of the front and back of the currently selected card. If you opened the window while adding notes, the preview will be based on the text you had typed into the Add Notes window. If you opened the window while edi
ウィンドウの下部の もっと (More) ボタンからは、カードの名称変更と順番変更、そして以下の2機能が利用できます。
//At the bottom of the window is a More button that gives you options to rename or reorder the cards, as well as the following two options:
-''単語帳を指定'' (Deck Override) オプションでは、現在のカードタイプから生成されるカードが入れられる単語帳を変更することができます。デフォルトでは、カードはノートの 追加 ウィンドウで指定した単語帳に入ります。ここで単語帳を指定した場合、カー
//-The '''Deck Override''' option allows you to change the deck that cards generated from the current card type will be placed into. By default, cards are placed into the deck you provide in the Add Notes window. If you set a deck here, tha
-''ブラウザーの表示設定'' (Browser Appearance) オプションでは、ブラウザーの 質問 (Question) と 解答 (Answer) 列の表示用に、通常より簡略化したテンプレートを設定することができます。詳細は [[ブラウザーの表示設定>2.0/CardsAndTemplates#browser-a
//-The '''Browser Appearance''' option allows you to set different (perhaps simplified) templates for display in the Question and Answer columns of the browser; see [[browser appearance :http://ankisrs.net/docs/manual.html#columntemplates]]
* 反転カード [#reverse-cards]
//* Reverse Cards
YouTube に [[反転カードに関するVideo :http://www.youtube.com/watch?v=DnbKwHEQ1mA]] があります。
//You can watch [[a video about reversing cards :http://www.youtube.com/watch?v=DnbKwHEQ1mA]] on YouTube.
どちらの方向へもカードを作りたい場合(例:"big" → "大きい", "大きい" → "big")、いくつかの方法があります。最も簡単なのは標準ノートタイプの“Basic (and reversed card)”を選択することです。これは両方の方向への2枚のカードを生成します。
//If you want to create cards that go in both directions (e.g., both “ookii”→“big” and “big”→“ookii”), you have several options. The simplest is to select the “Basic (and reversed card)” built-in note type. This will generate two cards, one
特定のマテリアルに対してだけ反転カードを生成したい場合(重要な内容のみ反転カードを学習するのに時間を割きたい場合や、反転カードが意味をなさない場合)、“Basic (optional reversed card)”ノートタイプを使うことができます。このノートタイプでは最初
//If you want to generate reverse cards for only some of your material (perhaps you only want to take the time to study reverses for the most important material, or some of your cards don’t make sense reversed), you can select the “Basic (o
追加した反転カードが不要であると後で判断した場合、“Add Reverse”フィールドからテキストを削除することでそのカードを削除することができます。同様に、反転カードを追加したい場合、“Add Reverse”フィールドにテキストを追加してください。最初にノートタ
//If you later decide you don’t want a reverse card that you added, you can delete it by removing the text from the “Add Reverse” field. Similarly, if you want to add a reverse card, you can add text to the “Add Reverse” field. If you didn’
>''ノート''
//>''Note''
>編集ミスによりスケジュール情報を失うのを避けるため、“Add Reverse”フィールドからテキストを削除してもカードを自動的には削除しません。削除を完了するには、メインウィンドウから ツール→白紙... (Tools→Empty Cards) を実行してください。
//>To avoid loss of scheduling information if you make an editing mistake, Anki does not automatically delete cards after you remove the text from the “add reverse” field. To complete the deletion, run Tools → Empty Cards from the main wind
もっと複雑なノートタイプを使っていて(例えば1つのノートタイプに対して3つのカードなど)、特定の場合にだけ特定のカードを生成したい場合、[[条件付き置換>2.0/CardsAndTemplates#conditional-replacement]] を参照してください。
//If you’re using a more complex note type (for instance, one with three cards) and you wish to generate specific cards only in certain situations, please see the [[conditional replacement :http://ankisrs.net/docs/manual.html#conditionalrep
* 基本的なテンプレート [#basic-templates]
//* Basic Templates
最も基本的なテンプレートはこのようになります:
//The most basic template looks something like this:
{{Front}}
波カッコの中にテキストを入れると、Anki はその名前を持つフィールドを探し、テキストをフィールドの実際の内容で置き換えます。好きなだけ多くのフィールドを含めることができます。
//When you place text within curly brackets, Anki looks for a field by that name, and replaces the text with the actual content of the field. You can include as many fields as you wish.
>''ノート''
>フィールド名は大文字・小文字を区別します。'''Front''' という名前のフィールドがある場合、{{'''front'''}} という記載では正しく動作しません。
//>''Note''
//>Field names are case sensitive. If you have a field named '''Front''', writing {{'''front'''}} will not work properly.
テンプレートに含めるのはフィールドのリストのみではありません。任意のテキストもテンプレートに含むことができます。例えば首都を学習していて、“国”フィールドのあるノートタイプを作成した場合、テンプレートをこのようにすることができます:
//Your templates are not limited to a list of fields. You can also include arbitrary text on your templates. For example, if you’re studying capital cities, and you’ve created a note type with a “Country” field, you might create a front tem
{{国}}の首都は?
// What's the capital city of {{Country}}?
デフォルトの裏面のテンプレートはこのようになります:
//The default back template will look something like this:
{{FrontSide}}
<hr id=answer>
{{Back}}
これの意味は“表面のテキストを表示し、水平線を引いて、Back フィールドを表示せよ”となります。
//This means “show me the text that’s on the front side, then a divider line, and then the Back field”.
'''id=answer''' の部分は質問と解答の間の水平線の位置を Anki に伝えます。これにより、長いカードで '''show answer''' ボタンを押したときに Anki は自動的に解答の開始位置までスクロールします。(特に画面の小さいモバイルデバイスで有効です。)解答
//The '''id=answer''' part tells Anki where the divider is between the question and the answer. This allows Anki to automatically scroll to the spot where the answer starts when you press '''show answer''' on a long card (especially useful
* 回答の確認 [#checking-your-answer]
//* Checking Your Answer
YouTube に [[回答のタイプ入力に関するVideo :http://www.youtube.com/watch?v=5tYObQ3ocrw]] があります。
//You can watch [[a video about this feature :http://www.youtube.com/watch?v=5tYObQ3ocrw]] on YouTube.
&ref(checking-answer.png,,回答タイプ入力の編集画面);
解答をタイプ入力して、入力が実際の答えに正しいか判定させたいと思うかもしれません。テンプレートを変更することにより、これが可能です。表面と裏面のテンプレートが次のようだったとします:
//If you’d like to type in the answer and have Anki compare your input to the real answer, you can do so by changing your template. Imagine your front and back templates look like:
{{Native Word}}
{{FrontSide}}
<hr id=answer>
{{Foreign Word}}
外国語の単語を入力して正しいか確認するには、表面のテンプレートを編集してこのようにします:
//To type in the foreign word and check if you are correct, you need to edit your front template so that it looks like this:
{{Native Word}}
{{type:Foreign Word}}
比較したいフィールドの前に "type:" を追加したことに注意してください。FrontSide は カードの裏面であることから、解答ボックスは裏面にも同様に表示されます。(カードの裏面に FrontSide がない場合、解答側にも "type:" を同様に追加する必要があります
//Note that we have added '''type''': in front of the field we want to compare. Since FrontSide is on the back of the card, the type answer box will appear on the back as well. (If you don’t have FrontSide on the back of your card, you will
復習の際は、文字列を入力できるテキストボックスが表示され、エンターキーを押すか解答を表示ボタンを押すと、どの部分が正しく、どの部分が間違っているかが表示されます。テキストボックスのフォントサイズはフィールドで設定したサイズ(編集時に フィー
//When reviewing, Anki will display a text box where you can type in the answer, and upon hitting enter or showing the answer, Anki will show you which parts you got right and which parts you got wrong. The text box’s font size will be the
この機能では、どのようにカードに解答するかは変わりません。よってどの程度覚えられていたかの判断は依然ユーザー次第です。
//This feature does not change how the cards are answered, so it’s still up to you to decide how well you remembered or not.
>''ノート''
//>''Note''
>カードにつき、1つのタイプ入力比較のみが可能です。上記のテキストを複数回記載した場合、動作しません。単一行のみがサポートされており、複数行で構成されるフィールドの比較にはうまく使えません。
//>Only one typing comparison can be used on a card. If you add the above text multiple times, it will not work. It also only supports a single line, so it is not useful for comparing against a field that is comprised on multiple lines.
解答比較には等幅フォントが使われ、「与えられた」部分と「正しい」部分が並んで表示されます(?((Anki uses a monospaced font for the answer comparison so that the “provided” and “correct” sections line up.)))フォントを上書きしたければ、書式セ
//Anki uses a monospaced font for the answer comparison so that the “provided” and “correct” sections line up. If you wish to override the font, you can put the following at the bottom of your styling section:
code#typeans { font-family: "myfontname"; }
高度なユーザーは標準の type-answer 色を CSS クラス '''typeGood''', '''typeBad''', '''typeMissed''' により変更することができます。このマニュアルの作成時点では、Anki のコンピュータ版のみがこれらのクラスをサポートしています。
//Advanced users can override the default type-answer colours with the css classes '''typeGood''', '''typeBad''' and '''typeMissed'''. At the time of writing, only the computer version of Anki supports these classes.
穴埋め問題カードについても回答をタイプ入力することが可能です。これをするには、{{type:cloze:Text}} を表面と裏面テンプレートに追加し、裏面テンプレートは以下のようになります:
//It is also possible to type in the answer for cloze deletion cards. To do this, add {{type:cloze:Text}} to both the front and back template, so the back looks something like this:
{{cloze:Text}}
{{type:cloze:Text}}
{{Extra}}
穴埋めノートタイプでは FrontSide を使わないため、表面と裏面の両方にこれを追加する必要があります。
//Note that since the cloze type does not use FrontSide, this must be added to both sides on a cloze note type.
複数の穴埋めされた部分がある場合、解答をテキストボックスにカンマ "," で分離して入力することができます。
//If there are multiple sections elided, you can separate the answers in the text box with a comma.
>''ノート''
//>''Note''
>回答入力ボックスはブラウザーの [[プレビューダイアログ>2.0/Browser#current-note]] には表示されません。復習時や、カードタイプウィンドウでプレビューする場合には、表示されます。
//>Type answer boxes will not appear in the [["preview" dialog :http://ankisrs.net/docs/manual.html#currentnote-preview]] in the browser. When you review or look at the preview in the card types window, they will display.
* 改行 [#newlines]
//* Newlines
テンプレート中で改行するには、特別なコマンドが必要です。例えばテンプレートに次を記載した場合:
//The template language needs a special command to create a new line. For example, if you wrote the following in the template:
one
two
プレビューではこのように表示されます:
//In the preview, you’d actually see:
one two
改行するには、行の末尾に <br> コードをこのように追加すつ必要があります:
//To add a new line, you need to add a <br> code to the end of a line, like so:
one<br>
two
br は、改行を表す英単語 "(line) br(eak)" から名づけられました。
//The br code stands for "(line) br(eak)".
フィールドについても同様です。2つのフィールドを別の行に表示したい場合、次のようにしてください。
//The same applies for fields. If you want to display two fields, one on each line, you would use
{{Field 1}}<br>
{{Field 2}}
* カードの表示書式 [#card-styling]
//* Card Styling
YouTube に [[カードの書式に関するVideo :http://www.youtube.com/watch?v=F1j1Zx0mXME]] があります。
//You can watch [[a video about styling cards :http://www.youtube.com/watch?v=F1j1Zx0mXME]] on YouTube.
表面テンプレートと裏面テンプレートの間には、書式があります。ここでは背景色やデフォルトのフォント、テキストの行揃えなどを変更することができます。
//In between the front and back template is the card styling. Here you can change the background colour of the card, the default font, the text alignment, and so on.
>''ノート''
>タイプ入力解答の比較、回答のタイプ入力、編集のテキストボックスのフォントを変更するのはここではありません。これらのフォントを変更するには、checking your answer と customizing fieldsの項目を参照してください。
//NOTE: This is 'not' where you change the font for type answer
//comparisons, type answer textboxes, or editing textboxes; to learn how to
//change these fonts, please see the <<typinganswers,checking your answer>> and
//<<fields,customizing fields>> sections.
利用可能な標準オプションは以下の通りです:
//The standard options available to you are:
:font-family|
:|カードで使うフォントの名称。フォント名にスペースが含まれる場合(例:"MS Unicode")、ダブルクォーテーション(")でフォント名を囲む必要があります。1枚のカードで複数のフォントを使うことも可能です。詳細は以下を参照してください。
//:|The name of the font to use on the card. If your font has spaces in it like "MS Unicode", then you need to surround the font name in double quotes as in this sentence. It is also possible to use multiple fonts on one card; for informati
:font-size|
:|フォントのサイズです(単位:ピクセル)。変更する場合は、後ろの "px" を残してください。
//:|The size of the font in pixels. When changing it, make sure you leave px at the end.
:text-align|
:|テキストの行揃えを指定します(center, left, right)。
//:|Whether the text should be aligned in the center, left, or right.
:color|
:|文字の色です。'''blue''' や '''lightyellow''' などといった色名や、HTML の 色コードで任意の色を指定することもできます。詳細は他の Web ページを参照してください。
//:|The color of the text. Simple color names like '''blue''', '''lightyellow''', and so on will work, or you can use HTML color codes to select arbitrary colors. Please see this webpage for more information.
:background-color|
:|カードの背景の色です。
//:|The color of the card background.
書式にはどのような CSS も用いることができます。高度なユーザーは背景画像を追加したりグラデーションにすることもできます。ある書式をどのように実現できるかを知りたければ、Web で CSS に関する情報を検索すれば、素晴らしい説明文書が数多くみつかりま
//Any CSS can be placed in the styling section - advanced users may wish to do things like add a background image or gradient, for example. If you’re wondering how to get some particular formatting, please search the web for information abo
書式は全てのカード間で共有されます。即ち、ここでの変更はそのノートタイプをもつ全てのカードに影響します。ですがまた、カード特有の書式を指定することも可能です。以下の例は1番目のカードを除くすべてのカードの背景色を黄色にします:
//The styling is shared between all cards, which means that when you make an adjustment it will affect all cards for that note type. It is also possible to specify card-specific styling, however. The following example will use a yellow back
.card { background-color: yellow; }
.card1 { background-color: blue; }
標準では Anki は画像をスクリーンに収まるように縮小することに注意してください。この挙動は、書式の最後に次を指定することで変更できます:
//One other thing to note is that Anki shrinks images to fit the screen by default. You can change this by adding the following to the bottom of your styling section:
img { max-width: none; max-height: none; }
もし画像のスタイルを変更しようとしてマーク付きのカードに表示される星の画像も影響されてしまう場合(たとえば拡大されるなど)、以下のように星の画像を指定できます:
//If you try to change the style for images and find that the star that appears on marked cards is affected (for instance, it becomes way too large), you can target it with the following:
img#star { ... }
* フィールドの表示書式 [#field-styling]
//* Field Styling
デフォルトの書式はカード全体に適用されます。特定のフィールドやカードの一部で異なるフォントや色などを使うようにすることもできます。これは特に外国語を学習する際に重要であり、Anki では正しいフォントが選択されないと文字を正しく表示できない場合
//The default styling applies to the whole card. You can also make certain fields or part of the card use a different font, color, and so on. This is particularly important when studying foreign languages, as Anki will sometimes be unable t
"Expression" フィールドがあり、これに OSX のタイ語フォント "Ayuthaya" を適用させたいとします。テンプレートがすでにこのようになっていることを考えてください:
//Say you have an “Expression” field, and you want to give it the OSX Thai font “Ayuthaya”. Imagine your template already reads:
What is {{Expression}}?
{{Notes}}
必要なことは、書式を用いたいテキストを HTML で囲うことです。以下をテキストの前に追加します:
//What we need to do is wrap the text we want to style in some HTML. We will put the following in front of the text:
<div class=mystyle1>
そして以下をテキストの後ろに追加します:
//And the following behind it:
</div>
上記のようにテキストを囲うことで、囲われたテキストに "mystyle1" というカスタム書式を適用するよう指示することができます。このカスタム書式は後ほど作成します。
//By wrapping the text like the above, we tell Anki to style the wrapped text with a custom style called “mystyle1”, which we will create later.
よって "What is …?" という表現全体にタイ語フォントを適用したければ、以下のようになります:
//Thus if we wanted the entire “What is …?” expression to use the Thai font, we would use:
<div class=mystyle1>What is {{Expression}}?</div>
{{Notes}}
タイ語フォントを expressin フィールドにのみ適用したければ、こうなります:
//And if we wanted only the expression field itself to use the Thai font, we’d use:
What is <div class=mystyle1>{{Expression}}</div>?
{{Notes}}
テンプレートの編集が終わったので、テンプレートの間にある 書式 の欄に移りましょう。編集前には、書式はこのようになっています:
//After we’ve edited the template, we now need to move to the Styling section between the templates. Before editing it, it should look something like:
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
新しいスタイルを下部に付け加え、このようにします:
//Add your new style to the bottom, so it looks like:
.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
.mystyle1 {
font-family: ayuthaya;
}
スタイルには望む書式はどのようなものも含めることができます。フォントサイズも変更したければ、 mystyle1 セクションを次のように変更します:
//You can include any styling you want in the style. If you wanted to increase the font size too, you’d change the mystyle1 section to look like:
.mystyle1 {
font-family: ayuthaya;
font-size: 30px;
}
カスタムのフォントを単語帳に含めることも可能であり、この場合コンピュータやモバイル端末にフォントをインストールする必要はありません。詳細は [[フォントのインストール>2.0/CardsAndTemplates#installing-fonts]] を参照してください。
//It’s also possible to bundle custom fonts with your deck, so you don’t need to install them on your computer or mobile device. Please see the [[installing fonts :http://ankisrs.net/docs/manual.html#installingfonts]] section for more info.
ここで使うことのできる書式についての詳細は [[カードの書式>2.0/CardsAndTemplates#card-styling]] を参照してください。
//Please see the [[card styling :http://ankisrs.net/docs/manual.html#cardstyling]] section for more information on the styling options you can use here.
* ヒントフィールド [#hint-fields]
//* Hint Fields
カードの表面または裏面に追加したフィールドを、明示的に表示させるまで隠しておくことが可能です。これは ''ヒントフィールド'' (hint field) とよばれます。ヒントを追加する前に、質問に答えるのを簡単にすればするほど実際の生活で質問に出会った際に思
//It’s possible to add a field to the front or back of a card, but make it hidden until you explicitly show it. We call this a '''hint field'''. Before adding a hint, please bear in mind that the easier you make it to answer a question in A
最初に、ヒントを記入するフィールドを追加してください。やり方がわからなければ [[フィールド>2.0/AddingMaterial#customizing-fields]] の項目を参照してください。
//First, you’ll need to add a field to store the hint in if you have not already. Please see the [[fields :http://ankisrs.net/docs/manual.html#fields]] section if you’re not sure how to do this.
"MyField" という名前のフィールドを追加したとすると、次のようにしてカードにヒントフィールドを表示できます:
//Assuming you’ve created a field called MyField, you can tell Anki to include it on the card but hide it by default by adding the following to your template:
{{hint:MyField}}
これにより "show hint" というリンクが追加されます。これをクリックすると、フィールドの内容がカードに表示されます。(MyField が空白であれば、何も表示されません。)
//This will show a link labeled “show hint”; when you click it, the content of the field will be displayed on the card. (If MyField is empty, nothing will be shown.)
ヒントを表示してから解答を表示すると、ヒントはもう一度隠れます。解答表示時に常にヒントを表示したければ、裏面のテンプレートから {{FrontSide}} を削除して手動で表示したいフィールドを追加する必要があります。
//If you show the hint on the question and then reveal the answer, the hint will be hidden again. If you want to have the hint always revealed when the answer is shown, you will need to remove {{FrontSide}} from your back template and manua
>''ノート''
//>''Note''
>ヒントフィールドを音声で使うことはできません。音声はヒントのリンクをクリックしたかどうかにかかわらず常に再生されます。
//>It is not currently possible to use a hint field for audio ― the audio will play regardless of whether you’ve clicked on the hint link.
* 特別なフィールド [#special-fields]
//* Special Fields
テンプレートで利用可能な、特別なフィールドがあります:
//There are some special fields you can include in your templates:
ノートのタグ: {{Tags}}
ノートのタイプ: {{Type}}
カードの含まれる単語帳: {{Deck}}
カードの含まれる最下層の単語帳: {{Subdeck}}
カードのタイプ("Forward" など): {{Card}}
フロント面テンプレート内容(バック面テンプレートでのみ有効): {{FrontSide}}
// The note's tags: {{Tags}}
//
// The type of note: {{Type}}
//
// The card's deck: {{Deck}}
//
// The card's subdeck: {{Subdeck}}
//
// The type of card ("Forward", etc): {{Card}}
//
// The content of the front template (only valid in back template): {{FrontSide}}
FrontSide には、カードのフロント面にあった音声は含まれません。カードのフロントとバックで同じ音声の再生を行いたい場合、バック面にも手動で音声フィールドを追加する必要があります。
//FrontSide will not include any audio that was on the front side of the card. If you wish to have the same audio play on both the front and back of the card, you’ll need to manually include the audio fields on the back as well.
他のフィールドと同様に、特別なフィールド名も大文字・小文字を区別します。
//As with other fields, special field names are case sensitive.
* カードの生成と削除 [#card-generation-and-deletion]
//* Card Generation & Deletion
カードの表面が空白の場合、そのカードは生成されません。よって例えば "My Field" が空欄であり表面テンプレートがそのフィールドのみしか含まない場合、そのカードは生成されません。
//Anki will not create cards with empty front sides. Thus if “My Field” was empty, and one card’s front template included only that field, the card would not be created.
全ての表面が空白でありカードが1枚も作れない場合、Add Notes ウィンドウは警告を表示し、少なくとも1枚のカードが生成されるまでノートの追加をすることはできません。
//If no cards can be created because all of the cards would have empty front sides, then the Add Notes window will warn you and not allow the note to be added until at least one card would be generated.
以前に追加したノートを編集し、前回は空白であったカードが今回は空白ではなくなった場合、追加のカードが自動的に生成されます。反対に今回の編集で空白に変わった場合には、そのカードはすぐには削除されず、間違いによるデータ喪失を防止します。空白のカ
//When you edit a previously added note, Anki will automatically create extra cards if they were previously blank but no longer are. If your edits have made some cards blank when they previously were not, however, Anki will not delete them
カードの生成の動作の仕方により、手動で個々のカードを削除するのは不可能です(次回にノートが編集された際に自動的に再生成されてしまいます)。代わりに関係する条件付き置換フィールドを空白にし、Empty Cards オプションを使うべきです。(カードの生成
//Because of the way that card generation works, it is not possible to manually delete individual cards (they would just end up being recreated the next time the note was edited). Instead, you should make the relevant conditional replacemen
カード生成には特別なフィールドやフィールドではないテキストは考慮しません。よって表面テンプレートが次の場合、"国名" フィールドが空白であればカードは生成されません:
//Anki does not consider special fields or non-field text for the purposes of card generation. Thus if your front template looked like the following, no card would be generated if Country was empty:
{{国名}} は地図のどこにある?
// Where is {{Country}} on the map?
* 選択的なカード生成 [#selective-card-generation]
//* Selective Card Generation
これを読む前に、前の [[カードの生成と削除>2.0/CardsAndTemplates#card-generation-and-deletion]] の項目を読んでください。
//Please read the previous section on [[card generation and deletion :http://ankisrs.net/docs/manual.html#cardgeneration]] before you read this.
マテリアルの一部についてのみ追加のカードを生成したい場合があると思います。例えば重要な単語についてのみ想起できるかをテストしたい場合などです。これを実現するには、ノートにフィールドを追加し、追加カードが欲しい場合にはそのフィールドに何かの文
//Sometimes you may want to generate extra cards for only some of your material, such as testing your ability to recall the most important words of a set. You can accomplish this by adding an extra field to your note, and adding some text i
* メディア参照とLaTeX参照 [#media-and-latex-references]
//* Media & LaTeX References
Anki ではテンプレートでのメディア参照を解析しません。そうすると動作が遅くなるからです。これにより、テンプレートにメディアを含める場合には制約事項が発生します。
//Anki does not scan templates for media references, because it is slow to do so. This has implications for including media on the template.
** 静的な音声や画像 [#static-sounds-or-images]
//** Static Sounds/Images
全てのカードに共通な画像や音声を追加したければ(例:前カードの上部に会社のロゴを表示するなど):
//If you wish to include images or sounds on your cards that are the same for every card (eg, a company logo at the top of each card):
+ファイルの名前を下線で始まる名前に変更する(例:"_logo.jpg")。下線のついたファイル名は、テンプレートに使われており、公開された単語帳へのエクスポートに含まれるべきだという意味になります。
+表面または裏面テンプレートで、メディアへの参照を追加します:
//+Rename the file so it starts with an underscore, eg "_logo.jpg". The underscore tells Anki that the file is used by the template and it should be exported when sharing the deck.
//+Add a reference to the media on your front or back template, like:
<img src="_logo.jpg">
** フィールド参照 [#field-references]
//** Field References
フィールドへのメディア参照は認められていません。復習中に表示されるかは不明であり、未使用メディアのチェックや、インポートやエクスポートなどの機能で正しく動作しません。動かない例としては:
//Media references to fields are not allowed. They may or may not display during review, and will not work when checking for unused media, importing/exporting, and so on. Examples that won’t work:
<img src="{{Expression}}.jpg">
[sound:{{Word}}]
[latex]{{Field 1}}[/latex]
代わりに、フィールドにメディア参照を追加すべきです。詳しくは [[インポート>2.0/Importing]] の項目を参照してください。
//Instead, you should include the media references in the field. Please see the [[importing :http://ankisrs.net/docs/manual.html#importing]] section for more information.
* 条件付き置換 [#conditional-replacement]
//* Conditional Replacement
フィールドが空白の場合、または空白でない場合にのみ特定の文字列やフィールド、HTML を追加することが可能です。例えば:
//It is possible to include certain text, fields, or HTML on your cards only if a field is empty or not empty. An example:
// This text is always shown.
この文字列は常に表示されます。
{{#FieldName}}
// This text is only shown if FieldName has text in it
この文字列は FieldName に文字列がある場合にのみ表示されます。
{{/FieldName}}
{{^FieldName}}
// This text is only shown if FieldName is empty
この文字列は FieldName が空白の場合にのみ表示されます。
{{/FieldName}}
実際の例としては、フィールドが空白でない場合にのみラベルを表示するような場合があります:
//A real life example is only showing a label if the field is not empty:
{{#Tags}}タグ: {{Tags}}{{/Tags}}
// {{#Tags}}Tags: {{Tags}}{{/Tags}}
Note フィールドを含むカードについてだけ、表面の特定フィールドを青く表示したい場合(例えば記憶のために Note を追加しており、回答の想起に時間をかけたい場合)、フィールドを次のように書式設定することができます:
//Or say you want to display a specific field in blue on the front of your card if there are extra notes on the back (perhaps the fact that there are notes serves as a reminder that you should spend more time thinking about the answer). You
{{#Notes}}<span style="color:blue;">{{/Notes}}
{{FieldToFormat}}
{{#Notes}}</span>{{/Notes}}
どのカードが生成されるのかをコントロールするため、条件付き置換を使うことができます。カードの表面が空白の場合には [[カードが生成されない>2.0/CardsAndTemplates#card-generation-and-deletion]] ことを利用しています。例えば、表面に2つのフィールド
//You can also use conditional replacement to control which cards are generated. This works since Anki will not [[generate cards :http://ankisrs.net/docs/manual.html#cardgeneration]] which would have a blank front side. For example, conside
{{Expression}}
{{Notes}}
通常、Expression と Note フィールドのいずれかに文字列がある場合にカードが生成されます。Expression が空白でない場合にのみカードを生成したければ、テンプレートをこのように変更できます:
//Normally a card would be generated if either the expression or notes field had text in it. If you only wanted a card generated if expression was not empty, then you could change the template to this:
{{#Expression}}
{{Expression}}
{{Notes}}
{{/Expression}}
両方のフィールドが必要であれば、2つの条件付き置換を使うことができます:
//And if you wanted to require both fields, you could use two conditional replacements:
{{#Expression}}
{{#Notes}}
{{Expression}}
{{Notes}}
{{/Notes}}
{{/Expression}}
[[カードの生成>2.0/CardsAndTemplates#card-generation-and-deletion]] で述べたように、これは条件付き置換のコードをカードの ''''表面'''' に置いた場合にのみ動作することに注意してください。裏面でこれを行うと、単にカードの裏面が空白となるだけです
//Keep in mind that, as mentioned in the [[card generation :http://ankisrs.net/docs/manual.html#cardgeneration]] section, this only works when you place the conditional replacement code on the ''''front'''' of the card; if you do this on th
{{#Expression}}
{{Expression}}
{{/Expression}}
{{Notes}}
デフォルトでの動作は "OR" 条件だと考えることができます。カードが生成されるのは、最初のフィールドが空白でなく、または 2つ目のフィールドが空白でなく・・・という場合です。上記の例での動作は "AND" 条件だと考えることができます。カードが生成され
//The default behaviour can be thought of as an "OR" condition - cards are created if the first field is non-empty, OR the second field is non-empty, and so on. The behaviour above can be thought of as an "AND" condition - cards are created
Anki では AND と OR の条件を混ぜて使うことはできない点に注意してください。よって、「Expression と Note、または Field 3 が必要」を意図した次のテンプレートは動作しません。
//A caveat: Anki is not currently able to mix AND and OR conditions. Thus the following template, which says "require expression and notes, or field 3", would not work:
{{#Expression}}
{{#Notes}}
{{Expression}}
{{Notes}}
{{/Notes}}
{{/Expression}}
{{Field 3}}
カード生成をコントロールするために否定表現を使うことはできないことにも注意してください。つまり、テンプレートを {{^Field}} で囲んでも期待したような動作をしません。
//Another caveat is that negated expressions can not be used to control card generation. That is, wrapping a template in {{^Field}} will not do what you expect.
* 穴埋めテンプレート [#cloze-templates]
//* Cloze Templates
背景情報は [[穴埋め問題>2.0/Editing#cloze-deletion]] の項目を参照してください。
//Please see the [[cloze deletion :http://ankisrs.net/docs/manual.html#cloze]] section for background info.
穴埋めノートタイプは、通常のノートタイプとは異なった動作をします。カードタイプの数がカスタマイズ可能な代わりに、穴埋めノートには全ての穴埋め問題で共有される単一のタイプを持ちます。
//The cloze note type functions differently from regular note types. Instead of a customizable number of card types, it has a single type which is shared by all cloze deletions on a note.
上記のカード生成の項目で述べたように、通常のカードが生成されるかどうかは質問の1つ以上のフィールドが空白でないことに依存します。穴埋めノートタイプでは異なって生成されます:
//As mentioned in the card generation section above, generation of regular cards depends on one or more fields on the question being non-empty. Cloze deletion note types are generated differently:
-表面テンプレートから1つ以上の穴埋め置換({{cloze:FieldName}} など)を探します。
-FieldName フィールドで全ての穴埋め参照({{c1::text}} など)を探します。
-別々の番号のそれぞれについて、カードが生成されます。
//-Anki looks on the front template for one or more cloze replacements, like {{cloze:FieldName}}.
//-It then looks in the FieldName field for all cloze references, like {{c1::text}}.
//-For each separate number, a card will be generated.
条件付き生成では特別なフィールドが提供され、どのカードが表示されるのかを判断できます。最初の穴埋めには "ヒント1" フィールド、2つ目の穴埋めには "ヒント2" フィールドを表示させたければ、次のテンプレートが使えます。
//Conditional generation provides a special field so you can check which card you are rendering. If you wanted to display the "hint1" field on the first cloze, and "hint2" field on the second cloze for example, you could use the following t
{{cloze:Text}}
{{#c1}}
{{ヒント1}}
// {{Hint1}}
{{/c1}}
{{#c2}}
{{ヒント2}}
// {{Hint2}}
{{/c2}}
* 他のHTML [#other-html]
//* Other HTML
テンプレートでは任意のHTMLを使用することができます。よってインターネットの Web ページで利用可能な全てのレイアウトを、カードでも用いることができます。表、リスト、画像、外部ページへのリンクなどもすべてサポートされます。例えば表を用いてレイア
//Your templates can contain arbitrary HTML, which means that all the layout possibilities used on internet web pages can also be used on your cards. Things like tables, lists, images, links to external pages and so on are all supported. Wi
全ての HTML の機能を説明するのは、このマニュアルの範囲外です。HTML についてもっと知りたい場合、Web 上には HTML の良い説明資料が多数あります。
//Covering all of HTML’s features is outside the scope of this manual, but there are plenty of good introductory guides to HTML available on the web if you’d like to learn more.
* 辞書へのリンク [#dictionary-links]
//* Dictionary Links
フィールドの置換を利用して、辞書へのリンクを作成できます。言語の学習中をしており、オンラインの辞書が次のような URL を使った単語検索に対応している場合を想像してください:
//You can also use field replacement to create dictionary links. Imagine you’re studying a language and your favourite online dictionary allows you to search for text using a web URL like:
http://example.com/search?q=myword
次のテンプレートで、リンクを自動的に生成することができます:
//You could add an automatic link by doing the following in your template:
{{Expression}}
<a href="http://example.com/search?q={{Expression}}">check in dictionary</a>
上のテンプレートにより、復習中にリンクをクリックすることで、各ノートの表現を検索することができます。これには注意事項があり、次のセクションも確認してください。
//The template above would allow you to search for each note’s expression by clicking on the link while reviewing. There is a caveat however, so please see the next section.
* HTMLの除去 [#html-stripping]
//* HTML Stripping
テンプレートと同様に、フィールドは HTML で保存されます。上記の辞書リンク例では、expressionが "myword" という単語を書式なしで保持していれば、HTML も同様に "myword" です。しかしフィールドに書式指定が含まれていれば、フィールドには追加の HTML
//Like templates, fields are stored in HTML. In the dictionary link example above, if the expression contained the word "myword" without any formatting, then the HTML would be the same: "myword". But when you include formatting in your fiel
辞書リンクなどにおいては、これが問題となります。上記の HTML を含む例では、辞書リンクはこうなります:
//This can present a problem for things like dictionary links. In the above example, the dictionary link would end up being:
<a href="http://example.com/search?q=<b>myword</b>">check in dictionary</a>
リンクでの余分な文字は辞書サイトを混乱させ、マッチした情報を得られないでしょう。
//The extra characters in the link would likely confuse the dictionary site, and you’re likely not to get any matches.
これを解決するため、Anki では置換時にフィールドから書式指定を除去する機能が用意されています。フィールド名のに "text:" を追加すると、いかなる書式も含まれません。よって書式付きのフィールドでも動作する辞書へのリンクはこうなります:
//To solve this, Anki provides the ability to strip formatting from fields when they are replaced. If you prefix a field name with text:, Anki will not include any formatting. So a dictionary link that worked even with formatted text would
<a href="http://example.com/search?q={{text:Expression}}">check in dictionary</a>
* ブラウザーの表示設定 [#browser-appearance]
//* Browser Appearance
カードのテンプレートが複雑な場合、[[カードリスト>2.0/Browser#card-list]] の 質問 (question) と 解答 (answer) 列を読むのが難しくなります。''ブラウザーの表示設定'' (browser appearance) オプションではブラウザーでのみ使用されるカスタムのテンプ
//If your card templates are complex, it may be difficult to read the question and answer columns (called "Front" and "Back") in the [[card list :http://ankisrs.net/docs/manual.html#cardlist]]. The "browser appearance" option allows you to
* RTL (right to left) テキスト [#templatertl]
//* RTL (right to left) text
右から左へと読む言語を勉強している場合、テンプレートをこのように調整する必要があります。
//If you’re learning a language that reads from right to left, you’ll need to adjust the template like so:
<div dir=rtl>{{FieldThatHasRTLTextInIt}}</div>
もしリンクから直接この説明まで飛んできた場合、更なる情報はこのページの最初を確認してください。
//If you were linked directly here, please see the start of this section for more information.
* プラットフォーム固有のCSS [#platform-specific-css]
//* Platform-Specific CSS
Anki では、プラットフォームごとに異なる書式を定義するため、特別な CSS クラスを定義しています。例えば以下ではプラットフォームに応じて復習中の表示フォントを変更します。
//Anki defines some special CSS classes that allow you to define different styling for different platforms. The example below shows how to vary the font depending on where you’re reviewing:
.win .jp { font-family: "MS Mincho"; }
.mac .jp { font-family: "Hiragino Mincho Pro"; }
.linux .jp { font-family: "Kochi Mincho"; }
.mobile .jp { font-family: "Hiragino Mincho ProN"; }
テンプレートでは:
//And in the template:
<div class=jp>{{Field}}</div>
For different iOS devices, you can use '.iphone' and '.ipad'.
AnkiWeb を Web ブラウザーで利用中には .gecko, .opera, .ie のプロパティも使うことができます。オプションの全リストは http://rafael.adm.br/css_browser_selector/ を参照してください。
//You can also use properties like .gecko, .opera, and .ie to select particular browsers when using AnkiWeb. Please see http://rafael.adm.br/css_browser_selector/ for a full list of options.
* フォントのインストール [#installing-fonts]
//* Installing Fonts
Anki を職場や学校のコンピュータで使っており、新しいフォントのインストールをする権限がない場合や、Anki をモバイル端末で使っている場合には、Anki に直接フォントを追加することができます。
//If you’re using Anki on a work or school computer where you don’t have permission to install new fonts, or you’re using Anki on a mobile device, it’s possible to add fonts directly to Anki.
Anki にフォントを追加するには、TrueType フォントでなければなりません。TrueType フォントのファイル名は .ttf で終わります(例:Arial.ttf)。一度 TrueType フォントを配置したら、それをメディアフォルダーに追加する必要があります:
//To add a font to Anki, it must be in the TrueType format. TrueType fonts have a filename ending in .ttf, such as "Arial.ttf". Once you’ve located a TrueType font, we’ll need to add it to the media folder:
+ファイル名を最初に下線のついた名称に変更します(例:"_arial.ttf")。下線の追加はそのファイルがテンプレートで使われていることを意味し、未使用メディアのチェックで削除されません。
+コンピュータのファイルブラウザで "Documents" フォルダーの中の Anki フォルダーを開いてください。その中の"User 1" という名前(プロファイルの変更・追加をしている場合にはプロファイル名)のフォルダーを開いてください。
+フォルダー内部に "collection.media" というフォルダーがあります。名称を変更したファイルをそのフォルダーに入れてください。
//+Rename the file, adding an underscore at the start, so it becomes like "_arial.ttf". Adding an underscore will tell Anki that this file will be used on a template, and should not be deleted when checking for unused media.
//+In your computer’s file browser, go to your Documents folder, then the Anki folder inside it, and then a folder called "User 1" (or your profile name if you’ve renamed/added profiles).
//+Inside the folder, you should see a folder called collection.media. Drag the renamed file to that folder.
これを終えたら、テンプレートを更新する必要があります:
//After that, we need to update the template:
+メイン画面の上部から "Add" をクリックし、左上のボタンから変更したいノートタイプを選択してください。
+"Cards" をクリックします。
+書式セクションで、下 (after the last "}" character) に次のテキストを追加します("_arial.ttf" をメディアフォルダーにコピーしたファイル名に置き換えてください)。
//+Click ''Add'' at the top of the main screen, and then select the note type you want to change with the top left button.
//+Click ''Cards''.
//+In the styling section, add the following text to the bottom (after the last "}" character), replacing "_arial.ttf" with the name of the file you copied into your media folder:
@font-face { font-family: myfont; src: url('_arial.ttf'); }
>''ノート''
>"arial" の部分だけを変更し、"myfont" の部分は変更しないでください。
//>''Note''
//>Only change the "arial" part, not the "myfont" part.
この後、フォントを全てのカードに適用することも、個々のフィールドに適用することも可能です。すべてのコードのフォントを変えるには、.card セクションに "font-family:" の行を追加してフォントを "myfont" に変更してください。特定のフィールドのみのフ
//After that, you can either change the font for the entire card, or for individual fields. To change the font for the entire card, simply locate the font-family: line in the .card section and change the font to "myfont". To change the font
>''ノート''
//>''Note''
>ファイル名が正確に一致することを確認してください。ファイル名が arial.TTF であり、カードのテンプレートに arial.ttf と書いた場合には、うまく動作しません。
//>Please make sure the filenames match exactly. If the file is called arial.TTF and you write arial.ttf in your card templates, it will not work.
** Macでのフォント [#fonts-on-a-mac]
//** Fonts on a Mac
埋め込みフォントは今のところ OS X では動作しません。カスタムのフォントを使うことは可能ですが、システム側にインストールされている必要があります。
//Embedded fonts currently do not work on OS X. It is still possible to use custom fonts, but they need to be installed system wide.
システムにフォントをインストールするには、http://support.apple.com/kb/HT2435?viewlocale=en_US&locale=en_US を参照してください。
//To install a font on your system, please see http://support.apple.com/kb/HT2435?viewlocale=en_US&locale=en_US
Mac ではシステムフォント、他の環境では組み込みフォントを使うように設定できます。
//You can set up Anki to use the system font on a Mac computer, and an embedded font elsewhere.
表面と背面のテンプレートで、書式を変えたいフィールドを次のコードで囲ってください("FieldName" を実際のフィールド名に変えてください):
//On your front or back template, wrap the field you want to style in the following code, replacing "FieldName" with the name of your field.
<span class="mystyle">{{FieldName}}</span>
書式セクションでは、上述の font-face 行に加え、以下を追加します:
//In the styling section, in addition to the font-face line described above, add the following:
.mystyle { font-family: myfont; }
.mac .mystyle { font-family: Helvetica; }
"Helvetica" をシステムにインストールしたフォント名で置き換えてください。"myfont" はあなたが組み込んだフォントへの参照であるため、変えずにそのままにしてください。
//Replace "Helvetica" with the name of the font you installed on your system. Keep "myfont" as is, as it references the font you embedded.
* ナイトモード [#Night Mode] [#y6441335]
//* Night Mode
設定画面で夜間モードが有効になっている場合のテンプレートの表示方法をカスタマイズできます。
黒ではなく灰色の背景が必要な場合は、次のようなものを使用できます。
.card.nightMode {background-color:#555; }
myclassスタイルがある場合、夜間モードが有効になっていると、次のテキストが黄色で表示されます。
.nightMode .myclass {色:黄色; }
* Javascript [#javascript]
//* Javascript
Anki カードは Web ページとして取り扱われるため、カードに Javascript をインラインスクリプトタグとして埋め込むことが可能です (loading external files using src= is not supported)。これは高度な機能であり、特定の Javascript が動作することを保証
//As Anki cards are treated like webpages, it is possible to embed some Javascript on your cards via inline script tags in the template (loading external files using src= is not supported). As this is an advanced feature, we can not guarant
カード表示の実装は Anki クライアントごとに異なっており、プラットフォームごとに動作のテストをする必要があります。多くのクライアントでは長い期間 Webページを保持し、カードの復習時に動的に部分をアップデートします。よって Javascript では documen
//Each Anki client may implement card display differently, so you will need to test the behaviour across platforms. A number of clients are implemented by keeping a long running webpage and dynamically updating parts of it as cards are revi
window.alert のような関数も利用できません。Anki は Javascript エラーをターミナルに出力するので、Mac や Windows コンピュータを使用している場合、手動でエラーをキャッチしてファイルに書き出し、内容を確認する必要があります。デバッガは利用不可能
//Functions like window.alert are also not available. Anki will write javascript errors to the terminal, so if you’re running on a Mac or Windows computer, you’ll need to manually catch the errors and write them to the document to see them.
ページ名: