Browse Source

fleat:update template

igb 1 month ago
parent
commit
4c0b8a6589
1 changed files with 5 additions and 2 deletions
  1. 5 2
      usr/themes/beardocs/archive.php

+ 5 - 2
usr/themes/beardocs/archive.php

@@ -299,8 +299,11 @@ if (!empty($keyword)&&(strpos($PathInfo, '/search') === 0))
 //                $truncatedContent = substr($truncatedContent, 0, $maxLength - 3) . '...';
 //            }
 
-        // 按第一个问号(?)或句号(.)分割问题和答案
-            if (preg_match('/^([^?.]+[?.])/', $contentWithoutNumber, $matches)) {
+            // 将全角问号(?)和句号(。)替换为半角问号(?)和句号(.)
+            $contentWithoutNumber = str_replace(['?', '。'], ['?', '.'], $contentWithoutNumber);
+
+            // 按第一个问号(?)或句号(.)分割问题和答案
+            if (preg_match('/^([^?.]+[?.])/', $contentWithoutNumber, $matches)) {
                 $question = trim($matches[0]); // 问题部分(包括问号或句号)
                 $answer = trim(substr($contentWithoutNumber, strlen($matches[0]))); // 答案部分
             } else {