word/finder: move html formatting into common method
[sheet.git] / word / finder.js
index ed8905462a098fb43e4029dddb0d468baacd8284..3dca29b8711061be90d9cbe5193fbca7c8329c7e 100644 (file)
@@ -1,14 +1,4 @@
 class WordFinder extends WordQuiz {
-       namehtml(name) {
-               let aliases = name.split('/');
-               let html = aliases.shift();
-               html = html.replace(/\((.+)\)/, '<small>$1</small>');
-               for (let alias of aliases) {
-                       html += ` <small>(${alias})</small>`;
-               }
-               return html;
-       }
-
        add(catitem, rows) {
                rows.forEach(word => {
                        if (!word) return;
@@ -19,7 +9,7 @@ class WordFinder extends WordQuiz {
                        }
                        if (word.title) {
                                put(figitem, 'figcaption', {
-                                       innerHTML: this.namehtml(word.title),
+                                       innerHTML: word.html,
                                });
                        }
                        if (this.preset.debug) {