Skip to content

Refactor ExportUtil#301

Draft
ZnPdCo wants to merge 14 commits into
Project-LemonLime:masterfrom
ZnPdCo:rewrite-export
Draft

Refactor ExportUtil#301
ZnPdCo wants to merge 14 commits into
Project-LemonLime:masterfrom
ZnPdCo:rewrite-export

Conversation

@ZnPdCo

@ZnPdCo ZnPdCo commented May 7, 2026

Copy link
Copy Markdown
Contributor

这个 pr 做了什么

  • 将 HTML 导出从 C++ 拼接 HTML 字符串重写为 JSON + 模板方案:C++ 端通过 buildExportJson() 构建数据 JSON,嵌入 export_template.html%%DATA%% 占位符,由浏览器端 JS 完成渲染
  • 移除 XLS 导出
  • 移除 .htm 导出
  • 对导出支持了按每道题排序

测试了 CSP 2025 J,并添加了一个题答题作为测试:result.html

感觉,打开会慢一点,不过还可以接受。

(上面这个有 bug,编译错误会显示成未评测,最新的可以看:result.html

ZnPdCo and others added 7 commits April 26, 2026 13:25
- Removed the HTML generation logic from ExportUtil::exportHtml and replaced it with JSON output.
- Introduced a new method, ExportUtil::buildExportJson, to construct a JSON representation of contest results.
- Updated the exportHtml method to read from an HTML template and insert the generated JSON data.
- Cleaned up unused methods and includes related to HTML generation.
- Enhanced the structure of the JSON output to include contestant details, task scores, and additional metadata.
@ZnPdCo ZnPdCo marked this pull request as draft May 13, 2026 08:36
ZnPdCo and others added 3 commits May 31, 2026 10:17
- Remove redundant "what" comments from buildExportJson
- Simplify updateHeaderIndicators by reducing nesting
- Unify DOM construction in template (innerHTML -> DOM API)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Use C++-side info string for status text instead of template-side file/no_source check
- Add compile_message field for compile error details
- AnswersOnly without info no longer shows spurious text

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ZnPdCo ZnPdCo marked this pull request as ready for review May 31, 2026 04:13
Comment thread src/component/exportutil/exportutil.cpp Outdated
@ZnPdCo

ZnPdCo commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

我在想,既然都改成 html 模板了,要不要重写一个导出后的界面?我觉得可以让导出的 html (看起来)现代化一点。

如果可以的话,你有什么建议或参考吗?

@alphagocc

Copy link
Copy Markdown
Member

我觉得可以 vite+你喜欢的前端框架(Vue、React、Svelte……) 然后构建的时候生成一个 template.html 然后留一个可以塞数据的位置,运行时替换这个位置导出就行。

@ZnPdCo ZnPdCo marked this pull request as draft June 8, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants