diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 85e3b0f..f584f23 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -2053,7 +2053,7 @@ class Production extends Base //整理引用信息的内容 // $updatedContent = $this->convertReferencesToLatex($article_main_info['content'], $refArray); //替换其他标签 - $updatedContent = $this->convertToLatex($updatedContent,$refArray); + $updatedContent = $this->convertToLatex($article_main_info['content'],$refArray); //做内容替换 $article_main_info['content'] = $updatedContent; $fragContentList[] = $article_main_info; @@ -2095,6 +2095,8 @@ class Production extends Base ->where('state', 0) ->order('index ASC') ->select(); + + $refArray = []; foreach ($references as $ref) { $refArray[$ref['index'] + 1] = $ref; @@ -2112,7 +2114,10 @@ class Production extends Base if (empty(trim($content))) { return ''; } + $content = str_replace("–","-",$content); + $content = $this->convertReferencesToLatex($content, $refArray); + // 步骤1:忽略并移除、和标签 $content = $this->removeIgnoredTags($content); @@ -2428,7 +2433,7 @@ class Production extends Base '%' => '\\%', '#' => '\\#', '&' => '\\&', - '_' => '\\_', +// '_' => '\\_', '^' => '\\textasciicircum', '~' => '\\textasciitilde', ]; @@ -2619,7 +2624,6 @@ class Production extends Base function ($matches) use ($references) { // 去除匹配中的 $cleanedMatch = str_replace(['', ''], '', $matches[0]); - // 提取引用编号部分(去掉方括号) $referencePart = trim($cleanedMatch, '[]'); @@ -2647,7 +2651,6 @@ class Production extends Base // 单个引用编号处理 $index = intval($part); $arrayIndex = $index; - if (isset($references[$arrayIndex]) && !empty($references[$arrayIndex]['p_refer_id'])) { $latexRefs[] = 'ref_' . $references[$arrayIndex]['p_refer_id']; } else {