From 39e38d56657b9b11f49af96d84c819e6b6fcec8d Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 15 Sep 2017 13:18:21 -0700 Subject: improve kanji template --- tmpl/kanji.html | 73 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 32 deletions(-) (limited to 'tmpl') 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 @@
{{character}}
-
- - - - - - - - - -
Kunyomi: - {{#each kunyomi}} - {{.}}{{#unless @last}}, {{/unless}} - {{/each}} -
Onyomi: - {{#each onyomi}} - {{.}}{{#unless @last}}, {{/unless}} - {{/each}} -
-
-
{{#each tags}} {{name}} {{/each}}
-
- {{#if glossary.[1]}} -
    - {{#each glossary}} -
  1. {{#multiLine}}{{.}}{{/multiLine}}
  2. - {{/each}} -
- {{else}} -
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
- {{/if}} -
+
+ + + + + + + + + + + + +
ReadingsGlossaryStatistics
+ {{#if kunyomi}} +
+
Kun
+ {{#each kunyomi}} +
{{.}}
+ {{/each}} +
+ {{/if}} + {{#if onyomi}} +
+
On
+ {{#each onyomi}} +
{{.}}
+ {{/each}} +
+ {{/if}} +
+ {{#if glossary.[1]}} +
    + {{#each glossary}} +
  1. {{.}}
  2. + {{/each}} +
+ {{else}} + {{glossary.[0]}} + {{/if}} +
{{#if debug}}
{{#dumpObject}}{{{.}}}{{/dumpObject}}
-- cgit v1.2.3 From 7f55f1c8d2b82abda1cbdc353f28ae9136a361f3 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 15 Sep 2017 13:32:49 -0700 Subject: display term frequencies --- ext/bg/js/templates.js | 46 +++++++++++++++++++++++++++++++--------------- ext/bg/js/translator.js | 4 ++-- ext/mixed/css/display.css | 4 ++++ tmpl/terms.html | 8 ++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index d26feec8..5d9bcf3c 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -199,10 +199,12 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia if (stack1 != null) { buffer += stack1; } return buffer + "\n\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reasons : depth0),{"name":"if","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n
\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(24, data, 0),"inverse":container.program(30, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.program(33, data, 0),"data":data})) != null ? stack1 : "") + "
\n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(35, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"13":function(container,depth0,helpers,partials,data) { return " \n \n \n"; @@ -238,53 +240,67 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia },"24":function(container,depth0,helpers,partials,data) { var stack1; - return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.definitions : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(25, data, 0),"inverse":container.program(28, data, 0),"data":data})) != null ? stack1 : ""); + return "
\n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.frequencies : depth0),{"name":"each","hash":{},"fn":container.program(25, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
\n"; },"25":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return " " + + alias4(((helper = (helper = helpers.dictionary || (depth0 != null ? depth0.dictionary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"dictionary","hash":{},"data":data}) : helper))) + + ":" + + alias4(((helper = (helper = helpers.frequency || (depth0 != null ? depth0.frequency : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"frequency","hash":{},"data":data}) : helper))) + + "\n"; +},"27":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.definitions : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(28, data, 0),"inverse":container.program(31, data, 0),"data":data})) != null ? stack1 : ""); +},"28":function(container,depth0,helpers,partials,data) { var stack1; return "
    \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
\n"; -},"26":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { var stack1; return "
  • " + ((stack1 = container.invokePartial(partials.definition,depth0,{"name":"definition","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "
  • \n"; -},"28":function(container,depth0,helpers,partials,data) { +},"31":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.invokePartial(partials.definition,((stack1 = (depth0 != null ? depth0.definitions : depth0)) != null ? stack1["0"] : stack1),{"name":"definition","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"30":function(container,depth0,helpers,partials,data) { +},"33":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.invokePartial(partials.definition,depth0,{"name":"definition","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"32":function(container,depth0,helpers,partials,data) { +},"35":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
       stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"37":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(38, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"38":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(39, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.term,depth0,{"name":"term","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"grouped":(depths[1] != null ? depths[1].grouped : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"36":function(container,depth0,helpers,partials,data) { +},"39":function(container,depth0,helpers,partials,data) { return "
    "; -},"38":function(container,depth0,helpers,partials,data) { +},"41":function(container,depth0,helpers,partials,data) { return "

    No results found.

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(37, data, 0, blockParams, depths),"inverse":container.program(41, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 0cd49c27..3dd482ca 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -42,7 +42,7 @@ class Translator { const definitionsGrouped = dictTermsGroup(definitions, dictionaries); for (const definition of definitionsGrouped) { - this.buildTermFrequencies(definition, titles); + await this.buildTermFrequencies(definition, titles); } return {length, definitions: definitionsGrouped}; @@ -53,7 +53,7 @@ class Translator { const {length, definitions} = await this.findTerms(text, dictionaries, alphanumeric); for (const definition of definitions) { - this.buildTermFrequencies(definition, titles); + await this.buildTermFrequencies(definition, titles); } return {length, definitions}; diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index 8b1819bd..6c7148dc 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -84,6 +84,10 @@ hr { background-color: #aa66cc; } +.tag-frequency { + background-color: #5cb85c; +} + .actions .disabled { pointer-events: none; cursor: default; diff --git a/tmpl/terms.html b/tmpl/terms.html index ffe52ab8..a130e775 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -41,6 +41,14 @@ {{/if}} + {{#if frequencies}} +
    + {{#each frequencies}} + {{dictionary}}:{{frequency}} + {{/each}} +
    + {{/if}} +
    {{#if grouped}} {{#if definitions.[1]}} -- cgit v1.2.3 From e044f0107ab33125f47dac1dde7fe2c673d0ddd6 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 15 Sep 2017 14:03:05 -0700 Subject: style fixes --- ext/bg/js/templates.js | 2 +- ext/mixed/css/display.css | 4 ++++ tmpl/kanji.html | 4 +--- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 5d9bcf3c..70af31ea 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -31,7 +31,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + 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))) + "
    \n\n
    \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 : "") - + "
    \n\n
    \n\n \n \n \n \n \n \n \n - + + + + + + +
    ReadingsGlossaryStatistics
    \n" + + " \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \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 : "") + " \n" diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index 6c7148dc..92480bab 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -148,3 +148,7 @@ hr { padding: 0.01em; vertical-align: top; } + +.glyph-data { + margin-top: 10px; +} diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 4eb53048..f66b707e 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -19,9 +19,7 @@ {{/each}} -
    - - +
    -- cgit v1.2.3 From 5a531541238b52ba56475ae3f91873bd1b8a9d10 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 15 Sep 2017 14:06:10 -0700 Subject: style fixes --- ext/bg/js/templates.js | 14 ++++++-------- tmpl/kanji.html | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 70af31ea..a8fc87b6 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -31,10 +31,10 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + 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))) + "\n\n
    \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 : "") - + "
    \n\n
    Readings Glossary
    \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n" + + " \n\n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n
    \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 : "") - + "
    \n" + + " \n \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 : "") + "
    \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 : "") @@ -56,9 +56,8 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia },"8":function(container,depth0,helpers,partials,data) { var stack1; - return "
    \n
    Kun
    \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 : "") - + "
    \n"; + return "
    Kun-Yomi
    \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 : ""); },"9":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) @@ -66,9 +65,8 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia },"11":function(container,depth0,helpers,partials,data) { var stack1; - return "
    \n
    On
    \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 : "") - + "
    \n"; + return "
    On-Yomi
    \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 : ""); },"13":function(container,depth0,helpers,partials,data) { var stack1; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index f66b707e..9ab5b2a8 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -27,22 +27,20 @@
    - {{#if kunyomi}}
    -
    Kun
    + {{#if kunyomi}} +
    Kun-Yomi
    {{#each kunyomi}}
    {{.}}
    {{/each}} -
    - {{/if}} - {{#if onyomi}} -
    -
    On
    + {{/if}} + {{#if onyomi}} +
    On-Yomi
    {{#each onyomi}}
    {{.}}
    {{/each}} + {{/if}}
    - {{/if}}
    {{#if glossary.[1]}} -- cgit v1.2.3 From ba25fbfd1f6187e75bbf3aa2e36717c081f09e7c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 17 Sep 2017 12:56:34 -0700 Subject: backwards compat --- ext/bg/js/database.js | 114 +++++++++++++++++++++++++++++++++---------------- ext/bg/js/templates.js | 48 +++++++++++++++------ tmpl/kanji.html | 30 ++++++++++++- 3 files changed, 141 insertions(+), 51 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index b56cf7e2..0acf974f 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -110,6 +110,8 @@ class Database { kunyomi: dictFieldSplit(row.kunyomi), tags: dictFieldSplit(row.tags), glossary: row.meanings, + indices: row.indices, + stats: row.stats, dictionary: row.dictionary }); } @@ -168,6 +170,10 @@ class Database { } const indexDataLoaded = async summary => { + if (summary.version > 2) { + throw 'unsupported dictionary version'; + } + const count = await this.db.dictionaries.where('title').equals(summary.title).count(); if (count > 0) { throw `dictionary "${summary.title}" is already imported`; @@ -176,28 +182,42 @@ class Database { await this.db.dictionaries.add(summary); }; - const termDataLoaded = async (title, entries, total, current) => { + const termDataLoaded = async (summary, entries, total, current) => { if (callback) { callback(total, current); } const rows = []; - for (const [expression, reading, tags, rules, score, ...glossary] of entries) { - rows.push({ - expression, - reading, - tags, - rules, - score, - glossary, - dictionary: title - }); + if (summary.version === 1) { + for (const [expression, reading, tags, rules, score, ...glossary] of entries) { + rows.push({ + expression, + reading, + tags, + rules, + score, + glossary, + dictionary: summary.title + }); + } + } else { + for (const [expression, reading, tags, rules, score, glossary] of entries) { + rows.push({ + expression, + reading, + tags, + rules, + score, + glossary, + dictionary: summary.title + }); + } } await this.db.terms.bulkAdd(rows); }; - const termFreqDataLoaded = async (title, entries, total, current) => { + const termFreqDataLoaded = async (summary, entries, total, current) => { if (callback) { callback(total, current); } @@ -207,34 +227,49 @@ class Database { rows.push({ expression, frequency, - dictionary: title + dictionary: summary.title }); } await this.db.termFreq.bulkAdd(rows); }; - const kanjiDataLoaded = async (title, entries, total, current) => { + const kanjiDataLoaded = async (summary, entries, total, current) => { if (callback) { callback(total, current); } const rows = []; - for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) { - rows.push({ - character, - onyomi, - kunyomi, - tags, - meanings, - dictionary: title - }); + if (summary.version === 1) { + for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) { + rows.push({ + character, + onyomi, + kunyomi, + tags, + meanings, + dictionary: summary.title + }); + } + } else { + for (const [character, onyomi, kunyomi, tags, meanings, indices, stats] of entries) { + rows.push({ + character, + onyomi, + kunyomi, + tags, + meanings, + indices, + stats, + dictionary: summary.title + }); + } } await this.db.kanji.bulkAdd(rows); }; - const kanjiFreqDataLoaded = async (title, entries, total, current) => { + const kanjiFreqDataLoaded = async (summary, entries, total, current) => { if (callback) { callback(total, current); } @@ -244,14 +279,14 @@ class Database { rows.push({ character, frequency, - dictionary: title + dictionary: summary.title }); } await this.db.kanjiFreq.bulkAdd(rows); }; - const tagDataLoaded = async (title, entries, total, current) => { + const tagDataLoaded = async (summary, entries, total, current) => { if (callback) { callback(total, current); } @@ -263,7 +298,7 @@ class Database { category, order, notes, - dictionary: title + dictionary: summary.title }); rows.push(row); @@ -300,11 +335,16 @@ class Database { } const index = JSON.parse(await indexFile.async('string')); - if (!index.title || !index.version || !index.revision) { + if (!index.title || !index.revision) { throw 'unrecognized dictionary format'; } - const summary = {title: index.title, version: index.version, revision: index.revision}; + const summary = { + title: index.title, + revision: index.revision, + version: index.format || index.version + }; + if (indexDataLoaded) { await indexDataLoaded(summary); } @@ -345,24 +385,24 @@ class Database { bank.push([name, tag.category, tag.order, tag.notes]); } - tagDataLoaded(index.title, bank, ++bankTotalCount, bankLoadedCount++); + tagDataLoaded(summary, bank, ++bankTotalCount, bankLoadedCount++); } - const loadBank = async (namer, count, callback) => { + const loadBank = async (summary, namer, count, callback) => { if (callback) { for (let i = 0; i < count; ++i) { const bankFile = zip.files[namer(i)]; const bank = JSON.parse(await bankFile.async('string')); - await callback(index.title, bank, bankTotalCount, bankLoadedCount++); + await callback(summary, bank, bankTotalCount, bankLoadedCount++); } } }; - await loadBank(buildTermBankName, termBankCount, termDataLoaded); - await loadBank(buildTermFreqBankName, termFreqBankCount, termFreqDataLoaded); - await loadBank(buildKanjiBankName, kanjiBankCount, kanjiDataLoaded); - await loadBank(buildKanjiFreqBankName, kanjiFreqBankCount, kanjiFreqDataLoaded); - await loadBank(buildTagBankName, tagBankCount, tagDataLoaded); + await loadBank(summary, buildTermBankName, termBankCount, termDataLoaded); + await loadBank(summary, buildTermFreqBankName, termFreqBankCount, termFreqDataLoaded); + await loadBank(summary, buildKanjiBankName, kanjiBankCount, kanjiDataLoaded); + await loadBank(summary, buildKanjiFreqBankName, kanjiFreqBankCount, kanjiFreqDataLoaded); + await loadBank(summary, buildTagBankName, tagBankCount, tagDataLoaded); return summary; } diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index a8fc87b6..0d546909 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -36,8 +36,12 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((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 : "") + " \n \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 : "") - + "
    \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 : "") + + "
    \n
    \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.program(21, data, 0),"data":data})) != null ? stack1 : "") + + "
    \n
    Dictionary Indices
    \n
    \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + + "
    \n
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"2":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -84,35 +88,55 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; },"18":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"19":function(container,depth0,helpers,partials,data) { + var helper, alias1=container.escapeExpression; + + return "
    " + + alias1(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"key","hash":{},"data":data}) : helper))) + + ": " + + alias1(container.lambda(depth0, depth0)) + + "
    \n"; +},"21":function(container,depth0,helpers,partials,data) { + return " No statistical data found\n"; +},"23":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"25":function(container,depth0,helpers,partials,data) { + return " No index data found\n"; +},"27":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"19":function(container,depth0,helpers,partials,data) { +},"28":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"21":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"30":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(22, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"22":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(23, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"23":function(container,depth0,helpers,partials,data) { +},"32":function(container,depth0,helpers,partials,data) { return "
    "; -},"25":function(container,depth0,helpers,partials,data) { - return "

    No results found.

    \n"; +},"34":function(container,depth0,helpers,partials,data) { + return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0, blockParams, depths),"inverse":container.program(25, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(30, data, 0, blockParams, depths),"inverse":container.program(34, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 9ab5b2a8..6cea57f9 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -53,7 +53,33 @@ {{glossary.[0]}} {{/if}}
    +
    + {{#if stats}} + {{#each stats}} +
    {{@key}}: {{.}}
    + {{/each}} + {{else}} + No statistical data found + {{/if}} +
    +
    Dictionary Indices
    +
    + {{#if indices}} + {{#each indices}} +
    {{@key}}: {{.}}
    + {{/each}} + {{else}} + No index data found + {{/if}} +
    +
    @@ -69,5 +95,5 @@ {{> kanji debug=../debug addable=../addable source=../source root=../root}} {{/each}} {{else}} -

    No results found.

    +

    No results found

    {{/if}} -- cgit v1.2.3 From 269a4f0b9ba1876bd5a6e72e34537056a75081fc Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 17 Sep 2017 14:17:14 -0700 Subject: template fixups --- ext/bg/js/templates.js | 64 +++++++++++++++++++++----------------------------- tmpl/kanji.html | 6 ----- 2 files changed, 27 insertions(+), 43 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 0d546909..41bc58c9 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -32,16 +32,16 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + "\n\n
    \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 : "") + "
    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n
    \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 : "") + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n
    \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 : "") + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.program(13, data, 0),"data":data})) != null ? stack1 : "") + " \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.program(21, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "") + "
    \n
    Dictionary Indices
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(20, data, 0),"inverse":container.program(22, data, 0),"data":data})) != null ? stack1 : "") + "
    \n
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"2":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -58,40 +58,30 @@ 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))) + "\n"; },"8":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
    Kun-Yomi
    \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 : ""); -},"9":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) + "
    \n"; -},"11":function(container,depth0,helpers,partials,data) { - var stack1; - - return "
    On-Yomi
    \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 : ""); -},"13":function(container,depth0,helpers,partials,data) { +},"10":function(container,depth0,helpers,partials,data) { var stack1; return "
      \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 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"14":function(container,depth0,helpers,partials,data) { +},"11":function(container,depth0,helpers,partials,data) { return "
  • " + container.escapeExpression(container.lambda(depth0, depth0)) + "
  • \n"; -},"16":function(container,depth0,helpers,partials,data) { +},"13":function(container,depth0,helpers,partials,data) { var stack1; return " " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; -},"18":function(container,depth0,helpers,partials,data) { +},"15":function(container,depth0,helpers,partials,data) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"19":function(container,depth0,helpers,partials,data) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"16":function(container,depth0,helpers,partials,data) { var helper, alias1=container.escapeExpression; return "
    " @@ -99,44 +89,44 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ": " + alias1(container.lambda(depth0, depth0)) + "
    \n"; -},"21":function(container,depth0,helpers,partials,data) { +},"18":function(container,depth0,helpers,partials,data) { return " No statistical data found\n"; -},"23":function(container,depth0,helpers,partials,data) { +},"20":function(container,depth0,helpers,partials,data) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"25":function(container,depth0,helpers,partials,data) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"22":function(container,depth0,helpers,partials,data) { return " No index data found\n"; -},"27":function(container,depth0,helpers,partials,data) { +},"24":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(25, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"28":function(container,depth0,helpers,partials,data) { +},"25":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"30":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"27":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(28, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"28":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(29, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"32":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { return "
    "; -},"34":function(container,depth0,helpers,partials,data) { +},"31":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(30, data, 0, blockParams, depths),"inverse":container.program(34, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0, blockParams, depths),"inverse":container.program(31, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 6cea57f9..ad6dcb26 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -28,18 +28,12 @@
    - {{#if kunyomi}} -
    Kun-Yomi
    {{#each kunyomi}}
    {{.}}
    {{/each}} - {{/if}} - {{#if onyomi}} -
    On-Yomi
    {{#each onyomi}}
    {{.}}
    {{/each}} - {{/if}}
    -- cgit v1.2.3 From d9d16613f8aa129de5dc1edb38d66f69d2983091 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 17 Sep 2017 19:16:08 -0700 Subject: wip --- ext/bg/js/templates.js | 118 +++++++++++++++++++++++++++++----------------- ext/bg/js/translator.js | 32 +++++++++++-- ext/mixed/css/display.css | 8 ++++ tmpl/kanji.html | 44 +++++++++++------ 4 files changed, 141 insertions(+), 61 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 41bc58c9..55b09dfb 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -29,25 +29,47 @@ 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 : "") + " \n \n\n
    " + 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))) - + "
    \n\n
    \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 : "") - + "
    \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n
    \n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n
    \n" + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.program(13, data, 0),"data":data})) != null ? stack1 : "") - + " \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "") - + "
    \n
    Dictionary Indices
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(20, data, 0),"inverse":container.program(22, data, 0),"data":data})) != null ? stack1 : "") - + "
    \n
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.program(17, data, 0),"data":data})) != null ? stack1 : "") + + "
    \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + + "
    Dictionary Indices
    \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.program(29, data, 0),"data":data})) != null ? stack1 : "") + + "
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"2":function(container,depth0,helpers,partials,data) { return " \n \n"; },"4":function(container,depth0,helpers,partials,data) { return " \n"; },"6":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.frequencies : depth0),{"name":"each","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"7":function(container,depth0,helpers,partials,data) { + var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; + + return " " + + alias4(((helper = (helper = helpers.dictionary || (depth0 != null ? depth0.dictionary : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"dictionary","hash":{},"data":data}) : helper))) + + ":" + + alias4(((helper = (helper = helpers.frequency || (depth0 != null ? depth0.frequency : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"frequency","hash":{},"data":data}) : helper))) + + "\n"; +},"9":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"10":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " " + 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))) + "\n"; -},"8":function(container,depth0,helpers,partials,data) { +},"12":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) + "
    \n"; -},"10":function(container,depth0,helpers,partials,data) { +},"14":function(container,depth0,helpers,partials,data) { var stack1; return "
      \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"11":function(container,depth0,helpers,partials,data) { +},"15":function(container,depth0,helpers,partials,data) { return "
  • " + container.escapeExpression(container.lambda(depth0, depth0)) + "
  • \n"; -},"13":function(container,depth0,helpers,partials,data) { +},"17":function(container,depth0,helpers,partials,data) { var stack1; return " " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; -},"15":function(container,depth0,helpers,partials,data) { +},"19":function(container,depth0,helpers,partials,data) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"16":function(container,depth0,helpers,partials,data) { - var helper, alias1=container.escapeExpression; - - return "
    " - + alias1(((helper = (helper = helpers.key || (data && data.key)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"key","hash":{},"data":data}) : helper))) - + ": " - + alias1(container.lambda(depth0, depth0)) - + "
    \n"; -},"18":function(container,depth0,helpers,partials,data) { - return " No statistical data found\n"; + return " \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; },"20":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); + + return " \n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.notes : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(23, data, 0),"data":data})) != null ? stack1 : "") + + "\n " + + container.escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper))) + + "\n \n"; +},"21":function(container,depth0,helpers,partials,data) { + var helper; + + return container.escapeExpression(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"notes","hash":{},"data":data}) : helper))); +},"23":function(container,depth0,helpers,partials,data) { + var helper; + + return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper))); +},"25":function(container,depth0,helpers,partials,data) { + return " No statistical data found\n"; +},"27":function(container,depth0,helpers,partials,data) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"22":function(container,depth0,helpers,partials,data) { - return " No index data found\n"; -},"24":function(container,depth0,helpers,partials,data) { + return " \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"29":function(container,depth0,helpers,partials,data) { + return " No index data found\n"; +},"31":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(25, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"25":function(container,depth0,helpers,partials,data) { +},"32":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"27":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(28, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"28":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(29, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"29":function(container,depth0,helpers,partials,data) { +},"36":function(container,depth0,helpers,partials,data) { return "
    "; -},"31":function(container,depth0,helpers,partials,data) { +},"38":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0, blockParams, depths),"inverse":container.program(31, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 3dd482ca..ef2227ea 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -78,7 +78,7 @@ class Translator { let definitions = []; for (const deinflection of deinflections) { for (const definition of deinflection.definitions) { - const tags = await this.expandTags(definition); + const tags = await this.expandTags(definition.tags, definition.dictionary); tags.push(dictTagBuildSource(definition.dictionary)); definitions.push({ @@ -136,9 +136,12 @@ class Translator { } for (const definition of definitions) { - const tags = await this.expandTags(definition); + const tags = await this.expandTags(definition.tags, definition.dictionary); tags.push(dictTagBuildSource(definition.dictionary)); + definition.tags = dictTagsSort(tags); + definition.stats = await this.expandTaggedValues(definition.stats, definition.dictionary); + definition.indices = await this.expandTaggedValues(definition.indices, definition.dictionary); definition.frequencies = await this.database.findKanjiFreq(definition.character, titles); } @@ -152,11 +155,11 @@ class Translator { } } - async expandTags(definition) { + async expandTags(names, title) { const tags = []; - for (const name of definition.tags) { + for (const name of names) { const base = name.split(':')[0]; - const meta = await this.database.findTagForTitle(base, definition.dictionary); + const meta = await this.database.findTagForTitle(base, title); const tag = {name}; for (const prop in meta || {}) { @@ -170,4 +173,23 @@ class Translator { return tags; } + + async expandTaggedValues(items, title) { + const tags = []; + for (const name in items) { + const base = name.split(':')[0]; + const meta = await this.database.findTagForTitle(base, title); + + const tag = {name, value: items[name]}; + for (const prop in meta || {}) { + if (prop !== 'name') { + tag[prop] = meta[prop]; + } + } + + tags.push(dictTagSanitize(tag)); + } + + return tags; + } } diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index 92480bab..cdc1be8c 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -152,3 +152,11 @@ hr { .glyph-data { margin-top: 10px; } + +.info-output { + width: 100%; +} + +.info-output td { + text-align: right; +} diff --git a/tmpl/kanji.html b/tmpl/kanji.html index ad6dcb26..57b6b7dc 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -13,11 +13,21 @@
    {{character}}
    + {{#if frequencies}} +
    + {{#each frequencies}} + {{dictionary}}:{{frequency}} + {{/each}} +
    + {{/if}} + + {{#if tags}}
    {{#each tags}} {{name}} {{/each}}
    + {{/if}} @@ -48,15 +58,18 @@ {{/if}} @@ -64,15 +77,18 @@
    -
    - {{#if stats}} + {{#if stats}} + {{#each stats}} -
    {{@key}}: {{.}}
    + + + + {{/each}} - {{else}} - No statistical data found - {{/if}} - +
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}}{{value}}
    + {{else}} + No statistical data found + {{/if}}
    -
    - {{#if indices}} + {{#if indices}} + {{#each indices}} -
    {{@key}}: {{.}}
    + + + + {{/each}} - {{else}} - No index data found - {{/if}} - +
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}}{{value}}
    + {{else}} + No index data found + {{/if}}
    -- cgit v1.2.3 From 119def2bebc9adea3a29e9152c7e4747d81d54fa Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 20 Sep 2017 23:15:02 -0700 Subject: wip --- ext/bg/js/templates.js | 38 ++++++++++++++------------------------ ext/bg/js/translator.js | 5 +++-- tmpl/kanji.html | 19 +++---------------- 3 files changed, 20 insertions(+), 42 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 55b09dfb..d501e5d8 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -38,12 +38,10 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n \n \n" + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.program(17, data, 0),"data":data})) != null ? stack1 : "") - + " \n \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") - + " \n \n \n Dictionary Indices\n \n \n \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.indices : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.program(29, data, 0),"data":data})) != null ? stack1 : "") + + " \n \n \n \n Dictionary Indices\n \n \n \n" + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.indices : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + " \n \n \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"2":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -103,7 +101,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia var stack1; return " \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.stats : depth0),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.indices : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; },"20":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); @@ -122,45 +120,37 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper))); },"25":function(container,depth0,helpers,partials,data) { - return " No statistical data found\n"; -},"27":function(container,depth0,helpers,partials,data) { - var stack1; - - return " \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.indices : depth0),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n"; -},"29":function(container,depth0,helpers,partials,data) { return " No index data found\n"; -},"31":function(container,depth0,helpers,partials,data) { +},"27":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"32":function(container,depth0,helpers,partials,data) { +},"28":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"30":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"36":function(container,depth0,helpers,partials,data) { +},"32":function(container,depth0,helpers,partials,data) { return "
    "; -},"38":function(container,depth0,helpers,partials,data) { +},"34":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(30, data, 0, blockParams, depths),"inverse":container.program(34, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 7583d39a..454799a3 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -174,10 +174,11 @@ class Translator { } async expandStats(items, title) { - const stats = []; + const stats = {}; for (const name in items) { const base = name.split(':')[0]; const meta = await this.database.findTagForTitle(base, title); + const group = stats[meta.category] || []; const stat = {name, value: items[name]}; for (const prop in meta || {}) { @@ -186,7 +187,7 @@ class Translator { } } - stats.push(dictTagSanitize(stat)); + group.push(dictTagSanitize(stat)); } return stats; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 57b6b7dc..354e097d 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -57,29 +57,16 @@ {{glossary.[0]}} {{/if}} - - {{#if stats}} - - {{#each stats}} - - - - - {{/each}} -
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}}{{value}}
    - {{else}} - No statistical data found - {{/if}} - + Dictionary Indices - {{#if indices}} + {{#if stats.indices}} - {{#each indices}} + {{#each stats.indices}} -- cgit v1.2.3 From 65ce976423e241b50baa69b4d074b981d4de1f3e Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 09:21:32 -0700 Subject: wip --- ext/bg/js/templates.js | 4 ++-- ext/bg/js/translator.js | 2 +- tmpl/kanji.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index d501e5d8..ddf9740a 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -39,7 +39,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + " \n \n \n \n \n \n \n \n \n \n \n
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}} {{value}}\n" + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.program(17, data, 0),"data":data})) != null ? stack1 : "") + "
    Dictionary Indices
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.indices : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["default"] : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + "
    \n\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; @@ -101,7 +101,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia var stack1; return " \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.indices : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["default"] : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; },"20":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 454799a3..cc0336e7 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -178,7 +178,7 @@ class Translator { for (const name in items) { const base = name.split(':')[0]; const meta = await this.database.findTagForTitle(base, title); - const group = stats[meta.category] || []; + const group = stats[meta.category] = stats[meta.category] || []; const stat = {name, value: items[name]}; for (const prop in meta || {}) { diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 354e097d..02fe8e92 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -64,9 +64,9 @@ - {{#if stats.indices}} + {{#if stats.default}} - {{#each stats.indices}} + {{#each stats.default}} -- cgit v1.2.3 From 2ba01d2910fb0992b372d74854e2624541233127 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 11:14:17 -0700 Subject: fix dictionary indices --- ext/bg/js/templates.js | 4 ++-- tmpl/kanji.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index ddf9740a..aa98b3cf 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -39,7 +39,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + " \n \n \n \n \n \n \n \n \n \n \n
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}} {{value}}\n" + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.program(17, data, 0),"data":data})) != null ? stack1 : "") + "
    Dictionary Indices
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["default"] : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") + "
    \n\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; @@ -101,7 +101,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia var stack1; return " \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["default"] : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; },"20":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 02fe8e92..c46ce6a7 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -64,9 +64,9 @@ - {{#if stats.default}} + {{#if stats.index}} - {{#each stats.default}} + {{#each stats.index}} -- cgit v1.2.3 From a55576260a3f2d5acfd256ac93a58302dd761624 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 20:52:18 -0700 Subject: work on kanji page --- ext/bg/js/templates.js | 150 ++++++++++++++++++++++++++----------------------- tmpl/kanji.html | 67 +++++++++++----------- 2 files changed, 116 insertions(+), 101 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index aa98b3cf..4320acb7 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -22,38 +22,73 @@ templates['dictionary.html'] = template({"1":function(container,depth0,helpers,p + "\" class=\"form-control dict-priority\">\n \n\n"; },"useData":true}); templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { + var stack1; + + return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.data : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(8, data, 0),"data":data})) != null ? stack1 : ""); +},"2":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}} {{value}}
    \n" + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.data : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"3":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); + + return " \n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.notes : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : "") + + "\n " + + container.escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper))) + + "\n \n"; +},"4":function(container,depth0,helpers,partials,data) { + var helper; + + return container.escapeExpression(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"notes","hash":{},"data":data}) : helper))); +},"6":function(container,depth0,helpers,partials,data) { + var helper; + + return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper))); +},"8":function(container,depth0,helpers,partials,data) { + return "No data found\n"; +},"10":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); return "
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((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 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \n
    \n\n
    " + 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))) + "
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    ReadingsGlossaryStatistics
    \n
    \n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(14, data, 0),"inverse":container.program(17, data, 0),"data":data})) != null ? stack1 : "") - + "
    Dictionary Indices
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(25, data, 0),"data":data})) != null ? stack1 : "") - + "
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    GlossaryOn'YomiKun'Yomi
    \n" + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(24, data, 0),"data":data})) != null ? stack1 : "") + + " \n
    " + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n
    \n
    " + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n
    StatsQueryCode
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "" + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.query : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "" + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Dictionary Indices
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"2":function(container,depth0,helpers,partials,data) { +},"11":function(container,depth0,helpers,partials,data) { return " \n \n"; -},"4":function(container,depth0,helpers,partials,data) { +},"13":function(container,depth0,helpers,partials,data) { return " \n"; -},"6":function(container,depth0,helpers,partials,data) { +},"15":function(container,depth0,helpers,partials,data) { var stack1; return "
    \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.frequencies : depth0),{"name":"each","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.frequencies : depth0),{"name":"each","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"7":function(container,depth0,helpers,partials,data) { +},"16":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " " @@ -61,13 +96,13 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ":" + alias4(((helper = (helper = helpers.frequency || (depth0 != null ? depth0.frequency : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"frequency","hash":{},"data":data}) : helper))) + "\n"; -},"9":function(container,depth0,helpers,partials,data) { +},"18":function(container,depth0,helpers,partials,data) { var stack1; return "
    \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"10":function(container,depth0,helpers,partials,data) { +},"19":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " " + 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))) + "\n"; -},"12":function(container,depth0,helpers,partials,data) { - return "
    " - + container.escapeExpression(container.lambda(depth0, depth0)) - + "
    \n"; -},"14":function(container,depth0,helpers,partials,data) { +},"21":function(container,depth0,helpers,partials,data) { var stack1; - return "
      \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n"; -},"15":function(container,depth0,helpers,partials,data) { - return "
  • " + return "
      " + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(22, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    \n"; +},"22":function(container,depth0,helpers,partials,data) { + return "
  • " + container.escapeExpression(container.lambda(depth0, depth0)) - + "
  • \n"; -},"17":function(container,depth0,helpers,partials,data) { + + ""; +},"24":function(container,depth0,helpers,partials,data) { var stack1; return " " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; -},"19":function(container,depth0,helpers,partials,data) { - var stack1; - - return " \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1),{"name":"each","hash":{},"fn":container.program(20, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n"; -},"20":function(container,depth0,helpers,partials,data) { - var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); - - return " \n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.notes : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(23, data, 0),"data":data})) != null ? stack1 : "") - + "\n " - + container.escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"value","hash":{},"data":data}) : helper))) - + "\n \n"; -},"21":function(container,depth0,helpers,partials,data) { - var helper; - - return container.escapeExpression(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"notes","hash":{},"data":data}) : helper))); -},"23":function(container,depth0,helpers,partials,data) { - var helper; - - return container.escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"name","hash":{},"data":data}) : helper))); -},"25":function(container,depth0,helpers,partials,data) { - return " No index data found\n"; -},"27":function(container,depth0,helpers,partials,data) { +},"26":function(container,depth0,helpers,partials,data) { + return "
    " + + container.escapeExpression(container.lambda(depth0, depth0)) + + "
    "; +},"28":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"28":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"30":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"32":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(33, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"32":function(container,depth0,helpers,partials,data) { +},"33":function(container,depth0,helpers,partials,data) { return "
    "; -},"34":function(container,depth0,helpers,partials,data) { +},"35":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return "\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(30, data, 0, blockParams, depths),"inverse":container.program(34, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + return "\n\n" + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.program(35, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; - fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"args":["kanji"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"args":["table"],"data":data}) || fn; + fn = decorators.inline(fn,props,container,{"name":"inline","hash":{},"fn":container.program(10, data, 0, blockParams, depths),"inverse":container.noop,"args":["kanji"],"data":data}) || fn; return fn; } diff --git a/tmpl/kanji.html b/tmpl/kanji.html index c46ce6a7..7c801355 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,3 +1,18 @@ +{{#*inline "table"}} +{{#if data}} + + {{#each data}} + + + + + {{/each}} +
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}}{{value}}
    +{{else}} +No data found +{{/if}} +{{/inline}} + {{#*inline "kanji"}}
    @@ -31,52 +46,40 @@ - - + + - - + + + + + + + + + + + + - +
    Readings GlossaryStatisticsOn'YomiKun'Yomi
    -
    - {{#each kunyomi}} -
    {{.}}
    - {{/each}} - {{#each onyomi}} -
    {{.}}
    - {{/each}} -
    -
    {{#if glossary.[1]}} -
      - {{#each glossary}} -
    1. {{.}}
    2. - {{/each}} -
    +
      {{#each glossary}}
    1. {{.}}
    2. {{/each}}
    {{else}} {{glossary.[0]}} {{/if}}
    +
    {{#each onyomi}}
    {{.}}
    {{/each}}
    +
    +
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    +
    StatsQueryCode
    {{> table data=stats.misc}}{{> table data=stats.query}}{{> table data=stats.code}}
    Dictionary Indices
    - {{#if stats.index}} - - {{#each stats.index}} - - - - - {{/each}} -
    {{#if notes}}{{notes}}{{else}}{{name}}{{/if}}{{value}}
    - {{else}} - No index data found - {{/if}} -
    {{> table data=stats.index}}
    -- cgit v1.2.3 From f22a6990122007f2db0292c7e26aba0d5328de9d Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 20:59:43 -0700 Subject: wip --- ext/bg/js/templates.js | 10 +++++----- tmpl/kanji.html | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 4320acb7..dc5df96a 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -61,17 +61,17 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n \n \n \n \n \n \n \n \n"; -},"23":function(container,depth0,helpers,partials,data) { var stack1; return "
      " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(22, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"24":function(container,depth0,helpers,partials,data) { +},"22":function(container,depth0,helpers,partials,data) { return "
  • " + container.escapeExpression(container.lambda(depth0, depth0)) + "
  • "; -},"26":function(container,depth0,helpers,partials,data) { +},"24":function(container,depth0,helpers,partials,data) { var stack1; return " " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; -},"28":function(container,depth0,helpers,partials,data) { +},"26":function(container,depth0,helpers,partials,data) { var stack1; return "
    " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    "; -},"29":function(container,depth0,helpers,partials,data) { +},"27":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) + "
    "; -},"31":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { var stack1; return "
    " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    "; -},"33":function(container,depth0,helpers,partials,data) { - var stack1; - - return " \n"; -},"35":function(container,depth0,helpers,partials,data) { - var stack1; - - return " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"; -},"37":function(container,depth0,helpers,partials,data) { +},"31":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(38, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"38":function(container,depth0,helpers,partials,data) { +},"32":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"40":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(41, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"41":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(42, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"42":function(container,depth0,helpers,partials,data) { +},"36":function(container,depth0,helpers,partials,data) { return "
    "; -},"44":function(container,depth0,helpers,partials,data) { +},"38":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(40, data, 0, blockParams, depths),"inverse":container.program(44, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 1081a141..a4bd95ee 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -48,9 +48,7 @@ No data found - {{#if stats}} - {{/if}} - {{#if stats}} - {{/if}} - {{#if stats}} @@ -87,7 +82,6 @@ No data found - {{/if}}
    GlossaryOn'YomiKun'Yomi
    \n" + + "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"; +},"23":function(container,depth0,helpers,partials,data) { var stack1; return "
      " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(22, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    \n"; -},"22":function(container,depth0,helpers,partials,data) { +},"24":function(container,depth0,helpers,partials,data) { return "
  • " + container.escapeExpression(container.lambda(depth0, depth0)) + "
  • "; -},"24":function(container,depth0,helpers,partials,data) { +},"26":function(container,depth0,helpers,partials,data) { var stack1; return " " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; -},"26":function(container,depth0,helpers,partials,data) { +},"28":function(container,depth0,helpers,partials,data) { var stack1; return "
    " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    "; -},"27":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) + "
    "; -},"29":function(container,depth0,helpers,partials,data) { +},"31":function(container,depth0,helpers,partials,data) { var stack1; return "
    " - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "
    "; -},"31":function(container,depth0,helpers,partials,data) { +},"33":function(container,depth0,helpers,partials,data) { + var stack1; + + return " \n"; +},"35":function(container,depth0,helpers,partials,data) { + var stack1; + + return " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"; +},"37":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(38, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"32":function(container,depth0,helpers,partials,data) { +},"38":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"40":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(41, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"41":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(42, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"36":function(container,depth0,helpers,partials,data) { +},"42":function(container,depth0,helpers,partials,data) { return "
    "; -},"38":function(container,depth0,helpers,partials,data) { +},"44":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(40, data, 0, blockParams, depths),"inverse":container.program(44, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index a4bd95ee..1081a141 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -48,7 +48,9 @@ No data found + {{#if stats}} + {{/if}} + {{#if stats}} + {{/if}} + {{#if stats}} @@ -82,6 +87,7 @@ No data found + {{/if}}
    GlossaryReadingsStats
    \n" + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(24, data, 0),"data":data})) != null ? stack1 : "") + " \n
    " + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    \n
    " + + "
    \n
    " + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    StatsQueryCode
    " + + "\n " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "" + + "
    QueryCode
    " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.query : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "" + + "" + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "
    Dictionary Indices
    " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 7c801355..405e0d0e 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -47,8 +47,8 @@ No data found - - + + - + - + - + -- cgit v1.2.3 From fe859a96cdcd6964898bfd492be034c95fd90285 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 23:10:43 -0700 Subject: kanji layout --- ext/bg/js/templates.js | 50 +++++++++++++++++++++++++++++++------------------- tmpl/kanji.html | 20 +++++++++++--------- 2 files changed, 42 insertions(+), 28 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index dc5df96a..c9f987e1 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -61,22 +61,22 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n
    GlossaryOn'YomiKun'YomiReadingsStats
    @@ -60,19 +60,18 @@ No data found
    {{#each onyomi}}
    {{.}}
    {{/each}}
    -
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    {{> table data=stats.misc}}
    Stats Query Code
    {{> table data=stats.misc}} {{> table data=stats.query}} {{> table data=stats.code}}
    \n \n \n \n \n \n \n - + - - - + - - - + + + + + + + -- cgit v1.2.3 From 4a507bbc62f5a46336d19611d2a5df4dc98f34e8 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 21 Sep 2017 23:21:34 -0700 Subject: query => class --- tmpl/kanji.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tmpl') diff --git a/tmpl/kanji.html b/tmpl/kanji.html index e3d0f275..a4bd95ee 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -68,7 +68,7 @@ No data found - + -- cgit v1.2.3 From d398440d2b380b198555620e6e6bc9d2f5d2638f Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 22 Sep 2017 20:48:07 -0700 Subject: kanji template work --- ext/bg/js/templates.js | 80 ++++++++++++++++++++++++++++++-------------------- tmpl/kanji.html | 6 ++++ 2 files changed, 54 insertions(+), 32 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index b5d352fc..695f9022 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -61,22 +61,20 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n
    GlossaryReadingsStats
    \n" + + "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    GlossaryReadingsStatistics
    \n" + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(24, data, 0),"data":data})) != null ? stack1 : "") - + " \n
    " - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    " - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    \n
    " + + " \n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n " + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    QueryCode
    " + + "
    Classifications
    " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.query : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "" + + "
    Codepoints
    " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "
    Dictionary Indices
    " + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + "
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(28, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"11":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -129,39 +129,51 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)) + "\n"; },"26":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    " + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    "; +},"27":function(container,depth0,helpers,partials,data) { return "
    " + container.escapeExpression(container.lambda(depth0, depth0)) + "
    "; -},"28":function(container,depth0,helpers,partials,data) { +},"29":function(container,depth0,helpers,partials,data) { + var stack1; + + return "
    " + + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(27, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    "; +},"31":function(container,depth0,helpers,partials,data) { var stack1, helper, options, buffer = "
    ";
    -  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
    +  stack1 = ((helper = (helper = helpers.dumpObject || (depth0 != null ? depth0.dumpObject : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"dumpObject","hash":{},"fn":container.program(32, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper));
       if (!helpers.dumpObject) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
       if (stack1 != null) { buffer += stack1; }
       return buffer + "
    \n"; -},"29":function(container,depth0,helpers,partials,data) { +},"32":function(container,depth0,helpers,partials,data) { var stack1; return ((stack1 = container.lambda(depth0, depth0)) != null ? stack1 : ""); -},"31":function(container,depth0,helpers,partials,data,blockParams,depths) { +},"34":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(32, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); -},"32":function(container,depth0,helpers,partials,data,blockParams,depths) { + return ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(35, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : ""); +},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; - return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(33, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"debug":(depths[1] != null ? depths[1].debug : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); -},"33":function(container,depth0,helpers,partials,data) { +},"36":function(container,depth0,helpers,partials,data) { return "
    "; -},"35":function(container,depth0,helpers,partials,data) { +},"38":function(container,depth0,helpers,partials,data) { return "

    No results found

    \n"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1; return "\n\n" - + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0, blockParams, depths),"inverse":container.program(35, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); + + ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(34, data, 0, blockParams, depths),"inverse":container.program(38, data, 0, blockParams, depths),"data":data})) != null ? stack1 : ""); },"main_d": function(fn, props, container, depth0, data, blockParams, depths) { var decorators = container.decorators; diff --git a/tmpl/kanji.html b/tmpl/kanji.html index 405e0d0e..e3d0f275 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -48,7 +48,7 @@ No data found
    Glossary ReadingsStatsStatistics
    @@ -59,20 +59,22 @@ No data found {{/if}} -
    {{#each onyomi}}
    {{.}}
    {{/each}}
    -
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    + {{#if onyomi}}
    {{#each onyomi}}
    {{.}}
    {{/each}}
    {{/if}} + {{#if kunyomi}}
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    {{/if}}
    {{> table data=stats.misc}}
    QueryCodeClassifications
    {{> table data=stats.query}}{{> table data=stats.code}}{{> table data=stats.query}}
    Codepoints
    {{> table data=stats.code}}
    Dictionary IndicesClassifications
    {{> table data=stats.query}}{{> table data=stats.class}}
    Codepoints
    \n \n \n \n \n \n \n \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(33, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(35, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "
    GlossaryReadingsStatistics
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(24, data, 0),"data":data})) != null ? stack1 : "") + + "\n \n \n \n \n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    GlossaryReadings
    \n" + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.program(26, data, 0),"data":data})) != null ? stack1 : "") + " \n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(26, 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(28, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Classifications
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["class"] : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Codepoints
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Dictionary Indices
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(37, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"11":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -113,67 +111,85 @@ 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))) + "\n"; },"21":function(container,depth0,helpers,partials,data) { + return "
    Statistics" + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Classifications
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["class"] : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Codepoints
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Dictionary Indices
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Glossary ReadingsStatistics
    @@ -62,8 +64,11 @@ No data found {{#if onyomi}}
    {{#each onyomi}}
    {{.}}
    {{/each}}
    {{/if}} {{#if kunyomi}}
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    {{/if}}
    {{> table data=stats.misc}}
    Classifications
    {{> table data=stats.index}}
    {{#if debug}} -- cgit v1.2.3 From 088c608d80ea05c15c6bdf4d043b9b52783f549a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 22 Sep 2017 20:50:52 -0700 Subject: Revert "kanji template work" This reverts commit d398440d2b380b198555620e6e6bc9d2f5d2638f. --- ext/bg/js/templates.js | 80 ++++++++++++++++++++------------------------------ tmpl/kanji.html | 6 ---- 2 files changed, 32 insertions(+), 54 deletions(-) (limited to 'tmpl') diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 695f9022..b5d352fc 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -61,20 +61,22 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.frequencies : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n \n \n \n \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    GlossaryReadings
    \n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.program(26, data, 0),"data":data})) != null ? stack1 : "") + + "\n \n \n \n \n \n \n \n \n \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(33, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + " \n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.stats : depth0),{"name":"if","hash":{},"fn":container.program(35, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
    GlossaryReadingsStatistics
    \n" + + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(21, data, 0),"inverse":container.program(24, data, 0),"data":data})) != null ? stack1 : "") + " \n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"if","hash":{},"fn":container.program(28, 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(26, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n " - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n
    \n\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(37, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"if","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + "\n
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Classifications
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["class"] : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Codepoints
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    Dictionary Indices
    " + + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + + "
    \n\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.debug : depth0),{"name":"if","hash":{},"fn":container.program(31, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "\n"; },"11":function(container,depth0,helpers,partials,data) { return " \n \n"; @@ -111,85 +113,67 @@ 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))) + "\n"; },"21":function(container,depth0,helpers,partials,data) { - return "
    Statistics" - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.misc : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Classifications
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1["class"] : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Codepoints
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.code : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Dictionary Indices
    " - + ((stack1 = container.invokePartial(partials.table,depth0,{"name":"table","hash":{"data":((stack1 = (depth0 != null ? depth0.stats : depth0)) != null ? stack1.index : stack1)},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") - + "
    Glossary ReadingsStatistics
    @@ -64,11 +62,8 @@ No data found {{#if onyomi}}
    {{#each onyomi}}
    {{.}}
    {{/each}}
    {{/if}} {{#if kunyomi}}
    {{#each kunyomi}}
    {{.}}
    {{/each}}
    {{/if}}
    {{> table data=stats.misc}}
    Classifications
    {{> table data=stats.index}}
    {{#if debug}} -- cgit v1.2.3