Make parseReferences() parse its own references
This commit is contained in:
parent
dafecd9582
commit
19e41958a4
|
@ -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 => {
|
new Set(references).forEach(reference => {
|
||||||
let wordToFind = reference.replace(/\{\{|\}\}/g, '');
|
let wordToFind = reference.replace(/\{\{|\}\}/g, '');
|
||||||
let homonymn = 0;
|
let homonymn = 0;
|
||||||
|
@ -83,6 +85,7 @@ export function parseReferences(detailsMarkdown, references) {
|
||||||
detailsMarkdown = detailsMarkdown.replace(new RegExp(reference, 'g'), wordMarkdownLink);
|
detailsMarkdown = detailsMarkdown.replace(new RegExp(reference, 'g'), wordMarkdownLink);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return detailsMarkdown;
|
return detailsMarkdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue