summaryrefslogtreecommitdiff
path: root/ext/bg/js/handlebars.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2019-10-20 11:23:20 -0700
committerAlex Yatskov <alex@foosoft.net>2019-10-20 11:23:20 -0700
commit438498435227cfa59cf9ed3430045b288cd2a7c0 (patch)
tree6a05520e5d6fa8d26d372673a9ed3e5d2da7e3fd /ext/bg/js/handlebars.js
parent06d7713189be9eb51669d3842b78278371e6cfa4 (diff)
parentd32fd1381b6cd5141a21c22f9ef639b2fe9774fb (diff)
Merge branch 'master' into testing
Diffstat (limited to 'ext/bg/js/handlebars.js')
-rw-r--r--ext/bg/js/handlebars.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js
index 66d5fa2b..92764a20 100644
--- a/ext/bg/js/handlebars.js
+++ b/ext/bg/js/handlebars.js
@@ -75,6 +75,10 @@ function handlebarsMultiLine(options) {
return options.fn(this).split('\n').join('<br>');
}
+function handlebarsSanitizeCssClass(options) {
+ return options.fn(this).replace(/[^_a-z0-9\u00a0-\uffff]/ig, '_');
+}
+
function handlebarsRegisterHelpers() {
if (Handlebars.partials !== Handlebars.templates) {
Handlebars.partials = Handlebars.templates;
@@ -83,6 +87,7 @@ function handlebarsRegisterHelpers() {
Handlebars.registerHelper('furiganaPlain', handlebarsFuriganaPlain);
Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks);
Handlebars.registerHelper('multiLine', handlebarsMultiLine);
+ Handlebars.registerHelper('sanitizeCssClass', handlebarsSanitizeCssClass);
}
}