diff options
author | praschke <stel@comfy.monster> | 2023-10-17 21:41:45 +0100 |
---|---|---|
committer | praschke <stel@comfy.monster> | 2023-10-17 21:41:45 +0100 |
commit | ae91e2442d7b3746c633871ff956a8addd7046b5 (patch) | |
tree | f10a4b5af7cec8eff3ee6e5946779f315da6df00 /test | |
parent | 9a78edaee74a8355d49ec930c82e118518d5d625 (diff) |
fix: furigana and furiganaPlain
Diffstat (limited to 'test')
-rw-r--r-- | test/test-options-util.js | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/test/test-options-util.js b/test/test-options-util.js index 068367a2..e9504b0d 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -1217,14 +1217,92 @@ async function testFieldTemplatesUpdate(extDir) { <<<UPDATE-ADDITIONS>>> {{~> (lookup . "marker") ~}}`.trimStart() }, - // block helper update + // block helper update: furigana and furiganaPlain { oldVersion: 20, newVersion: 21, old: ` +{{#*inline "furigana"}} + {{~#if merge~}} + {{~#each definition.expressions~}} + <span class="expression-{{termFrequency}}">{{~#furigana}}{{{.}}}{{/furigana~}}</span> + {{~#unless @last}}、{{/unless~}} + {{~/each~}} + {{~else~}} + {{#furigana}}{{{definition}}}{{/furigana}} + {{~/if~}} +{{/inline}} + +{{#*inline "furigana-plain"}} + {{~#if merge~}} + {{~#each definition.expressions~}} + <span class="expression-{{termFrequency}}">{{~#furiganaPlain}}{{{.}}}{{/furiganaPlain~}}</span> + {{~#unless @last}}、{{/unless~}} + {{~/each~}} + {{~else~}} + {{#furiganaPlain}}{{{definition}}}{{/furiganaPlain}} + {{~/if~}} +{{/inline}} + +{{#*inline "frequencies"}} + {{~#if (op ">" definition.frequencies.length 0)~}} + <ul style="text-align: left;"> + {{~#each definition.frequencies~}} + <li> + {{~#if (op "!==" ../definition.type "kanji")~}} + {{~#if (op "||" (op ">" ../uniqueExpressions.length 1) (op ">" ../uniqueReadings.length 1))~}}( + {{~#furigana expression reading~}}{{~/furigana~}} + ) {{/if~}} + {{~/if~}} + {{~dictionary}}: {{frequency~}} + </li> + {{~/each~}} + </ul> + {{~/if~}} +{{/inline}} + {{~> (lookup . "marker") ~}}`.trimStart(), expected: ` +{{#*inline "furigana"}} + {{~#if merge~}} + {{~#each definition.expressions~}} + <span class="expression-{{termFrequency}}">{{~furigana .~}}</span> + {{~#unless @last}}、{{/unless~}} + {{~/each~}} + {{~else~}} + {{furigana definition}} + {{~/if~}} +{{/inline}} + +{{#*inline "furigana-plain"}} + {{~#if merge~}} + {{~#each definition.expressions~}} + <span class="expression-{{termFrequency}}">{{~furiganaPlain .~}}</span> + {{~#unless @last}}、{{/unless~}} + {{~/each~}} + {{~else~}} + {{furiganaPlain definition}} + {{~/if~}} +{{/inline}} + +{{#*inline "frequencies"}} + {{~#if (op ">" definition.frequencies.length 0)~}} + <ul style="text-align: left;"> + {{~#each definition.frequencies~}} + <li> + {{~#if (op "!==" ../definition.type "kanji")~}} + {{~#if (op "||" (op ">" ../uniqueExpressions.length 1) (op ">" ../uniqueReadings.length 1))~}}( + {{~furigana expression reading~}} + ) {{/if~}} + {{~/if~}} + {{~dictionary}}: {{frequency~}} + </li> + {{~/each~}} + </ul> + {{~/if~}} +{{/inline}} + {{~> (lookup . "marker") ~}}`.trimStart() } ]; |