Make parseReferences() parse its own references

This commit is contained in:
Robbie Antenesse 2019-05-30 11:18:16 -06:00 committed by Robbie Antenesse
parent dafecd9582
commit 19e41958a4
1 changed files with 34 additions and 31 deletions

View File

@ -46,7 +46,9 @@ export function sortWords(render) {
}
}
export function parseReferences(detailsMarkdown, references) {
export function parseReferences(detailsMarkdown) {
const references = detailsMarkdown.match(/\{\{.+?\}\}/g);
if (references && Array.isArray(references)) {
new Set(references).forEach(reference => {
let wordToFind = reference.replace(/\{\{|\}\}/g, '');
let homonymn = 0;
@ -83,6 +85,7 @@ export function parseReferences(detailsMarkdown, references) {
detailsMarkdown = detailsMarkdown.replace(new RegExp(reference, 'g'), wordMarkdownLink);
}
});
}
return detailsMarkdown;
}