@@ -215,25 +215,6 @@ public static function formatEntity($entity, $highlight = false)
215215 return $ repo . '<span class="superset"> • </span> ' . $ path . '<br> ' . $ entity ;
216216 }
217217
218- /**
219- * Highlight specific elements in the string.
220- *
221- * @param string $string Source text
222- * @return string Same string with specific sub-strings in <span>
223- * elements for styling with CSS
224- */
225- public static function highlight ($ string )
226- {
227- $ replacements = [
228- ' ' => '<span class="highlight-space" title="White space"> </span> ' ,
229- ' ' => '<span class="highlight-red" title="Unicode non-breaking space"> </span> ' ,
230- '… ' => '<span class="highlight-gray" title="Real ellipsis">…</span> ' ,
231- '… ' => '<span class="highlight-red" title="HTML ellipsis">…</span> ' ,
232- ];
233-
234- return Strings::multipleStringReplace ($ replacements , $ string );
235- }
236-
237218 /**
238219 * Html table of search results used by the main view (needs a lot of refactoring)
239220 *
@@ -328,20 +309,15 @@ public static function resultsTable($search_object, $search_results, $page)
328309 $ target_string = htmlspecialchars ($ target_string );
329310 $ source_string = Utils::highlightString ($ source_string );
330311 $ target_string = Utils::highlightString ($ target_string );
312+ $ source_string = Strings::highlightSpecial ($ source_string );
313+ $ target_string = Strings::highlightSpecial ($ target_string );
331314
332315 if ($ extra_locale ) {
333316 $ target_string2 = htmlspecialchars ($ target_string2 );
334317 $ target_string2 = Utils::highlightString ($ target_string2 );
318+ $ target_string2 = Strings::highlightSpecial ($ target_string2 );
335319 }
336320
337- $ replacements = [
338- ' ' => '<span class="highlight-gray" title="Non breakable space"> </span> ' , // Nbsp highlight
339- ' ' => '<span class="highlight-red" title="Thin space"> </span> ' , // Thin space highlight
340- '… ' => '<span class="highlight-gray">…</span> ' , // Right ellipsis highlight
341- '… ' => '<span class="highlight-gray">…</span> ' , // Right ellipsis highlight
342- ];
343-
344- $ target_string = Strings::multipleStringReplace ($ replacements , $ target_string );
345321 $ clipboard_target_string = 'clip_ ' . md5 ($ target_string );
346322 $ clipboard_target_string2 = 'clip_ ' . md5 ($ target_string2 );
347323
0 commit comments