mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-06-06 09:16:36 +02:00
Make parseReferences() parse its own references
This commit is contained in:
parent
dafecd9582
commit
19e41958a4
1 changed files with 34 additions and 31 deletions
|
@ -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…
Add table
Reference in a new issue