aboutsummaryrefslogtreecommitdiff
path: root/tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'tmpl')
-rw-r--r--tmpl/kanji-list.html53
-rw-r--r--tmpl/kanji.html48
-rw-r--r--tmpl/term-definition.html16
-rw-r--r--tmpl/term-grouped-list.html8
-rw-r--r--tmpl/term-grouped.html37
-rw-r--r--tmpl/term-list.html65
-rw-r--r--tmpl/term.html29
7 files changed, 116 insertions, 140 deletions
diff --git a/tmpl/kanji-list.html b/tmpl/kanji-list.html
index 1df22e68..ffc25c24 100644
--- a/tmpl/kanji-list.html
+++ b/tmpl/kanji-list.html
@@ -1,7 +1,58 @@
+{{#*inline kanji}}
+<div class="kanji-definition">
+ <div class="action-bar">
+ {{#if addable}}
+ <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="img/add_kanji.png"></a>
+ {{/if}}
+ </div>
+
+ <div class="kanji-glyph">{{character}}</div>
+
+ <div class="kanji-reading">
+ <table>
+ <tr>
+ <th>Kunyomi:</th>
+ <td>
+ {{#each kunyomi}}
+ {{.}}{{#unless @last}}, {{/unless}}
+ {{/each}}
+ </td>
+ </tr>
+ <tr>
+ <th>Onyomi:</th>
+ <td>
+ {{#each onyomi}}
+ {{.}}{{#unless @last}}, {{/unless}}
+ {{/each}}
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div class="kanji-tags">
+ {{#each tags}}
+ <span class="tag tag-{{category}}" title="{{notes}}">{{name}}</span>
+ {{/each}}
+ </div>
+
+ <div class="kanji-glossary">
+ {{#if glossary.[1]}}
+ <ol "kanji-glossary-group">
+ {{#each glossary}}
+ <li><span class="kanji-glossary-item">{{.}}</span></li>
+ {{/each}}
+ </ol>
+ {{else}}
+ <div class="kanji-glossary-group kanji-glossary-item">{{glossary.[0]}}</div>
+ {{/if}}
+ </div>
+</div>
+{{/inline}}
+
{{#if definitions}}
{{#each definitions}}
{{#unless @first}}<hr>{{/unless}}
- {{> kanji.html addable=../addable root=../root}}
+ {{> kanji addable=../addable root=../root}}
{{/each}}
{{else}}
<p>No results found</p>
diff --git a/tmpl/kanji.html b/tmpl/kanji.html
deleted file mode 100644
index bb4ce61f..00000000
--- a/tmpl/kanji.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<div class="kanji-definition">
- <div class="action-bar">
- {{#if addable}}
- <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="img/add_kanji.png"></a>
- {{/if}}
- </div>
-
- <div class="kanji-glyph">{{character}}</div>
-
- <div class="kanji-reading">
- <table>
- <tr>
- <th>Kunyomi:</th>
- <td>
- {{#each kunyomi}}
- {{.}}{{#unless @last}}, {{/unless}}
- {{/each}}
- </td>
- </tr>
- <tr>
- <th>Onyomi:</th>
- <td>
- {{#each onyomi}}
- {{.}}{{#unless @last}}, {{/unless}}
- {{/each}}
- </td>
- </tr>
- </table>
- </div>
-
- <div class="kanji-tags">
- {{#each tags}}
- <span class="tag tag-{{category}}" title="{{notes}}">{{name}}</span>
- {{/each}}
- </div>
-
- <div class="kanji-glossary">
- {{#if glossary.[1]}}
- <ol "kanji-glossary-group">
- {{#each glossary}}
- <li><span class="kanji-glossary-item">{{.}}</span></li>
- {{/each}}
- </ol>
- {{else}}
- <div class="kanji-glossary-group kanji-glossary-item">{{glossary.[0]}}</div>
- {{/if}}
- </div>
-</div>
diff --git a/tmpl/term-definition.html b/tmpl/term-definition.html
deleted file mode 100644
index 03356a59..00000000
--- a/tmpl/term-definition.html
+++ /dev/null
@@ -1,16 +0,0 @@
-{{#if tags}}
-<div class="term-tags">
- {{#each tags}}
- <span class="tag tag-{{category}}" title="{{notes}}">{{name}}</span>
- {{/each}}
-</div>
-{{/if}}
-{{#if glossary.[1]}}
-<ul class="term-glossary-group">
- {{#each glossary}}
- <li><span class="term-glossary-item">{{.}}</span></li>
- {{/each}}
-</ul>
-{{else}}
-<div class="term-glossary-group term-glossary-item">{{glossary.[0]}}</div>
-{{/if}}
diff --git a/tmpl/term-grouped-list.html b/tmpl/term-grouped-list.html
deleted file mode 100644
index 4bc9406c..00000000
--- a/tmpl/term-grouped-list.html
+++ /dev/null
@@ -1,8 +0,0 @@
-{{#if definitions}}
- {{#each definitions}}
- {{#unless @first}}<hr>{{/unless}}
- {{> term-grouped.html addable=../addable playback=../playback}}
- {{/each}}
-{{else}}
- <p>No results found</p>
-{{/if}}
diff --git a/tmpl/term-grouped.html b/tmpl/term-grouped.html
deleted file mode 100644
index 93281ee9..00000000
--- a/tmpl/term-grouped.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<div class="term-definition">
- <div class="action-bar">
- {{#if addable}}
- <a href="#" title="Add term as expression" class="action-add-note pending disabled" data-mode="term_kanji" data-index="{{@index}}"><img src="img/add_term_kanji.png"></a>
- <a href="#" title="Add term as reading" class="action-add-note pending disabled" data-mode="term_kana" data-index="{{@index}}"><img src="img/add_term_kana.png"></a>
- {{/if}}
- {{#if playback}}
- <a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="img/play_audio.png"></a>
- {{/if}}
- </div>
-
- {{#if reading}}
- <div class="term-expression"><ruby>{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}<rt>{{reading}}</rt></ruby></div>
- {{else}}
- <div class="term-expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
- {{/if}}
-
- {{#if reasons}}
- <div class="term-reasons">
- {{#each reasons}}
- <span class="reasons">{{.}}</span> {{#unless @last}}&laquo;{{/unless}}
- {{/each}}
- </div>
- {{/if}}
-
- <div class="term-glossary">
- {{#if definitions.[1]}}
- <ol>
- {{#each definitions}}
- <li>{{> term-definition.html}}</li>
- {{/each}}
- </ol>
- {{else}}
- {{> term-definition.html definitions.[0]}}
- {{/if}}
- </div>
-</div>
diff --git a/tmpl/term-list.html b/tmpl/term-list.html
index 1315d132..3c85b547 100644
--- a/tmpl/term-list.html
+++ b/tmpl/term-list.html
@@ -1,7 +1,70 @@
+{{#*inline "definition"}}
+ {{#if tags}}
+ <div class="term-tags">
+ {{#each tags}}
+ <span class="tag tag-{{category}}" title="{{notes}}">{{name}}</span>
+ {{/each}}
+ </div>
+ {{/if}}
+ {{#if glossary.[1]}}
+ <ul class="term-glossary-group">
+ {{#each glossary}}
+ <li><span class="term-glossary-item">{{.}}</span></li>
+ {{/each}}
+ </ul>
+ {{else}}
+ <div class="term-glossary-group term-glossary-item">{{glossary.[0]}}</div>
+ {{/if}}
+{{/inline}}
+
+{{#*inline "term"}}
+<div class="term-definition">
+ <div class="action-bar">
+ {{#if addable}}
+ <a href="#" title="Add term as expression" class="action-add-note pending disabled" data-mode="term_kanji" data-index="{{@index}}"><img src="img/add_term_kanji.png"></a>
+ <a href="#" title="Add term as reading" class="action-add-note pending disabled" data-mode="term_kana" data-index="{{@index}}"><img src="img/add_term_kana.png"></a>
+ {{/if}}
+ {{#if playback}}
+ <a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="img/play_audio.png"></a>
+ {{/if}}
+ </div>
+
+ {{#if reading}}
+ <div class="term-expression"><ruby>{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}<rt>{{reading}}</rt></ruby></div>
+ {{else}}
+ <div class="term-expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
+ {{/if}}
+
+ {{#if reasons}}
+ <div class="term-reasons">
+ {{#each reasons}}
+ <span class="reasons">{{.}}</span> {{#unless @last}}&laquo;{{/unless}}
+ {{/each}}
+ </div>
+ {{/if}}
+
+ <div class="term-glossary">
+ {{#if grouped}}
+ {{#if definitions.[1]}}
+ <ol>
+ {{#each definitions}}
+ <li>{{> definition}}</li>
+ {{/each}}
+ </ol>
+ {{else}}
+ {{> definition definitions.[0]}}
+ {{/if}}
+ {{else}}
+ {{> definition}}
+ {{/if}}
+ </div>
+</div>
+{{/inline}}
+
{{#if definitions}}
{{#each definitions}}
{{#unless @first}}<hr>{{/unless}}
- {{> term.html addable=../addable playback=../playback}}
+ {{> term grouped=../grouped addable=../addable playback=../playback}}
{{/each}}
{{else}}
<p>No results found</p>
diff --git a/tmpl/term.html b/tmpl/term.html
deleted file mode 100644
index 0e19dbf4..00000000
--- a/tmpl/term.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<div class="term-definition">
- <div class="action-bar">
- {{#if addable}}
- <a href="#" title="Add term as expression" class="action-add-note pending disabled" data-mode="term_kanji" data-index="{{@index}}"><img src="img/add_term_kanji.png"></a>
- <a href="#" title="Add term as reading" class="action-add-note pending disabled" data-mode="term_kana" data-index="{{@index}}"><img src="img/add_term_kana.png"></a>
- {{/if}}
- {{#if playback}}
- <a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="img/play_audio.png"></a>
- {{/if}}
- </div>
-
- {{#if reading}}
- <div class="term-expression"><ruby>{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}<rt>{{reading}}</rt></ruby></div>
- {{else}}
- <div class="term-expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
- {{/if}}
-
- {{#if reasons}}
- <div class="term-reasons">
- {{#each reasons}}
- <span class="reasons">{{.}}</span> {{#unless @last}}&laquo;{{/unless}}
- {{/each}}
- </div>
- {{/if}}
-
- <div class="term-glossary">
- {{> term-definition.html}}
- </div>
-</div>