From d2fe34a7a37cc2f008c619d8fe028f7b0da4e4ab Mon Sep 17 00:00:00 2001 From: chengxl Date: Wed, 4 Feb 2026 10:47:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E7=89=88=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/LatexContent.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/common/LatexContent.php b/application/common/LatexContent.php index b2abfbc..1895b11 100644 --- a/application/common/LatexContent.php +++ b/application/common/LatexContent.php @@ -258,6 +258,7 @@ page={{stage_page}},%号 //查询正文信息 $aWhere = ['article_id' => $aProductionArticle['article_id'],'state' => 0]; $aArticleMain = Db::name('article_main')->field('am_id,article_id,type,content,ami_id,amt_id,is_h1,is_h2,is_h3,sort')->where($aWhere)->order('sort')->select(); + if(!empty($aArticleMain)){ //查询图片 @@ -308,7 +309,13 @@ page={{stage_page}},%号 } if($value['is_h1'] == 0 && $value['is_h2'] == 0 && $value['is_h3'] == 0){ if($value['type'] == 0 ){ - $sMain .= $this->dealContent($value['content'],$aReferences)."\\par\n"; + //处理内容 + $sMainContent = $this->dealContent($value['content'],$aReferences); + //替换myh3标签 + $contentpattern = '/(.*?)<\/myh3>/is'; + $contentreplacement = '\\subsubsection{$1}'; + $sMainContent = preg_replace($contentpattern, $contentreplacement, $sMainContent); + $sMain .= $sMainContent."\\par\n"; } if($value['type'] == 1 ){//图片 $aImageInfo = empty($aArticleMainImage[$value['ami_id']]) ? [] : $aArticleMainImage[$value['ami_id']]; @@ -355,7 +362,6 @@ page={{stage_page}},%号 } } } - $aSearch['{{article_main}}'] = empty($sMain) ? '' : $sMain."\n"; //模版内容替换 $sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo);