aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 74e1f49e..64c79ab5 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -504,6 +504,11 @@ function jsonLoadDb(indexUrl, indexLoaded, termsLoaded, kanjiLoaded) {
* Helpers
*/
+function handlebarsDumpObject(options) {
+ const dump = JSON.stringify(options.fn(this), null, 4);
+ return Handlebars.Utils.escapeExpression(dump);
+}
+
function handlebarsKanjiLinks(options) {
let result = '';
for (const c of options.fn(this)) {
@@ -523,6 +528,7 @@ function handlebarsMultiLine(options) {
function handlebarsRegister() {
Handlebars.partials = Handlebars.templates;
+ Handlebars.registerHelper('dumpObject', handlebarsDumpObject);
Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks);
Handlebars.registerHelper('multiLine', handlebarsMultiLine);
}