diff options
Diffstat (limited to 'ext/util.js')
-rw-r--r-- | ext/util.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/util.js b/ext/util.js index 76579cac..cd71e873 100644 --- a/ext/util.js +++ b/ext/util.js @@ -68,3 +68,23 @@ function getPopupPositionForRange(popup, range, offset) { return {x: posX, y: posY}; } + +function renderDefs(terms) { + const outputs = []; + for (let term of terms) { + outputs.push(renderDef(term)); + } + + return outputs.join(''); +} + +function renderDef(term) { + return ` +<div class="yomichan-def"> + <span class="yomichan-def-expression">${term.expression}</span> + <span class="yomichan-def-rules">${term.rules.join(' < ')}</span> + <span class="yomichan-def-reading">${term.reading}</span> + <span class="yomichan-def-glossary">${term.glossary}</span> +</div> +`; +} |