aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.md37
1 files changed, 35 insertions, 2 deletions
diff --git a/docs/templates.md b/docs/templates.md
index 8ee3bb0c..f1777fde 100644
--- a/docs/templates.md
+++ b/docs/templates.md
@@ -3,7 +3,7 @@
## Helpers
Yomichan supports several custom Handlebars helpers for rendering templates.
-The source code for these templates can be found [here](../ext/js/templates/sandbox/template-renderer.js).
+The source code for these templates can be found [here](../ext/js/templates/sandbox/anki-template-renderer.js).
### `dumpObject`
@@ -689,7 +689,7 @@ These functions are used together in order to request media and other types of o
The type of media to check for.
* _`args`_ <br>
Additional arguments for the media. The arguments depend on the media type.
- * _`escape`_ <br>
+ * _`escape`_ _(optional)_ <br>
Whether or not the resulting text should be HTML-escaped. If omitted, defaults to `true`.
**Available media types and arguments**
@@ -742,6 +742,39 @@ These functions are used together in order to request media and other types of o
</details>
+### `pronunciation`
+
+Converts pronunciation information into a formatted HTML content string. The display layout is the
+same as the system used for generating popup and search page dictionary entries.
+
+<details>
+ <summary>Syntax:</summary>
+
+ <code>{{#pronunciation <i>format=string</i> <i>reading=string</i> <i>downstepPosition=integer</i> <i>[nasalPositions=array]</i> <i>[devoicePositions=array]</i>}}{{/pronunciation}}</code><br>
+
+ * _`format`_ <br>
+ The format of the HTML to generate. This can be any of the following values:
+ * `'text'`
+ * `'graph'`
+ * `'position'`
+ * _`reading`_ <br>
+ The kana reading of the term.
+ * _`downstepPosition`_ <br>
+ The mora position of the downstep in the reading.
+ * _`nasalPositions`_ _(optional)_ <br>
+ An array of indices of mora that have a nasal pronunciation.
+ * _`devoicePositions`_ _(optional)_ <br>
+ An array of indices of mora that are devoiced.
+</details>
+<details>
+ <summary>Example:</summary>
+
+ ```handlebars
+ {{~#pronunciation format='text' reading='よむ' downstepPosition=1~}}{{~/pronunciation~}}
+ ```
+</details>
+
+
## Legacy Helpers
Yomichan has historically used Handlebars templates to generate the HTML used on the search page and results popup.