aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-09-15 13:18:21 -0700
committerAlex Yatskov <alex@foosoft.net>2017-09-15 13:18:21 -0700
commit39e38d56657b9b11f49af96d84c819e6b6fcec8d (patch)
treeeede1627219e59ccc4411d2ec7d4bc4e30848cc5
parentd3d760ed6c779e03713ef4946a76bf89a4647bcb (diff)
improve kanji template
-rw-r--r--ext/bg/js/templates.js70
-rw-r--r--tmpl/kanji.html73
2 files changed, 74 insertions, 69 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 1c059365..d26feec8 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -29,15 +29,14 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Alt + Up/Down/Home/End/PgUp/PgDn)\" alt>\n </div>\n\n <div class=\"glyph\">"
+ container.escapeExpression(((helper = (helper = helpers.character || (depth0 != null ? depth0.character : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"character","hash":{},"data":data}) : helper)))
- + "</div>\n\n <div class=\"reading\">\n <table>\n <tr>\n <th>Kunyomi:</th>\n <td>\n"
- + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + " </td>\n </tr>\n <tr>\n <th>Onyomi:</th>\n <td>\n"
- + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + " </td>\n </tr>\n </table>\n </div>\n\n <div>\n"
- + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + " </div>\n\n <div class=\"glossary\">\n"
- + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.program(15, data, 0),"data":data})) != null ? stack1 : "")
- + " </div>\n\n"
+ + "</div>\n\n <div>\n"
+ + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </div>\n\n <br>\n\n <table class=\"table table-condensed\">\n <tr>\n <th>Readings</th>\n <th>Glossary</th>\n <th>Statistics</th>\n </tr>\n <tr>\n <td class=\"reading\">\n"
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </td>\n <td class=\"glossary\">\n"
+ + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.program(16, data, 0),"data":data})) != null ? stack1 : "")
+ + " </td>\n <td></td>\n </tr>\n </table>\n\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "</div>\n";
},"2":function(container,depth0,helpers,partials,data) {
@@ -45,15 +44,6 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
},"4":function(container,depth0,helpers,partials,data) {
return " <a href=\"#\" class=\"source-term\"><img src=\"/mixed/img/source-term.png\" title=\"Source term (Alt + B)\" alt></a>\n";
},"6":function(container,depth0,helpers,partials,data) {
- var stack1;
-
- return " "
- + container.escapeExpression(container.lambda(depth0, depth0))
- + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.last),{"name":"unless","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + "\n";
-},"7":function(container,depth0,helpers,partials,data) {
- return ", ";
-},"9":function(container,depth0,helpers,partials,data) {
var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
return " <span class=\"label label-default tag-"
@@ -63,32 +53,38 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
+ "\">"
+ alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
+ "</span>\n";
+},"8":function(container,depth0,helpers,partials,data) {
+ var stack1;
+
+ return " <dl>\n <dt>Kun</dt>\n"
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </dl>\n";
+},"9":function(container,depth0,helpers,partials,data) {
+ return " <dd>"
+ + container.escapeExpression(container.lambda(depth0, depth0))
+ + "</dd>\n";
},"11":function(container,depth0,helpers,partials,data) {
var stack1;
- return " <ol>\n"
- + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + " </ol>\n";
-},"12":function(container,depth0,helpers,partials,data) {
- var stack1, helper, options, buffer =
- " <li><span class=\"glossary-item\">";
- stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
- if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
- if (stack1 != null) { buffer += stack1; }
- return buffer + "</span></li>\n";
+ return " <dl>\n <dt>On</dt>\n"
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </dl>\n";
},"13":function(container,depth0,helpers,partials,data) {
- return container.escapeExpression(container.lambda(depth0, depth0));
-},"15":function(container,depth0,helpers,partials,data) {
- var stack1, helper, options, buffer =
- " <div class=\"glossary-item\">";
- stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
- if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
- if (stack1 != null) { buffer += stack1; }
- return buffer + "</div>\n";
+ var stack1;
+
+ return " <ol>\n"
+ + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(14, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </ol>\n";
+},"14":function(container,depth0,helpers,partials,data) {
+ return " <li><span class=\"glossary-item\">"
+ + container.escapeExpression(container.lambda(depth0, depth0))
+ + "</span></li>\n";
},"16":function(container,depth0,helpers,partials,data) {
var stack1;
- return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0));
+ return " <span class=\"glossary-item\">"
+ + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0))
+ + "</span>\n";
},"18":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer =
" <pre>";
diff --git a/tmpl/kanji.html b/tmpl/kanji.html
index bb62f488..4eb53048 100644
--- a/tmpl/kanji.html
+++ b/tmpl/kanji.html
@@ -13,44 +13,53 @@
<div class="glyph">{{character}}</div>
- <div class="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>
{{#each tags}}
<span class="label label-default tag-{{category}}" title="{{notes}}">{{name}}</span>
{{/each}}
</div>
- <div class="glossary">
- {{#if glossary.[1]}}
- <ol>
- {{#each glossary}}
- <li><span class="glossary-item">{{#multiLine}}{{.}}{{/multiLine}}</span></li>
- {{/each}}
- </ol>
- {{else}}
- <div class="glossary-item">{{#multiLine}}{{glossary.[0]}}{{/multiLine}}</div>
- {{/if}}
- </div>
+ <br>
+
+ <table class="table table-condensed">
+ <tr>
+ <th>Readings</th>
+ <th>Glossary</th>
+ <th>Statistics</th>
+ </tr>
+ <tr>
+ <td class="reading">
+ {{#if kunyomi}}
+ <dl>
+ <dt>Kun</dt>
+ {{#each kunyomi}}
+ <dd>{{.}}</dd>
+ {{/each}}
+ </dl>
+ {{/if}}
+ {{#if onyomi}}
+ <dl>
+ <dt>On</dt>
+ {{#each onyomi}}
+ <dd>{{.}}</dd>
+ {{/each}}
+ </dl>
+ {{/if}}
+ </td>
+ <td class="glossary">
+ {{#if glossary.[1]}}
+ <ol>
+ {{#each glossary}}
+ <li><span class="glossary-item">{{.}}</span></li>
+ {{/each}}
+ </ol>
+ {{else}}
+ <span class="glossary-item">{{glossary.[0]}}</span>
+ {{/if}}
+ </td>
+ <td></td>
+ </tr>
+ </table>
{{#if debug}}
<pre>{{#dumpObject}}{{{.}}}{{/dumpObject}}</pre>