diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-07-06 19:43:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 19:43:53 -0400 |
commit | e88d63fc6d251bc298eb721fee1cbb9f5f4b752e (patch) | |
tree | f24b38bd421da53f84ab6b47ddff3c6492d44087 /ext/data | |
parent | e15513208584764526e2348ca7796ea665925086 (diff) |
Template renderer media updates (#1802)
* Add TemplateRendererMediaProvider to abstract media-related functionality
* Update representation of injected media
* Update templates
* Update upgrade file
* Update tests
* Update test data
* Force media to be an object
* Update test data
Diffstat (limited to 'ext/data')
-rw-r--r-- | ext/data/templates/anki-field-templates-upgrade-v13.handlebars | 34 | ||||
-rw-r--r-- | ext/data/templates/default-anki-field-templates.handlebars | 14 |
2 files changed, 42 insertions, 6 deletions
diff --git a/ext/data/templates/anki-field-templates-upgrade-v13.handlebars b/ext/data/templates/anki-field-templates-upgrade-v13.handlebars index 04cc855a..ebf9069e 100644 --- a/ext/data/templates/anki-field-templates-upgrade-v13.handlebars +++ b/ext/data/templates/anki-field-templates-upgrade-v13.handlebars @@ -15,3 +15,37 @@ {{=======}} {{#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~}} +{{>>>>>>>}} diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars index 67547732..62da796d 100644 --- a/ext/data/templates/default-anki-field-templates.handlebars +++ b/ext/data/templates/default-anki-field-templates.handlebars @@ -31,8 +31,8 @@ {{/inline}} {{#*inline "audio"}} - {{~#if definition.audioFileName~}} - [sound:{{definition.audioFileName}}] + {{~#if (hasMedia "audio")~}} + [sound:{{#getMedia "audio" format="fileName"}}{{/getMedia}}] {{~/if~}} {{/inline}} @@ -173,7 +173,9 @@ {{/inline}} {{#*inline "screenshot"}} - <img src="{{definition.screenshotFileName}}" /> + {{~#if (hasMedia "screenshot")~}} + <img src="{{#getMedia "screenshot" format="fileName"}}{{/getMedia}}" /> + {{~/if~}} {{/inline}} {{#*inline "document-title"}} @@ -291,13 +293,13 @@ {{! End Pitch Accents }} {{#*inline "clipboard-image"}} - {{~#if definition.clipboardImageFileName~}} - <img src="{{definition.clipboardImageFileName}}" /> + {{~#if (hasMedia "clipboardImage")~}} + <img src="{{#getMedia "clipboardImage" format="fileName"}}{{/getMedia}}" /> {{~/if~}} {{/inline}} {{#*inline "clipboard-text"}} - {{~#if definition.clipboardText~}}{{definition.clipboardText}}{{~/if~}} + {{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText" format="text"}}{{/getMedia}}{{/if~}} {{/inline}} {{#*inline "conjugation"}} |