生成pdf
This commit is contained in:
@@ -259,11 +259,6 @@ page={{stage_page}},%号
|
||||
$aWhere = ['ami_id' => ['in',$aAmiId],'state' => 0];
|
||||
$aArticleMainImage = Db::name('article_main_image')->field('ami_id,url,note')->where($aWhere)->select();
|
||||
$aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id');
|
||||
// //查询表格
|
||||
// $aAmtId = array_unique(array_column($aArticleMain, 'amt_id'));
|
||||
// $aWhere = ['amt_id' => ['in',$aAmtId],'state' => 0];
|
||||
// $aArticleMainTable = Db::name('article_main_table')->field('amt_id,type,table_data,url,title,note')->where($aWhere)->select();
|
||||
// $aArticleMainTable = empty($aArticleMainTable) ? [] : array_column($aArticleMainTable, null,'amt_id');
|
||||
//获取图片模版
|
||||
$sImageTempalte = $this->sImageTempalte;
|
||||
//数据处理
|
||||
@@ -329,15 +324,6 @@ page={{stage_page}},%号
|
||||
$sTableInfo = $oProduction->tableCovertLatex($value['amt_id'],$aReferences);
|
||||
var_dump($sTableInfo);
|
||||
$sMain .= $sTableInfo."\\par\n";
|
||||
// $aTableInfo = empty($aArticleMainTable[$value['amt_id']]) ? [] : $aArticleMainTable[$value['amt_id']];
|
||||
// if(empty($aTableInfo['table_data'])){
|
||||
// continue;
|
||||
// }
|
||||
// $aTableResult = $oLatexTable->generateTable($aTableInfo);
|
||||
// var_dump($aTableResult);exit;
|
||||
// if(empty($aTableResult['data'])){
|
||||
// continue;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -550,48 +536,6 @@ page={{stage_page}},%号
|
||||
}
|
||||
return trim($dateStr);
|
||||
}
|
||||
/**
|
||||
* 内容处理
|
||||
*/
|
||||
// private function dealContent($content = '', $target = 'latex',$iIsDeal = 1) {
|
||||
|
||||
// // 空值直接返回
|
||||
// if (empty($content)) {
|
||||
// return '';
|
||||
// }
|
||||
|
||||
// //统一编码为UTF-8
|
||||
// $content = mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content));
|
||||
// //过滤不可见/非法字符
|
||||
// $content = preg_replace('/[\x00-\x1F\x7F]/u', '', $content);
|
||||
// //整合所有替换规则(按优先级排序:先处理HTML实体,再处理LaTeX特殊字符)
|
||||
// $replaceRules = [
|
||||
// // ========== HTML实体替换 ==========
|
||||
// ' ' => '~', // HTML非断行空格 → LaTeX非断行空格
|
||||
// ' ' => '~', // 兼容无分号的 
|
||||
// '&' => '\&', // HTML& → LaTeX转义&
|
||||
// '<' => '<', // HTML< → 直接保留
|
||||
// '>' => '>', // HTML> → 直接保留
|
||||
// // ========== LaTeX特殊字符转义 ==========
|
||||
// '{' => '\{', // 左花括号转义
|
||||
// '}' => '\}', // 右花括号转义
|
||||
// '&' => '\&', // 原生&转义(需在&之后,避免覆盖)
|
||||
// '%' => '\%', // 百分号转义(LaTeX注释符)
|
||||
// '_' => '\_', // 下划线转义(LaTeX下标符)
|
||||
// 'κ' => '$\kappa$', // 希腊字母κ → LaTeX数学环境(避免乱码)
|
||||
// '-' => '\text{-}', // 短横线强制保留形态
|
||||
// ':' => ':', // 冒号无需转义(占位,便于统一维护)
|
||||
// ];
|
||||
|
||||
// //执行批量替换
|
||||
// $content = strtr($content, $replaceRules);
|
||||
// //清理多余空格/换行
|
||||
// $content = preg_replace('/\s+/u', ' ', trim($content));
|
||||
// if($iIsDeal == 1){
|
||||
// $content = $this->htmlToLaTeX($content);
|
||||
// }
|
||||
// return $content;
|
||||
// }
|
||||
private function dealContent($content = '',$aReferences = []) {
|
||||
// 空值直接返回
|
||||
if(empty($content)){
|
||||
@@ -607,33 +551,6 @@ page={{stage_page}},%号
|
||||
$sContent = $oProduction->convertToLatex($content,$aReferences);
|
||||
$content = $this->htmlToLaTeX($content);
|
||||
return $sContent;
|
||||
// //整合所有替换规则(按优先级排序:先处理HTML实体,再处理LaTeX特殊字符)
|
||||
// $replaceRules = [
|
||||
// // ========== HTML实体替换 ==========
|
||||
// ' ' => '~', // HTML非断行空格 → LaTeX非断行空格
|
||||
// ' ' => '~', // 兼容无分号的 
|
||||
// '&' => '\&', // HTML& → LaTeX转义&
|
||||
// '<' => '<', // HTML< → 直接保留
|
||||
// '>' => '>', // HTML> → 直接保留
|
||||
// // ========== LaTeX特殊字符转义 ==========
|
||||
// '{' => '\{', // 左花括号转义
|
||||
// '}' => '\}', // 右花括号转义
|
||||
// '&' => '\&', // 原生&转义(需在&之后,避免覆盖)
|
||||
// '%' => '\%', // 百分号转义(LaTeX注释符)
|
||||
// '_' => '\_', // 下划线转义(LaTeX下标符)
|
||||
// 'κ' => '$\kappa$', // 希腊字母κ → LaTeX数学环境(避免乱码)
|
||||
// '-' => '\text{-}', // 短横线强制保留形态
|
||||
// ':' => ':', // 冒号无需转义(占位,便于统一维护)
|
||||
// ];
|
||||
|
||||
// //执行批量替换
|
||||
// $content = strtr($content, $replaceRules);
|
||||
// //清理多余空格/换行
|
||||
// $content = preg_replace('/\s+/u', ' ', trim($content));
|
||||
// if($iIsDeal == 1){
|
||||
// $content = $this->htmlToLaTeX($content);
|
||||
// }
|
||||
// return $content;
|
||||
}
|
||||
private function htmlToLaTeX($text = ''){
|
||||
if(empty($text)){
|
||||
|
||||
Reference in New Issue
Block a user