fix(plot): 修复函数图像审阅问题(1 P1 + 2 P2)
- P1 浮点刻度死循环:_ticks 改为有上限的整数索引推进并校验步长推进 - P2 求值异常:白名单函数校验参数数量;负数底非整数指数按断点处理;采样容错复数 - P2 无效纵轴范围:退化/非有限 range 丢弃并自动采样重算;渲染异常回退占位不阻断导出 - 补 6 个回归测试 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -209,7 +209,11 @@ class HtmlExporter:
|
||||
warnings.append(self._format_plot_diagnostic(diag))
|
||||
if parsed.plot is None:
|
||||
return f'<pre class="function-plot">{html.escape(node.text)}</pre>'
|
||||
rendered = render_svg(parsed.plot)
|
||||
try:
|
||||
rendered = render_svg(parsed.plot)
|
||||
except Exception as exc: # 渲染异常回退占位,绝不阻断整篇导出
|
||||
warnings.append(f"函数图像:渲染失败,已回退占位({exc})")
|
||||
return f'<pre class="function-plot">{html.escape(node.text)}</pre>'
|
||||
warnings.extend(rendered.warnings)
|
||||
return f'<figure class="function-plot">{rendered.content}</figure>'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user