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 --- ext/bg/js/templates.js | 70 +++++++++++++++++++++++------------------------ tmpl/kanji.html | 73 ++++++++++++++++++++++++++++---------------------- 2 files changed, 74 insertions(+), 69 deletions(-) diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 1c059365..d26feec8 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -29,15 +29,14 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " \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 \n \n \n \n \n \n \n \n \n
Kunyomi:\n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.kunyomi : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
Onyomi:\n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.onyomi : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
\n
\n\n
\n" - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
\n\n
\n" - + ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.program(15, data, 0),"data":data})) != null ? stack1 : "") - + "
\n\n" + + "\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
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" + + ((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"; },"2":function(container,depth0,helpers,partials,data) { @@ -45,15 +44,6 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia },"4":function(container,depth0,helpers,partials,data) { return " \n"; },"6":function(container,depth0,helpers,partials,data) { - var stack1; - - return " " - + container.escapeExpression(container.lambda(depth0, depth0)) - + ((stack1 = helpers.unless.call(depth0 != null ? depth0 : (container.nullContext || {}),(data && data.last),{"name":"unless","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "\n"; -},"7":function(container,depth0,helpers,partials,data) { - return ", "; -},"9":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " " + 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 "
\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"; +},"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 "
    \n" - + ((stack1 = helpers.each.call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + "
\n"; -},"12":function(container,depth0,helpers,partials,data) { - var stack1, helper, options, buffer = - "
  • "; - stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper)); - if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} - if (stack1 != null) { buffer += stack1; } - return buffer + "
  • \n"; + 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"; },"13":function(container,depth0,helpers,partials,data) { - return container.escapeExpression(container.lambda(depth0, depth0)); -},"15":function(container,depth0,helpers,partials,data) { - var stack1, helper, options, buffer = - "
    "; - stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),options) : helper)); - if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} - if (stack1 != null) { buffer += stack1; } - return buffer + "
    \n"; + 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 : "") + + "
    \n"; +},"14":function(container,depth0,helpers,partials,data) { + return "
  • " + + container.escapeExpression(container.lambda(depth0, depth0)) + + "
  • \n"; },"16":function(container,depth0,helpers,partials,data) { var stack1; - return container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["0"] : stack1), depth0)); + return " " + + 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, helper, options, buffer = "
    ";
    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