Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Updates highlighter algorithm

AuthorDave Jarvis <email>
Date2026-02-14 19:21:40 GMT-0800
Commit08a477496faa607834d37afc6af00ba61764c673
Parent1d07601
Delta6 lines added, 2 lines removed, 4-line increase
render/Highlighter.php
$delim = $pattern[0];
$inner = substr($pattern, 1, strrpos($pattern, $delim) - 1);
- $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
+ $patterns[] = "(?P<$name>$inner)";
}
+
+ $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
$combined = '/' . implode('|', $patterns) . '/msu';
- return preg_replace_callback($combined, function ($matches) {
+ $result = preg_replace_callback($combined, function ($matches) {
foreach ($matches as $key => $value) {
if (!is_numeric($key) && $value !== '') {
return htmlspecialchars($matches[0]);
}, $this->content);
+
+ return $result ?? htmlspecialchars($this->content);
}