summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-13 18:55:31 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-13 18:55:31 -0700
commit18720aa150734ac1888ca560c6e840d4ce25d00e (patch)
tree400fbc31c5da86e794a63e74a5c688ed910c0da4
parentc198a0f91942b8016b272c8a5fad609c1ff18ef1 (diff)
Show definitions as lists
-rwxr-xr-xbuild_tmpl.sh2
-rw-r--r--ext/bg/js/dictionary.js2
-rw-r--r--ext/bg/js/templates.js14
-rw-r--r--util/tmpl/term.html8
4 files changed, 18 insertions, 8 deletions
diff --git a/build_tmpl.sh b/build_tmpl.sh
index 303c5db6..5c4a0c44 100755
--- a/build_tmpl.sh
+++ b/build_tmpl.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-handlebars util/tmpl/* -f ext/bg/templates.js
+handlebars util/tmpl/* -f ext/bg/js/templates.js
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 366692b0..6870601e 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -41,7 +41,7 @@ class Dictionary {
results = results.concat(
indices.map(index => {
const [e, r, t, ...g] = dict.defs[index];
- return {id: index, expression: e, reading: r, glossary: g.join('; '), tags: t.split(' ')};
+ return {id: index, expression: e, reading: r, glossary: g, tags: t.split(' ')};
})
);
}
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index 8ac5f8e5..0c1be04b 100644
--- a/ext/bg/js/templates.js
+++ b/ext/bg/js/templates.js
@@ -21,15 +21,19 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
return "<div class=\"yomichan-def-reading\">"
+ container.escapeExpression(((helper = (helper = helpers.reading || (depth0 != null ? depth0.reading : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"reading","hash":{},"data":data}) : helper)))
+ "</div>";
+},"3":function(container,depth0,helpers,partials,data) {
+ return " <li>"
+ + container.escapeExpression(container.lambda(depth0, depth0))
+ + "</li>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
- var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
+ var stack1, helper, alias1=depth0 != null ? depth0 : {};
return "<div class=\"yomichan-def-expression\">"
- + alias4(((helper = (helper = helpers.expression || (depth0 != null ? depth0.expression : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"expression","hash":{},"data":data}) : helper)))
+ + container.escapeExpression(((helper = (helper = helpers.expression || (depth0 != null ? depth0.expression : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"expression","hash":{},"data":data}) : helper)))
+ "</div>\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reading : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
- + "\n<div class=\"yomichan-def-glossary\">"
- + alias4(((helper = (helper = helpers.glossary || (depth0 != null ? depth0.glossary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"glossary","hash":{},"data":data}) : helper)))
- + "</div>\n";
+ + "\n<div class=\"yomichan-def-glossary\">\n <ol>\n"
+ + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ + " </ol>\n</div>\n";
},"useData":true});
})(); \ No newline at end of file
diff --git a/util/tmpl/term.html b/util/tmpl/term.html
index e46e9d5b..3713e1e8 100644
--- a/util/tmpl/term.html
+++ b/util/tmpl/term.html
@@ -1,3 +1,9 @@
<div class="yomichan-def-expression">{{expression}}</div>
{{#if reading}}<div class="yomichan-def-reading">{{reading}}</div>{{/if}}
-<div class="yomichan-def-glossary">{{glossary}}</div>
+<div class="yomichan-def-glossary">
+ <ol>
+ {{#each glossary}}
+ <li>{{.}}</li>
+ {{/each}}
+ </ol>
+</div>