summaryrefslogtreecommitdiff
path: root/ext/data/templates/anki-field-templates-upgrade-v13.handlebars
blob: afa5a2c0bfe517cb571654b908aa2cc37e64944f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{{#*inline "selection-text"}}
    {{~#if (hasMedia "selectionText")}}{{#getMedia "selectionText"}}{{/getMedia}}{{/if~}}
{{/inline}}

{{#*inline "sentence-furigana"}}
    {{~#if definition.cloze~}}
        {{~#if (hasMedia "textFurigana" definition.cloze.sentence)~}}
            {{#getMedia "textFurigana" definition.cloze.sentence escape=false}}{{/getMedia}}
        {{~else~}}
            {{definition.cloze.sentence}}
        {{~/if~}}
    {{~/if~}}
{{/inline}}

{{<<<<<<<}}
{{#each glossary}}{{#multiLine}}{{.}}{{/multiLine}}{{/each}}
{{=======}}
{{#each glossary}}{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}{{/each}}
{{>>>>>>>}}

{{<<<<<<<}}
{{#each glossary}}{{#multiLine}}{{.}}{{/multiLine}}{{#unless @last}} | {{/unless}}{{/each}}
{{=======}}
{{#each glossary}}{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}{{#unless @last}} | {{/unless}}{{/each}}
{{>>>>>>>}}

{{<<<<<<<}}
{{#each glossary}}<li>{{#multiLine}}{{.}}{{/multiLine}}</li>{{/each}}
{{=======}}
{{#each glossary}}<li>{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}</li>{{/each}}
{{>>>>>>>}}

{{<<<<<<<}}
    {{~#if definition.audioFileName~}}
        [sound:{{definition.audioFileName}}]
    {{~/if~}}
{{=======}}
    {{~#if (hasMedia "audio")~}}
        [sound:{{#getMedia "audio"}}{{/getMedia}}]
    {{~/if~}}
{{>>>>>>>}}

{{<<<<<<<}}
    <img src="{{definition.screenshotFileName}}" />
{{=======}}
    {{~#if (hasMedia "screenshot")~}}
        <img src="{{#getMedia "screenshot"}}{{/getMedia}}" />
    {{~/if~}}
{{>>>>>>>}}

{{<<<<<<<}}
    {{~#if definition.clipboardImageFileName~}}
        <img src="{{definition.clipboardImageFileName}}" />
    {{~/if~}}
{{=======}}
    {{~#if (hasMedia "clipboardImage")~}}
        <img src="{{#getMedia "clipboardImage"}}{{/getMedia}}" />
    {{~/if~}}
{{>>>>>>>}}

{{<<<<<<<}}
{{~#if definition.clipboardText~}}{{definition.clipboardText}}{{~/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}}
{{>>>>>>>}}