1
0

feat: commit some ai prompt

This commit is contained in:
2026-06-13 09:54:29 +08:00
parent 45e00dfec2
commit 1611f4471d
2 changed files with 184 additions and 0 deletions

View File

@@ -97,3 +97,34 @@ xthesis是一个结构化的XML格式而LaTeX是一个线性文档除少
- XThesis格式的组建和写出可以从@src/xthesis.py 中获取
- 配置文件的读取和验证可以从@src/config/latex2xthesis.py 中获取
- 使用pylatexenc库进行latex格式解析我已经帮你添加好了不需要再添加了
# 执行流程
- 使用pylatexenc的节点遍历功能遍历LaTeX文档。
- 在初始状态下首先尝试匹配配置文件中prefacedocumentappendixreference。一旦匹配成功可视为进入当前内容的进一步分析。
对于preface和appendix进入即意味着进入section节点的分析section节点的标题和内容会被分析。
对于reference进入即意味着进入section1节点的分析。
对于document进入则意味着准备
# 注意事项
注意到执行流程具有嵌套性和局部性,一旦进入某一特定元素,就按照该元素内部可能出现的情况进行分析,而不再考虑其他元素。因此我建议,实现时采用状态机,配以状态机上下文
模式,栈顶部的元素为当前操作的元素。完成当前节点就弹出,发现新节点就压入。
例如当前栈顶为paragraph元素我接受到了一个figure元素则立即将顶部的paragraph元素弹出然后处理当前figure元素。因为figure元素不能位于自然段中要自动断开自然段。
对于command模式和environment模式其内部节点可在分析过程中立即给出guard模式和comment模式则必须要继续读取才能获取。你需要仔细评估这两种的区别采用正确的方式来处理我这里姑且有两种方式供你参考我推荐第一种如果第一种绝对不可行再使用第二种
1. command和environment模式立即处理guard和comment模式压入栈中进行处理好处是内存用量比较小坏处是写起来比较复杂
1. 对于guard和comment模式持续获取节点并暂存到一个list中把他们转化到command和environment模式然后一起处理。优点是非常简单缺点是内存用量会比较大

View File

@@ -0,0 +1,153 @@
[preface]
mode = "comment"
comment-head = "region: preface"
comment-tail = "endregion"
[[preface.section]]
mode = "environment"
environment-keyword = "abstract"
caption = "args[0]"
body = "body"
[document]
mode = "comment"
comment-head = "region: document"
comment-tail = "endregion"
[document.section1]
mode = "guard"
[appendix]
mode = "comment"
comment-head = "region: appendix"
comment-tail = "endregion"
[[preface.section]]
mode = "guard"
guard-head = "section"
guard-tail = "abstract"
caption = "args[0]"
body = "body"
[reference]
mode = "command"
command-keyword = "bibliography"
body = "args[0]"
[b]
mode = "command"
command-keyword = "textbf"
body = "args[0]"
[i]
mode = "command"
command-keyword = "textit"
body = "args[0]"
[ref]
mode = "command"
command-keyword = "ref"
body = "args[0]"
[cref]
mode = "command"
command-keyword = "cref"
body = "args[0]"
[cite]
mode = "command"
command-keyword = "cite"
body = "args[0]"
[equation]
mode = "environment"
environment-keyword = "equation"
body = "body"
[equation.caption]
mode = "command"
command-keyword = "caption"
body = "args[0]"
[equation.label]
mode = "command"
command-keyword = "label"
body = "args[0]"
[figure]
mode = "environment"
environment-keyword = "figure"
body = "body"
[figure.caption]
mode = "command"
command-keyword = "caption"
body = "args[0]"
[figure.label]
mode = "command"
command-keyword = "label"
body = "args[0]"
[table]
mode = "environment"
environment-keyword = "table"
body = "body"
[table.caption]
mode = "command"
command-keyword = "caption"
body = "args[0]"
[table.label]
mode = "command"
command-keyword = "label"
body = "args[0]"
[pagebreaker]
mode = "command"
command-keyword = "clearpage"