diff --git a/src/components/DefElement.vue b/src/components/DefElement.vue index 8350b852d4cd629a06e86622a58d4292e2a394d2..77fd070ab3bf579b192092f348fe78d9efbfb340 100644 --- a/src/components/DefElement.vue +++ b/src/components/DefElement.vue @@ -18,6 +18,15 @@ import entities from '../utils/entities.js' import helpers from '../utils/helpers.js' +function replace_grammar_id(item, lang) { + let content = item.content + if (content.includes('$') && (item.items[0].id)){ + let replacement_item = entities[lang][item.items[0].id]['expansion'] + content = content.replace('$', replacement_item)} + + return content +} + export default { name: 'DefElement', props: { @@ -51,6 +60,7 @@ export default { source: path } else if (item.type_ == 'pronunciation') return {type: item.type_, html: item.string} + else if (item.type_ == 'pronunciation_guide') return {type: 'pronunciation_guide', html: replace_grammar_id(item, lang)} else if (item.type_ == 'superscript') return {type: item.type_, html: item.text, tag: 'sup'} else if (item.type_ == 'subscript') return {type: item.type_, html: item.text, 'tag': 'sub'} else if (item.type_ == 'quote_inset') return {type: item.type_, body: item, html: '', tag: 'DefElement', props: {body: item, tag: 'i', dictionary: lang}} @@ -84,7 +94,7 @@ export default { <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> -.usage, .pronunciation { +.usage, .pronunciation_guide { font-style: italic; }