{{-- 知识点讲解完整模板 --}} 知识点讲解 @include('pdf.partials.kp-explain-styles') @include('pdf.partials.katex-scripts')
知识点讲解
本章节用于梳理本卷涉及的知识点,帮助学生在做题前完成预习/复盘。
@if(empty($knowledgePoints))
暂无知识点数据
@else
@foreach($knowledgePoints as $index => $kp)
{{ $loop->iteration }}、{{ $kp['kp_name'] ?? ($kp['kp_code'] ?? '未命名知识点') }}
@if(!empty($kp['explanation'])) {{-- 解析 ## 标题分段:## 知识点 和 ## 知识点应用 --}} @php $explanation = $kp['explanation']; // 提取 ## 知识点 部分 preg_match('/##\s*知识点\s*\n([\s\S]*?)(?=##\s*知识点应用|$)/u', $explanation, $knowledgeMatch); $knowledgeContent = isset($knowledgeMatch[1]) ? trim($knowledgeMatch[1]) : ''; // 提取 ## 知识点应用 部分 preg_match('/##\s*知识点应用\s*\n([\s\S]*)/u', $explanation, $applicationMatch); $applicationContent = isset($applicationMatch[1]) ? trim($applicationMatch[1]) : ''; @endphp @if(!empty($knowledgeContent))
知识点
{!! \App\Services\MathFormulaProcessor::processFormulas($knowledgeContent) !!}
@endif @if(!empty($applicationContent))
知识点应用
{!! \App\Services\MathFormulaProcessor::processFormulas($applicationContent) !!}
@endif @endif
@endforeach
@endif