在Python3-Sphinx中显示带有网格的数据
我构建了Python3-Sphinx来存储并显示一些材料。
vim show_table.rst
show table
=================
| # | Expression | Result | Comments |
| --- | --------------- | ----------- | -------------------------------------------|
| 1 | `"$a"` | `apple` | variables are expanded inside `""` |
| 2 | `'$a'` | `$a` | variables are not expanded inside `''` |
这是由Markdown定义的标准网格表,而不是CrunductureText。WQ
并进行:
make html
这不是我想要的格式,而是标准的HTML表格式。副本并粘贴到我的新show_table.rst
,
vim show_table.rst
show table
=================
.. raw:: html
<table border=”1” class=”docutils”> <thead> <tr> <th>#</th> <th>Expression</th> <th>Result</th> <th>Comments</th> </tr> </thead>
<tbody> <tr> <td>1</td> <td><code>”$a”</code></td> <td><code>apple</code></td> <td>variables are expanded inside <code>””</code>
</td> </tr> <tr> <td>2</td> <td><code>’$a’</code></td> <td><code>$a</code></td> <td>variables are not expanded inside <code>’’</code>
</td> </tr> </tbody> </table>
make html <
/code>,打开show_table.html
在浏览器中再次获得。
将类似网格的表转换为sphinx中的标准网格表是一项琐碎的工作(我不喜欢的另一种方式)。也许可以在rst
文件中添加一些东西可以实现我的目标。
I build python3-sphinx to store and show some material.
vim show_table.rst
show table
=================
| # | Expression | Result | Comments |
| --- | --------------- | ----------- | -------------------------------------------|
| 1 | `"$a"` | `apple` | variables are expanded inside `""` |
| 2 | `'$a'` | `$a` | variables are not expanded inside `''` |
It is a standard grid table defined by markdown,instead of restructureText.wq
and make it :
make html
Open the show_table.html
in browser:
It is not the format i want ,but it is in a standard html table format.Copy it and paste into my new show_table.rst
,
vim show_table.rst
show table
=================
.. raw:: html
<table border=”1” class=”docutils”> <thead> <tr> <th>#</th> <th>Expression</th> <th>Result</th> <th>Comments</th> </tr> </thead>
<tbody> <tr> <td>1</td> <td><code>”$a”</code></td> <td><code>apple</code></td> <td>variables are expanded inside <code>””</code>
</td> </tr> <tr> <td>2</td> <td><code>’$a’</code></td> <td><code>$a</code></td> <td>variables are not expanded inside <code>’’</code>
</td> </tr> </tbody> </table>
make html
,open show_table.html
in browser again,i get it.
It is a trivial job to convert the grid-like table into standard grid table in sphinx(Another way i don't like).Maybe to add something in rst
file can achieve my target.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论