larecipe icon indicating copy to clipboard operation
larecipe copied to clipboard

Search functionality breaks when round brackets "()" are used in the link name

Open parthjani7 opened this issue 3 years ago • 1 comments

I am using round brackets ( ) in the link name, i.e. - The Link (example).

The following line grabs everything from the round bracket and generates an array of links from index.md page, at that time it also collects substrings from the link name, when round brackets are used in the title.

preg_match_all('/\(([^)]+)\)/', $this->files->get($path), $matches);

When search functionality gets called, clicking on the search icon, it comes down to the following line: explode("{{version}}", $page)[1];

at that point it breaks, because the above-mentioned regex in the getPages() has already collected example from the link name and explode cannot find {{version}}

Regex needs to be modified to ignore everything between [ ] which would be link name in the index.md

parthjani7 avatar Mar 14 '21 20:03 parthjani7

Thanks @parthjani7 for submitting this. WIP

saleem-hadad avatar Mar 22 '21 16:03 saleem-hadad