feat: add XThesis standard
This commit is contained in:
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2026 yyc12345
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
194
docs/XThesis.example.xml
Normal file
194
docs/XThesis.example.xml
Normal file
@@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<article xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="XThesis.xsd">
|
||||
|
||||
<!-- ===== 前 言 ===== -->
|
||||
<preface>
|
||||
<section caption="摘要">
|
||||
<paragraph>
|
||||
<span>本文提出了一种基于深度学习的图像识别方法。实验结果表明,该方法在</span>
|
||||
<b>ImageNet</b>
|
||||
<span>数据集上达到了</span>
|
||||
<inlineeq>92.3\%</inlineeq>
|
||||
<span>的准确率。</span>
|
||||
</paragraph>
|
||||
<paragraph>
|
||||
<b>关键词:</b>
|
||||
<span>深度学习;图像识别;卷积神经网络</span>
|
||||
</paragraph>
|
||||
</section>
|
||||
</preface>
|
||||
|
||||
<!-- ===== 正 文 ===== -->
|
||||
<document>
|
||||
<section1 caption="引言">
|
||||
<paragraph>
|
||||
<span>随着深度学习技术的快速发展</span>
|
||||
<cite>he2016, krizhevsky2012</cite>
|
||||
<span>,图像识别领域取得了突破性进展。然而,现有方法在计算效率方面仍存在诸多挑战</span>
|
||||
<cite>tan2019</cite>
|
||||
<span>。</span>
|
||||
</paragraph>
|
||||
<paragraph>
|
||||
<span>本文的主要贡献如下:</span>
|
||||
<cref>sec:method,fig:arch</cref>
|
||||
<span>。</span>
|
||||
</paragraph>
|
||||
|
||||
<section2 caption="研究背景">
|
||||
<paragraph>
|
||||
<span>卷积神经网络(CNN)自</span>
|
||||
<cite>lecun1998</cite>
|
||||
<span>提出以来,已成为计算机视觉领域的基础架构。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
|
||||
<section2 caption="论文结构">
|
||||
<paragraph>
|
||||
<span>本文其余部分组织如下:第</span>
|
||||
<ref>sec:method</ref>
|
||||
<span>节介绍所提出的方法,第</span>
|
||||
<ref>sec:experiment</ref>
|
||||
<span>节展示实验结果,最后在第</span>
|
||||
<ref>sec:conclusion</ref>
|
||||
<span>节进行总结。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
</section1>
|
||||
|
||||
<section1 caption="相关工作">
|
||||
<paragraph>
|
||||
<span>近年来,多种网络架构被提出。</span>
|
||||
<cite>simonyan2014, szegedy2015, he2016</cite>
|
||||
<span>等代表性工作极大地推动了该领域的发展。</span>
|
||||
</paragraph>
|
||||
</section1>
|
||||
|
||||
<section1 caption="方法">
|
||||
<paragraph>
|
||||
<span>本节详细描述所提出的方法架构,如</span>
|
||||
<cref>fig:arch</cref>
|
||||
<span>所示。整体流程如公式</span>
|
||||
<cref>eq:loss</cref>
|
||||
<span>所定义。</span>
|
||||
</paragraph>
|
||||
|
||||
<figure label="fig:arch" caption="网络架构示意图">figures/architecture.png</figure>
|
||||
|
||||
<section2 caption="损失函数">
|
||||
<paragraph>
|
||||
<span>本文采用交叉熵损失函数,其定义如下:</span>
|
||||
</paragraph>
|
||||
|
||||
<equation label="eq:loss">\mathcal{L} = -\sum_{i=1}^{N} y_i \log(\hat{y}_i)</equation>
|
||||
|
||||
<paragraph>
|
||||
<span>其中</span>
|
||||
<inlineeq>N</inlineeq>
|
||||
<span>表示类别数量,</span>
|
||||
<inlineeq>y_i</inlineeq>
|
||||
<span>为真实标签,</span>
|
||||
<inlineeq>\hat{y}_i</inlineeq>
|
||||
<span>为预测概率。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
|
||||
<section2 caption="优化策略">
|
||||
<paragraph>
|
||||
<span>模型使用</span>
|
||||
<i>Adam</i>
|
||||
<span>优化器进行训练,初始学习率设为</span>
|
||||
<inlineeq>10^{-3}</inlineeq>
|
||||
<span>。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
</section1>
|
||||
|
||||
<section1 caption="实验">
|
||||
<paragraph>
|
||||
<span>本节在三个标准数据集上评估所提出方法的性能。实验结果汇总于</span>
|
||||
<ref>tbl:result</ref>
|
||||
<span>。</span>
|
||||
</paragraph>
|
||||
|
||||
<section2 caption="数据集">
|
||||
<paragraph>
|
||||
<span>实验采用以下数据集:</span>
|
||||
<b>CIFAR-10</b>
|
||||
<span>、</span>
|
||||
<b>CIFAR-100</b>
|
||||
<span>和</span>
|
||||
<b>ImageNet</b>
|
||||
<span>。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
|
||||
<section2 caption="结果分析">
|
||||
<paragraph>
|
||||
<span>不同方法的对比结果如下表所示:</span>
|
||||
</paragraph>
|
||||
|
||||
<table label="tbl:result" caption="各方法在 CIFAR-10 上的准确率对比">
|
||||
<thead>
|
||||
<td>方法</td>
|
||||
<td>准确率 (%)</td>
|
||||
<td>参数量 (M)</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ResNet-18</td>
|
||||
<td>93.0</td>
|
||||
<td>11.7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ResNet-50</td>
|
||||
<td>93.5</td>
|
||||
<td>25.6</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DenseNet-121</td>
|
||||
<td>94.2</td>
|
||||
<td>8.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>本文方法</td>
|
||||
<td>95.1</td>
|
||||
<td>9.3</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<pagebreaker/>
|
||||
|
||||
<paragraph>
|
||||
<span>从表中可以看出,本文方法以较少的参数量取得了最优的准确率。</span>
|
||||
</paragraph>
|
||||
</section2>
|
||||
</section1>
|
||||
|
||||
<section1 caption="结论">
|
||||
<paragraph>
|
||||
<span>本文提出了一种高效的图像识别方法,在多个数据集上验证了其有效性。未来工作将探索该方法在视频分析领域的应用。</span>
|
||||
</paragraph>
|
||||
</section1>
|
||||
</document>
|
||||
|
||||
<!-- ===== 附 录 ===== -->
|
||||
<appendix>
|
||||
<section caption="致谢">
|
||||
<paragraph>
|
||||
<span>本研究得到了国家自然科学基金(项目编号:No. 114514)的资助,在此表示感谢。</span>
|
||||
</paragraph>
|
||||
</section>
|
||||
|
||||
<section caption="附录 A 核心代码">
|
||||
<paragraph>
|
||||
<span>以下是模型核心模块的伪代码实现:</span>
|
||||
</paragraph>
|
||||
</section>
|
||||
</appendix>
|
||||
|
||||
<!-- ===== 参考文献 ===== -->
|
||||
<reference>references.bib</reference>
|
||||
|
||||
</article>
|
||||
71
docs/XThesis.md
Normal file
71
docs/XThesis.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# XThesis 中间格式规范
|
||||
|
||||
XThesis 是一个基于 XML 的中间格式,用于辅助在 LaTeX 论文与 DOCX 论文之间进行格式转换。
|
||||
|
||||
## Schema 文件
|
||||
|
||||
格式的 XML Schema 定义见 [XThesis.xsd](./XThesis.xsd)。所有的元素结构、属性要求、子元素组合规则均在 Schema 中定义。下文仅补充 **XSD 无法在语法层面表达**的语义约束。
|
||||
|
||||
## XSD 不可表达的约束
|
||||
|
||||
### 章节嵌套规则
|
||||
|
||||
`section1` ~ `section9` 的嵌套严格限定为**相邻向下**:
|
||||
|
||||
| 父元素 | 允许的子章节 |
|
||||
|--------|-------------|
|
||||
| `section1` | `section2` |
|
||||
| `section2` | `section3` |
|
||||
| `section3` | `section4` |
|
||||
| `section4` | `section5` |
|
||||
| `section5` | `section6` |
|
||||
| `section6` | `section7` |
|
||||
| `section7` | `section8` |
|
||||
| `section8` | `section9` |
|
||||
| `section9` | *(无)* |
|
||||
|
||||
禁止:
|
||||
- **同级别嵌套**:`section1` 内不能再有 `section1`
|
||||
- **跨级别嵌套**:`section1` 内不能直接出现 `section3`,必须经由 `section2` 逐级过渡
|
||||
|
||||
### 粗体与斜体互斥
|
||||
|
||||
`<b>` 与 `<i>` 元素**不能互相嵌套**。文本只能是加粗或斜体之一,不允许 `<b><i>...</i></b>` 或 `<i><b>...</b></i>` 的形式。需要同时具有两种样式时,应在 `<b>` 或 `<i>` 之外另行处理(例如在转换阶段合并样式)。
|
||||
|
||||
### 表格列数一致性
|
||||
|
||||
`<thead>` 中 `<td>` 的数量必须与 `<tbody>` 中每一 `<tr>` 内 `<td>` 的数量完全相等。XSD 无法在 Schema 层面约束跨元素的计数值相等,**处理程序须自行校验**并在列数不匹配时报错。
|
||||
|
||||
### 引用与文献名称的格式
|
||||
|
||||
`<ref>` 与 `<cref>` 的文本内容为被引用对象的 **label 名称**,多个名称以逗号分隔:
|
||||
|
||||
```xml
|
||||
<ref>eq:main,fig:arch,tbl:result</ref>
|
||||
```
|
||||
|
||||
`<cite>` 同理,文本内容为被引用文献的标识,多个以逗号分隔:
|
||||
|
||||
```xml
|
||||
<cite>knuth1984,dijkstra1968</cite>
|
||||
```
|
||||
|
||||
此外,逗号前后允许空格:
|
||||
|
||||
```xml
|
||||
<ref>eq:main, fig:arch, tbl:result</ref>
|
||||
<cite>knuth1984, dijkstra1968</cite>
|
||||
```
|
||||
|
||||
### 公式内容的格式
|
||||
|
||||
`<inlineeq>` 与 `<equation>` 的文本内容为 **LaTeX 原始代码**,且**不包含**两侧的数学模式标记(`$` / `$$` / `\(` 等)。例如:
|
||||
|
||||
```xml
|
||||
<inlineeq>E = mc^2</inlineeq>
|
||||
<equation label="eq:energy">E = mc^2</equation>
|
||||
```
|
||||
|
||||
### 文件路径格式
|
||||
|
||||
`<figure>` 与 `<reference>` 的文本内容为文件路径。路径的具体格式(是相对路径还是绝对路径)没有要求。相对路径会在工作目录或资源目录进行查找,非相对路径则直接使用。
|
||||
257
docs/XThesis.xsd
Normal file
257
docs/XThesis.xsd
Normal file
@@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!-- ===== Model Groups ===== -->
|
||||
|
||||
<xs:group name="paraInlineContent">
|
||||
<xs:choice>
|
||||
<xs:element ref="span"/>
|
||||
<xs:element ref="inlineeq"/>
|
||||
<xs:element ref="b"/>
|
||||
<xs:element ref="i"/>
|
||||
<xs:element ref="ref"/>
|
||||
<xs:element ref="cref"/>
|
||||
<xs:element ref="cite"/>
|
||||
</xs:choice>
|
||||
</xs:group>
|
||||
|
||||
<xs:group name="sectionBodyContent">
|
||||
<xs:choice>
|
||||
<xs:element ref="paragraph"/>
|
||||
<xs:element ref="equation"/>
|
||||
<xs:element ref="figure"/>
|
||||
<xs:element ref="table"/>
|
||||
<xs:element ref="pagebreaker"/>
|
||||
</xs:choice>
|
||||
</xs:group>
|
||||
|
||||
<!-- ===== Root Element ===== -->
|
||||
|
||||
<xs:element name="article">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="preface"/>
|
||||
<xs:element ref="document"/>
|
||||
<xs:element ref="appendix"/>
|
||||
<xs:element ref="reference"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<!-- ===== Top-level Structure Elements ===== -->
|
||||
|
||||
<xs:element name="preface">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="section" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="document">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="section1" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="appendix">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="section" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="reference" type="xs:string"/>
|
||||
|
||||
<!-- ===== Section (no number, for preface/appendix) ===== -->
|
||||
|
||||
<xs:element name="section">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element ref="paragraph"/>
|
||||
<xs:element ref="pagebreaker"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<!-- ===== Numbered Sections (section1 ~ section9) ===== -->
|
||||
|
||||
<xs:element name="section9">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section8">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section9"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section7">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section8"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section6">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section7"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section5">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section6"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section4">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section5"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section3">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section4"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section2">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section3"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="section1">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="sectionBodyContent"/>
|
||||
<xs:element ref="section2"/>
|
||||
</xs:choice>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<!-- ===== Paragraph and Inline Elements ===== -->
|
||||
|
||||
<xs:element name="paragraph">
|
||||
<xs:complexType mixed="true">
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:group ref="paraInlineContent"/>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="span" type="xs:string"/>
|
||||
<xs:element name="inlineeq" type="xs:string"/>
|
||||
<xs:element name="b" type="xs:string"/>
|
||||
<xs:element name="i" type="xs:string"/>
|
||||
<xs:element name="ref" type="xs:string"/>
|
||||
<xs:element name="cref" type="xs:string"/>
|
||||
<xs:element name="cite" type="xs:string"/>
|
||||
|
||||
<!-- ===== Block Elements ===== -->
|
||||
|
||||
<xs:element name="equation">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="label" type="xs:string" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="figure">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="label" type="xs:string" use="required"/>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="table">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="thead"/>
|
||||
<xs:element ref="tbody"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="label" type="xs:string" use="required"/>
|
||||
<xs:attribute name="caption" type="xs:string" use="required"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="thead">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="td" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="tbody">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="tr" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="tr">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="td" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="td" type="xs:string"/>
|
||||
|
||||
<!-- ===== Misc ===== -->
|
||||
|
||||
<xs:element name="pagebreaker">
|
||||
<xs:complexType/>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
25
src/cli.py
25
src/cli.py
@@ -81,6 +81,8 @@ class XThesis2DocxCli:
|
||||
"""The path to output Docx file"""
|
||||
config_file: Path
|
||||
"""The path to XThesis2Docx configuration file"""
|
||||
resource_dir: Path
|
||||
"""The path to resource directory for finding images and other resources referred in XThesis file"""
|
||||
|
||||
|
||||
def parse_xthesis2docx_cli() -> XThesis2DocxCli:
|
||||
@@ -120,9 +122,21 @@ def parse_xthesis2docx_cli() -> XThesis2DocxCli:
|
||||
help="The path to XThesis2Docx configuration file",
|
||||
metavar="CONFIG.toml",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r",
|
||||
"--resource-dir",
|
||||
dest="resource_dir",
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="The path to resource directory for finding images and other resources referred in XThesis file",
|
||||
metavar="RESOURCE_DIR",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
return XThesis2DocxCli(args.input_file, args.output_file, args.config_file)
|
||||
return XThesis2DocxCli(
|
||||
args.input_file, args.output_file, args.config_file, args.resource_dir
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -138,7 +152,7 @@ class LaTeX2DocxCli:
|
||||
backend_config_file: Path
|
||||
"""The path to XThesis2Docx configuration file"""
|
||||
resource_dir: Path
|
||||
"""The path to resource directory for finding images and other resources referred in LaTeX file"""
|
||||
"""The path to resource directory for finding images and other resources referred in file"""
|
||||
|
||||
def break_into(
|
||||
self, intermediate_file: Path
|
||||
@@ -157,7 +171,10 @@ class LaTeX2DocxCli:
|
||||
self.resource_dir,
|
||||
),
|
||||
XThesis2DocxCli(
|
||||
intermediate_file, self.output_file, self.backend_config_file
|
||||
intermediate_file,
|
||||
self.output_file,
|
||||
self.backend_config_file,
|
||||
self.resource_dir,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -215,7 +232,7 @@ def parse_latex2docx_cli() -> LaTeX2DocxCli:
|
||||
action="store",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="The path to resource directory for finding images and other resources referred in LaTeX file",
|
||||
help="The path to resource directory for finding images and other resources referred in file",
|
||||
metavar="RESOURCE_DIR",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user