Update pronunciation anki templates (#1842)

* Update anki pronunciation templates

* Expose nasalPositions/devoicePositions

* Update templates to support nasal/devoice positions

* Update test data
This commit is contained in:
toasted-nutbread 2021-07-18 16:01:42 -04:00 committed by GitHub
parent 40cdb4feb5
commit 2ee3e3a7a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 470 additions and 153 deletions

View File

@ -63,3 +63,86 @@
{{=======}} {{=======}}
{{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText"}}{{/getMedia}}{{/if~}} {{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText"}}{{/getMedia}}{{/if~}}
{{>>>>>>>}} {{>>>>>>>}}
{{<<<<<<<}}
{{#*inline "pitch-accent-item-downstep-notation"}}
{{~#scope~}}
<span>
{{~#set "style1a"~}}display:inline-block;position:relative;{{~/set~}}
{{~#set "style1b"~}}padding-right:0.1em;margin-right:0.1em;{{~/set~}}
{{~#set "style2a"~}}display:block;user-select:none;pointer-events:none;position:absolute;top:0.1em;left:0;right:0;height:0;border-top:0.1em solid;{{~/set~}}
{{~#set "style2b"~}}right:-0.1em;height:0.4em;border-right:0.1em solid;{{~/set~}}
{{~#each (getKanaMorae reading)~}}
{{~#set "style1"}}{{#get "style1a"}}{{/get}}{{/set~}}
{{~#set "style2"}}{{/set~}}
{{~#if (isMoraPitchHigh @index ../position)}}
{{~#set "style2"}}{{#get "style2a"}}{{/get}}{{/set~}}
{{~#if (op "!" (isMoraPitchHigh (op "+" @index 1) ../position))~}}
{{~#set "style1" (op "+" (get "style1") (get "style1b"))}}{{/set~}}
{{~#set "style2" (op "+" (get "style2") (get "style2b"))}}{{/set~}}
{{~/if~}}
{{~/if~}}
<span style="{{#get "style1"}}{{/get}}">{{{.}}}<span style="{{#get "style2"}}{{/get}}"></span></span>
{{~/each~}}
</span>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-graph-position-x"}}{{#op "+" 25 (op "*" index 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position-y"}}{{#op "+" 25 (op "?:" (isMoraPitchHigh index position) 0 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position"}}{{> pitch-accent-item-graph-position-x index=index position=position}} {{> pitch-accent-item-graph-position-y index=index position=position}}{{/inline}}
{{#*inline "pitch-accent-item-graph"}}
{{~#scope~}}
{{~#set "morae" (getKanaMorae reading)}}{{/set~}}
{{~#set "morae-count" (property (get "morae") "length")}}{{/set~}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {{#op "+" 50 (op "*" 50 (get "morae-count"))}}{{/op}} 100" style="display:inline-block;height:2em;">
<defs>
<g id="term-pitch-accent-graph-dot"><circle cx="0" cy="0" r="15" style="fill:#000;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-dot-downstep"><circle cx="0" cy="0" r="15" style="fill:none;stroke:#000;stroke-width:5;" /><circle cx="0" cy="0" r="5" style="fill:none;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-triangle"><path d="M0 13 L15 -13 L-15 -13 Z" style="fill:none;stroke:#000;stroke-width:5;" /></g>
</defs>
<path style="fill:none;stroke:#000;stroke-width:5;" d="
{{~#set "cmd" "M"}}{{/set~}}
{{~#each (get "morae")~}}
{{~#get "cmd"}}{{/get~}}
{{~> pitch-accent-item-graph-position index=@index position=../position~}}
{{~#set "cmd" "L"}}{{/set~}}
{{~/each~}}
"></path>
<path style="fill:none;stroke:#000;stroke-width:5;stroke-dasharray:5 5;" d="M{{> pitch-accent-item-graph-position index=(op "-" (get "morae-count") 1) position=position}} L{{> pitch-accent-item-graph-position index=(get "morae-count") position=position}}"></path>
{{#each (get "morae")}}
<use href="{{#if (op "&&" (isMoraPitchHigh @index ../position) (op "!" (isMoraPitchHigh (op "+" @index 1) ../position)))}}#term-pitch-accent-graph-dot-downstep{{else}}#term-pitch-accent-graph-dot{{/if}}" x="{{> pitch-accent-item-graph-position-x index=@index position=../position}}" y="{{> pitch-accent-item-graph-position-y index=@index position=../position}}"></use>
{{/each}}
<use href="#term-pitch-accent-graph-triangle" x="{{> pitch-accent-item-graph-position-x index=(get "morae-count") position=position}}" y="{{> pitch-accent-item-graph-position-y index=(get "morae-count") position=position}}"></use>
</svg>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-position"~}}
<span>[{{position}}]</span>
{{~/inline}}
{{#*inline "pitch-accent-item"}}
{{~#if (op "==" format "downstep-notation")~}}
{{~> pitch-accent-item-downstep-notation~}}
{{~else if (op "==" format "graph")~}}
{{~> pitch-accent-item-graph~}}
{{~else if (op "==" format "position")~}}
{{~> pitch-accent-item-position~}}
{{~/if~}}
{{/inline}}
{{=======}}
{{#*inline "pitch-accent-item"}}
{{~#pronunciation format=format reading=reading downstepPosition=position nasalPositions=nasalPositions devoicePositions=devoicePositions~}}{{~/pronunciation~}}
{{/inline}}
{{>>>>>>>}}
{{<<<<<<<}}
{{#*inline "pitch-accents"}}
{{~> pitch-accent-list format='downstep-notation'~}}
{{/inline}}
{{=======}}
{{#*inline "pitch-accents"}}
{{~> pitch-accent-list format='text'~}}
{{/inline}}
{{>>>>>>>}}

View File

@ -183,71 +183,8 @@
{{/inline}} {{/inline}}
{{! Pitch Accents }} {{! Pitch Accents }}
{{#*inline "pitch-accent-item-downstep-notation"}}
{{~#scope~}}
<span>
{{~#set "style1a"~}}display:inline-block;position:relative;{{~/set~}}
{{~#set "style1b"~}}padding-right:0.1em;margin-right:0.1em;{{~/set~}}
{{~#set "style2a"~}}display:block;user-select:none;pointer-events:none;position:absolute;top:0.1em;left:0;right:0;height:0;border-top:0.1em solid;{{~/set~}}
{{~#set "style2b"~}}right:-0.1em;height:0.4em;border-right:0.1em solid;{{~/set~}}
{{~#each (getKanaMorae reading)~}}
{{~#set "style1"}}{{#get "style1a"}}{{/get}}{{/set~}}
{{~#set "style2"}}{{/set~}}
{{~#if (isMoraPitchHigh @index ../position)}}
{{~#set "style2"}}{{#get "style2a"}}{{/get}}{{/set~}}
{{~#if (op "!" (isMoraPitchHigh (op "+" @index 1) ../position))~}}
{{~#set "style1" (op "+" (get "style1") (get "style1b"))}}{{/set~}}
{{~#set "style2" (op "+" (get "style2") (get "style2b"))}}{{/set~}}
{{~/if~}}
{{~/if~}}
<span style="{{#get "style1"}}{{/get}}">{{{.}}}<span style="{{#get "style2"}}{{/get}}"></span></span>
{{~/each~}}
</span>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-graph-position-x"}}{{#op "+" 25 (op "*" index 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position-y"}}{{#op "+" 25 (op "?:" (isMoraPitchHigh index position) 0 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position"}}{{> pitch-accent-item-graph-position-x index=index position=position}} {{> pitch-accent-item-graph-position-y index=index position=position}}{{/inline}}
{{#*inline "pitch-accent-item-graph"}}
{{~#scope~}}
{{~#set "morae" (getKanaMorae reading)}}{{/set~}}
{{~#set "morae-count" (property (get "morae") "length")}}{{/set~}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {{#op "+" 50 (op "*" 50 (get "morae-count"))}}{{/op}} 100" style="display:inline-block;height:2em;">
<defs>
<g id="term-pitch-accent-graph-dot"><circle cx="0" cy="0" r="15" style="fill:#000;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-dot-downstep"><circle cx="0" cy="0" r="15" style="fill:none;stroke:#000;stroke-width:5;" /><circle cx="0" cy="0" r="5" style="fill:none;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-triangle"><path d="M0 13 L15 -13 L-15 -13 Z" style="fill:none;stroke:#000;stroke-width:5;" /></g>
</defs>
<path style="fill:none;stroke:#000;stroke-width:5;" d="
{{~#set "cmd" "M"}}{{/set~}}
{{~#each (get "morae")~}}
{{~#get "cmd"}}{{/get~}}
{{~> pitch-accent-item-graph-position index=@index position=../position~}}
{{~#set "cmd" "L"}}{{/set~}}
{{~/each~}}
"></path>
<path style="fill:none;stroke:#000;stroke-width:5;stroke-dasharray:5 5;" d="M{{> pitch-accent-item-graph-position index=(op "-" (get "morae-count") 1) position=position}} L{{> pitch-accent-item-graph-position index=(get "morae-count") position=position}}"></path>
{{#each (get "morae")}}
<use href="{{#if (op "&&" (isMoraPitchHigh @index ../position) (op "!" (isMoraPitchHigh (op "+" @index 1) ../position)))}}#term-pitch-accent-graph-dot-downstep{{else}}#term-pitch-accent-graph-dot{{/if}}" x="{{> pitch-accent-item-graph-position-x index=@index position=../position}}" y="{{> pitch-accent-item-graph-position-y index=@index position=../position}}"></use>
{{/each}}
<use href="#term-pitch-accent-graph-triangle" x="{{> pitch-accent-item-graph-position-x index=(get "morae-count") position=position}}" y="{{> pitch-accent-item-graph-position-y index=(get "morae-count") position=position}}"></use>
</svg>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-position"~}}
<span>[{{position}}]</span>
{{~/inline}}
{{#*inline "pitch-accent-item"}} {{#*inline "pitch-accent-item"}}
{{~#if (op "==" format "downstep-notation")~}} {{~#pronunciation format=format reading=reading downstepPosition=position nasalPositions=nasalPositions devoicePositions=devoicePositions~}}{{~/pronunciation~}}
{{~> pitch-accent-item-downstep-notation~}}
{{~else if (op "==" format "graph")~}}
{{~> pitch-accent-item-graph~}}
{{~else if (op "==" format "position")~}}
{{~> pitch-accent-item-position~}}
{{~/if~}}
{{/inline}} {{/inline}}
{{#*inline "pitch-accent-item-disambiguation"}} {{#*inline "pitch-accent-item-disambiguation"}}
@ -280,7 +217,7 @@
{{/inline}} {{/inline}}
{{#*inline "pitch-accents"}} {{#*inline "pitch-accents"}}
{{~> pitch-accent-list format='downstep-notation'~}} {{~> pitch-accent-list format='text'~}}
{{/inline}} {{/inline}}
{{#*inline "pitch-accent-graphs"}} {{#*inline "pitch-accent-graphs"}}

View File

@ -857,6 +857,7 @@ class OptionsUtil {
// Added {selection-text} field marker. // Added {selection-text} field marker.
// Added {sentence-furigana} field marker. // Added {sentence-furigana} field marker.
// Added anki.duplicateScopeCheckAllModels. // Added anki.duplicateScopeCheckAllModels.
// Updated pronunciation templates.
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v13.handlebars'); await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v13.handlebars');
for (const profile of options.profiles) { for (const profile of options.profiles) {
profile.options.anki.duplicateScopeCheckAllModels = false; profile.options.anki.duplicateScopeCheckAllModels = false;

View File

@ -159,11 +159,13 @@ class AnkiNoteDataCreator {
if (dictionaryEntry.type === 'term') { if (dictionaryEntry.type === 'term') {
for (const {dictionary, pitches} of DictionaryDataUtil.getPitchAccentInfos(dictionaryEntry)) { for (const {dictionary, pitches} of DictionaryDataUtil.getPitchAccentInfos(dictionaryEntry)) {
const pitches2 = []; const pitches2 = [];
for (const {terms, reading, position, tags, exclusiveTerms, exclusiveReadings} of pitches) { for (const {terms, reading, position, nasalPositions, devoicePositions, tags, exclusiveTerms, exclusiveReadings} of pitches) {
pitches2.push({ pitches2.push({
expressions: terms, expressions: terms,
reading, reading,
position, position,
nasalPositions,
devoicePositions,
tags, tags,
exclusiveExpressions: exclusiveTerms, exclusiveExpressions: exclusiveTerms,
exclusiveReadings exclusiveReadings

File diff suppressed because one or more lines are too long

View File

@ -2074,6 +2074,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2084,6 +2086,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2360,6 +2364,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2370,6 +2376,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2646,6 +2654,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2656,6 +2666,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2932,6 +2944,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -2942,6 +2956,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -5717,6 +5733,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -5727,6 +5745,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6003,6 +6023,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6013,6 +6035,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6698,6 +6722,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6708,6 +6734,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6984,6 +7012,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -6994,6 +7024,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -7866,6 +7898,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -7876,6 +7910,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -8175,6 +8211,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -8185,6 +8223,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -9488,6 +9528,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -9500,6 +9542,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -9512,6 +9556,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -9524,6 +9570,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -10512,6 +10560,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -10522,6 +10572,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -10802,6 +10854,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -10812,6 +10866,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -11092,6 +11148,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -11102,6 +11160,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -11382,6 +11442,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -11392,6 +11454,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -12838,6 +12902,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -12848,6 +12914,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13124,6 +13192,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13134,6 +13204,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13410,6 +13482,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13420,6 +13494,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13696,6 +13772,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -13706,6 +13784,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15152,6 +15232,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15162,6 +15244,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15438,6 +15522,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15448,6 +15534,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15724,6 +15812,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -15734,6 +15824,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -16010,6 +16102,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -16020,6 +16114,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -18123,6 +18219,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -18135,6 +18233,8 @@
], ],
"reading": "うちこむ", "reading": "うちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -18147,6 +18247,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -18159,6 +18261,8 @@
], ],
"reading": "ぶちこむ", "reading": "ぶちこむ",
"position": 3, "position": 3,
"nasalPositions": [],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [ "exclusiveReadings": [
@ -18763,6 +18867,8 @@
], ],
"reading": "おてまえ", "reading": "おてまえ",
"position": 2, "position": 2,
"nasalPositions": [],
"devoicePositions": [],
"tags": [ "tags": [
{ {
"name": "P1", "name": "P1",
@ -18787,6 +18893,8 @@
], ],
"reading": "おてまえ", "reading": "おてまえ",
"position": 2, "position": 2,
"nasalPositions": [],
"devoicePositions": [],
"tags": [ "tags": [
{ {
"name": "P2", "name": "P2",
@ -18811,6 +18919,8 @@
], ],
"reading": "おてまえ", "reading": "おてまえ",
"position": 0, "position": 0,
"nasalPositions": [],
"devoicePositions": [],
"tags": [ "tags": [
{ {
"name": "P2", "name": "P2",
@ -18981,6 +19091,10 @@
], ],
"reading": "ばんごう", "reading": "ばんごう",
"position": 3, "position": 3,
"nasalPositions": [
3
],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -19137,6 +19251,10 @@
], ],
"reading": "ちゅうごし", "reading": "ちゅうごし",
"position": 0, "position": 0,
"nasalPositions": [
3
],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -19293,6 +19411,10 @@
], ],
"reading": "しょぎょう", "reading": "しょぎょう",
"position": 0, "position": 0,
"nasalPositions": [
2
],
"devoicePositions": [],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []
@ -19449,6 +19571,10 @@
], ],
"reading": "どぼくこうじ", "reading": "どぼくこうじ",
"position": 4, "position": 4,
"nasalPositions": [],
"devoicePositions": [
3
],
"tags": [], "tags": [],
"exclusiveExpressions": [], "exclusiveExpressions": [],
"exclusiveReadings": [] "exclusiveReadings": []

View File

@ -1013,6 +1013,174 @@ async function testFieldTemplatesUpdate(extDir) {
{{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText"}}{{/getMedia}}{{/if~}} {{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText"}}{{/getMedia}}{{/if~}}
{{/inline}} {{/inline}}
<<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}`.trimStart()
},
// hasMedia/getMedia update
{
oldVersion: 12,
newVersion: 13,
old: `
{{! Pitch Accents }}
{{#*inline "pitch-accent-item-downstep-notation"}}
{{~#scope~}}
<span>
{{~#set "style1a"~}}display:inline-block;position:relative;{{~/set~}}
{{~#set "style1b"~}}padding-right:0.1em;margin-right:0.1em;{{~/set~}}
{{~#set "style2a"~}}display:block;user-select:none;pointer-events:none;position:absolute;top:0.1em;left:0;right:0;height:0;border-top:0.1em solid;{{~/set~}}
{{~#set "style2b"~}}right:-0.1em;height:0.4em;border-right:0.1em solid;{{~/set~}}
{{~#each (getKanaMorae reading)~}}
{{~#set "style1"}}{{#get "style1a"}}{{/get}}{{/set~}}
{{~#set "style2"}}{{/set~}}
{{~#if (isMoraPitchHigh @index ../position)}}
{{~#set "style2"}}{{#get "style2a"}}{{/get}}{{/set~}}
{{~#if (op "!" (isMoraPitchHigh (op "+" @index 1) ../position))~}}
{{~#set "style1" (op "+" (get "style1") (get "style1b"))}}{{/set~}}
{{~#set "style2" (op "+" (get "style2") (get "style2b"))}}{{/set~}}
{{~/if~}}
{{~/if~}}
<span style="{{#get "style1"}}{{/get}}">{{{.}}}<span style="{{#get "style2"}}{{/get}}"></span></span>
{{~/each~}}
</span>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-graph-position-x"}}{{#op "+" 25 (op "*" index 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position-y"}}{{#op "+" 25 (op "?:" (isMoraPitchHigh index position) 0 50)}}{{/op}}{{/inline}}
{{#*inline "pitch-accent-item-graph-position"}}{{> pitch-accent-item-graph-position-x index=index position=position}} {{> pitch-accent-item-graph-position-y index=index position=position}}{{/inline}}
{{#*inline "pitch-accent-item-graph"}}
{{~#scope~}}
{{~#set "morae" (getKanaMorae reading)}}{{/set~}}
{{~#set "morae-count" (property (get "morae") "length")}}{{/set~}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {{#op "+" 50 (op "*" 50 (get "morae-count"))}}{{/op}} 100" style="display:inline-block;height:2em;">
<defs>
<g id="term-pitch-accent-graph-dot"><circle cx="0" cy="0" r="15" style="fill:#000;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-dot-downstep"><circle cx="0" cy="0" r="15" style="fill:none;stroke:#000;stroke-width:5;" /><circle cx="0" cy="0" r="5" style="fill:none;stroke:#000;stroke-width:5;" /></g>
<g id="term-pitch-accent-graph-triangle"><path d="M0 13 L15 -13 L-15 -13 Z" style="fill:none;stroke:#000;stroke-width:5;" /></g>
</defs>
<path style="fill:none;stroke:#000;stroke-width:5;" d="
{{~#set "cmd" "M"}}{{/set~}}
{{~#each (get "morae")~}}
{{~#get "cmd"}}{{/get~}}
{{~> pitch-accent-item-graph-position index=@index position=../position~}}
{{~#set "cmd" "L"}}{{/set~}}
{{~/each~}}
"></path>
<path style="fill:none;stroke:#000;stroke-width:5;stroke-dasharray:5 5;" d="M{{> pitch-accent-item-graph-position index=(op "-" (get "morae-count") 1) position=position}} L{{> pitch-accent-item-graph-position index=(get "morae-count") position=position}}"></path>
{{#each (get "morae")}}
<use href="{{#if (op "&&" (isMoraPitchHigh @index ../position) (op "!" (isMoraPitchHigh (op "+" @index 1) ../position)))}}#term-pitch-accent-graph-dot-downstep{{else}}#term-pitch-accent-graph-dot{{/if}}" x="{{> pitch-accent-item-graph-position-x index=@index position=../position}}" y="{{> pitch-accent-item-graph-position-y index=@index position=../position}}"></use>
{{/each}}
<use href="#term-pitch-accent-graph-triangle" x="{{> pitch-accent-item-graph-position-x index=(get "morae-count") position=position}}" y="{{> pitch-accent-item-graph-position-y index=(get "morae-count") position=position}}"></use>
</svg>
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-item-position"~}}
<span>[{{position}}]</span>
{{~/inline}}
{{#*inline "pitch-accent-item"}}
{{~#if (op "==" format "downstep-notation")~}}
{{~> pitch-accent-item-downstep-notation~}}
{{~else if (op "==" format "graph")~}}
{{~> pitch-accent-item-graph~}}
{{~else if (op "==" format "position")~}}
{{~> pitch-accent-item-position~}}
{{~/if~}}
{{/inline}}
{{#*inline "pitch-accent-item-disambiguation"}}
{{~#scope~}}
{{~#set "exclusive" (spread exclusiveExpressions exclusiveReadings)}}{{/set~}}
{{~#if (op ">" (property (get "exclusive") "length") 0)~}}
{{~#set "separator" ""~}}{{/set~}}
<em>({{#each (get "exclusive")~}}
{{~#get "separator"}}{{/get~}}{{{.}}}
{{~/each}} only) </em>
{{~/if~}}
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-list"}}
{{~#if (op ">" pitchCount 0)~}}
{{~#if (op ">" pitchCount 1)~}}<ol>{{~/if~}}
{{~#each pitches~}}
{{~#each pitches~}}
{{~#if (op ">" ../../pitchCount 1)~}}<li>{{~/if~}}
{{~> pitch-accent-item-disambiguation~}}
{{~> pitch-accent-item format=../../format~}}
{{~#if (op ">" ../../pitchCount 1)~}}</li>{{~/if~}}
{{~/each~}}
{{~/each~}}
{{~#if (op ">" pitchCount 1)~}}</ol>{{~/if~}}
{{~else~}}
No pitch accent data
{{~/if~}}
{{/inline}}
{{#*inline "pitch-accents"}}
{{~> pitch-accent-list format='downstep-notation'~}}
{{/inline}}
{{#*inline "pitch-accent-graphs"}}
{{~> pitch-accent-list format='graph'~}}
{{/inline}}
{{#*inline "pitch-accent-positions"}}
{{~> pitch-accent-list format='position'~}}
{{/inline}}
{{! End Pitch Accents }}
{{~> (lookup . "marker") ~}}`.trimStart(),
expected: `
{{! Pitch Accents }}
{{#*inline "pitch-accent-item"}}
{{~#pronunciation format=format reading=reading downstepPosition=position nasalPositions=nasalPositions devoicePositions=devoicePositions~}}{{~/pronunciation~}}
{{/inline}}
{{#*inline "pitch-accent-item-disambiguation"}}
{{~#scope~}}
{{~#set "exclusive" (spread exclusiveExpressions exclusiveReadings)}}{{/set~}}
{{~#if (op ">" (property (get "exclusive") "length") 0)~}}
{{~#set "separator" ""~}}{{/set~}}
<em>({{#each (get "exclusive")~}}
{{~#get "separator"}}{{/get~}}{{{.}}}
{{~/each}} only) </em>
{{~/if~}}
{{~/scope~}}
{{/inline}}
{{#*inline "pitch-accent-list"}}
{{~#if (op ">" pitchCount 0)~}}
{{~#if (op ">" pitchCount 1)~}}<ol>{{~/if~}}
{{~#each pitches~}}
{{~#each pitches~}}
{{~#if (op ">" ../../pitchCount 1)~}}<li>{{~/if~}}
{{~> pitch-accent-item-disambiguation~}}
{{~> pitch-accent-item format=../../format~}}
{{~#if (op ">" ../../pitchCount 1)~}}</li>{{~/if~}}
{{~/each~}}
{{~/each~}}
{{~#if (op ">" pitchCount 1)~}}</ol>{{~/if~}}
{{~else~}}
No pitch accent data
{{~/if~}}
{{/inline}}
{{#*inline "pitch-accents"}}
{{~> pitch-accent-list format='text'~}}
{{/inline}}
{{#*inline "pitch-accent-graphs"}}
{{~> pitch-accent-list format='graph'~}}
{{/inline}}
{{#*inline "pitch-accent-positions"}}
{{~> pitch-accent-list format='position'~}}
{{/inline}}
{{! End Pitch Accents }}
<<<UPDATE-ADDITIONS>>> <<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}`.trimStart() {{~> (lookup . "marker") ~}}`.trimStart()
} }