yomichan/ext/data/templates/anki-field-templates-upgrade-v13.handlebars
toasted-nutbread 8c68fa4d94
Anki text furigana parsing and {sentence-furigana} marker (#1814)
* Add support for textFurigana media

* Add readingMode parameter

* Implement readingMode

* Add {sentence-furigana} marker

* Fallback to sentence if furigana isn't available

* Update test data
2021-07-09 17:48:27 -04:00

66 lines
2.0 KiB
Handlebars

{{#*inline "selection-text"}}
{{~#if (hasMedia "selectionText")}}{{#getMedia "selectionText" format="text"}}{{/getMedia}}{{/if~}}
{{/inline}}
{{#*inline "sentence-furigana"}}
{{~#if definition.cloze~}}
{{~#if (hasMedia "textFurigana" definition.cloze.sentence)~}}
{{#getMedia "textFurigana" definition.cloze.sentence format="html"}}{{/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" format="fileName"}}{{/getMedia}}]
{{~/if~}}
{{>>>>>>>}}
{{<<<<<<<}}
<img src="{{definition.screenshotFileName}}" />
{{=======}}
{{~#if (hasMedia "screenshot")~}}
<img src="{{#getMedia "screenshot" format="fileName"}}{{/getMedia}}" />
{{~/if~}}
{{>>>>>>>}}
{{<<<<<<<}}
{{~#if definition.clipboardImageFileName~}}
<img src="{{definition.clipboardImageFileName}}" />
{{~/if~}}
{{=======}}
{{~#if (hasMedia "clipboardImage")~}}
<img src="{{#getMedia "clipboardImage" format="fileName"}}{{/getMedia}}" />
{{~/if~}}
{{>>>>>>>}}
{{<<<<<<<}}
{{~#if definition.clipboardText~}}{{definition.clipboardText}}{{~/if~}}
{{=======}}
{{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText" format="text"}}{{/getMedia}}{{/if~}}
{{>>>>>>>}}