From bae7f6414bb8f7f18ac0e220aa6ef2e277041229 Mon Sep 17 00:00:00 2001
From: Alexander Ebert
Date: Thu, 30 Mar 2023 18:18:33 +0200
Subject: [PATCH] Use a regex to insert a whitespace instead of stripping the
tags
---
.../search/SearchIndexManager.class.php | 20 +++----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php
index a9f887422a..fc42640306 100644
--- a/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php
+++ b/wcfsetup/install/files/lib/system/search/SearchIndexManager.class.php
@@ -122,23 +122,9 @@ class SearchIndexManager extends SingletonFactory implements ISearchIndexManager
$languageID = null,
$metaData = ''
) {
- // Force replace certain tags with a whitespace to prevent words from adjacent
- // lines to be glued together.
- $message = \str_replace([
- '
',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '
',
- '',
- '',
- '',
- ], ' ', $message);
+ // Inserts a whitespace after certain tags to prevent words from adjacent
+ // lines to be effectively be glued together when the tags are removed.
+ $message = \preg_replace('~(
|(?:h[1-6]|kbd|li|p|pre|td|woltlab-metacode)>)~', '\\1 ', $message);
// strip html; remove whitespace from beginning and end of the message
$message = StringUtil::trim(StringUtil::stripHTML($message));
--
2.20.1