From ca97e38bd22875e23cfe6f70d1803ea31d6f0e89 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 2 Jul 2021 22:46:38 -0400 Subject: Anki support for structured-content (#1786) * Update how glossary text is formatted * Update structured content and image generation * Pass root data to _createStructuredContentGenerator * Implement media URLs * Update documentation * Update options util * Apply styles to content * Improve HTML normalization * Update DatabaseVM.fetch function * Update test * Update test data --- docs/templates.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'docs') diff --git a/docs/templates.md b/docs/templates.md index 81259a3f..95155bea 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -645,6 +645,35 @@ Returns an array representing the different pitch categories for a specific term +### `formatGlossary` + +Formats a glossary entry to a HTML content string. This helper handles image and +structured-content generation. + +
+ Syntax: + + {{#formatGlossary dictionary}}{{{definitionEntry}}}{{/pitchCategories}}
+ + * _`@dictionary`_
+ The dictionary that the glossary entry belongs to. + * _`@definitionEntry`_
+ The definition entry object in raw form. +
+
+ Example: + + ```handlebars + {{#each glossary}}{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}{{/each}} + ``` + + Output: + ```html + Here is the content of a gloss, which may include formatted HTML. + ``` +
+ + ## Legacy Helpers Yomichan has historically used Handlebars templates to generate the HTML used on the search page and results popup. -- cgit v1.2.3