Add fallback regex

This commit is contained in:
Augusto Gunsch 2021-12-26 16:38:49 -03:00
parent d30365ae01
commit 57338dc0ce
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 2 additions and 1 deletions

View File

@ -159,7 +159,8 @@ $(document).ready(() => {
html += sense.glosses[0].replace(new RegExp(`of ${word}$`), ''); html += sense.glosses[0].replace(new RegExp(`of ${word}$`), '');
html += ` of <a href="#${word}" class="link-primary">${word}</a>`; html += ` of <a href="#${word}" class="link-primary">${word}</a>`;
} else { } else {
html += sense.glosses[0]; let link = ' of <a href="#$1" class="link-primary">$1</a>';
html += sense.glosses[0].replace(/of\s+([\u00BF-\u1FFF\u2C00-\uD7FF\w]+)\s*$/, link);
} }
html += '</li>'; html += '</li>';