You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
more precisely, it could not support glossary term with non-word character on heading or trailing, e.g. Connétable could be matched, but Brancaleone von Andalò failed. If one term starting with ( or ending with ), it could not be matched either. Actually, words with special character are so common in glossary, especially in books of other language(french, german, japanese).
also an old bug since gitbook, hope it could be fixed. I think the root case of #233 is the same.
HonKit version: 4.0.4
Step to reproduce
create one term Brancaleone von Andalò in GLOSSARY.md
insert Brancaleone von Andalò in paragraph of one page file
Link to code example:
Der Papst gehört nicht nach Anagni oder Lyon, nicht nach Perugia oder Assisi, sondern nach Rom.« Ein kraftvoller Mann gab den Römern diese Sprache ein, Brancaleone von Andalò, ihr damaliger Senator.
Expected results
Brancaleone von Andalò in article could be a glossary link.
Actual results
no link created.
The text was updated successfully, but these errors were encountered:
functionpregQuote(str){return`${str}`.replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1");}constname="Brancaleone von Andalò";constsearchRegex=newRegExp(`\\b(${pregQuote(name.toLowerCase())})\\b`,"gi");console.log(searchRegex.test("test Brancaleone von Andalò test"));// => false
\b is for ASCII characters.
We need to use unicode safe word boundary.
@azu Great! \b in regex indeed only bound word character, and unicode word boundary could meet most cases, but what if term like Henry (VII)? parentheses in word trailing
Summary
more precisely, it could not support glossary term with non-word character on heading or trailing, e.g.
Connétable
could be matched, butBrancaleone von Andalò
failed. If one term starting with(
or ending with)
, it could not be matched either. Actually, words with special character are so common in glossary, especially in books of other language(french, german, japanese).also an old bug since gitbook, hope it could be fixed. I think the root case of #233 is the same.
Step to reproduce
Brancaleone von Andalò
in GLOSSARY.mdBrancaleone von Andalò
in paragraph of one page fileExpected results
Brancaleone von Andalò
in article could be a glossary link.Actual results
no link created.
The text was updated successfully, but these errors were encountered: