如果我有这样的rst:
+--------------------------------+
| Table H1 |
+-------------+------------------+
| Table H2a | Table H2b |
+=============+==================+
| a1 | b1 |
+-------------+------------------+
| a2 | b2 |
+-------------+------------------+
| a3 | b3 |
+-------------+------------------+
并将其转换为html,如下所示:
python -u %PYTHONPATH3%\\Scripts\\rst2html5.py input.rst output.html
生成的html表如下所示:
<body>
<div class="document"><blockquote><table>
<colgroup>
<col style="width: 42%" />
<col style="width: 58%" />
</colgroup>
<thead>
<tr><th class="head" colspan="2"><p>Table H1</p></th>
</tr>
<tr><th class="head"><p>Table H2a</p></th>
<th class="head"><p>Table H2b</p></th>
</tr>
</thead>
<tbody>
<tr><td><p>a1</p></td>
<td><p>b1</p></td>
</tr>
<tr><td><p>a2</p></td>
<td><p>b2</p></td>
</tr>
<tr><td><p>a3</p></td>
<td><p>b3</p></td>
</tr>
</tbody>
</table></blockquote></div>
</body>
如您所见,单元格内容放在段落标记内(在<p></p>
内),因此被格式化为段落,而不像我的表格在css文件中配置的那样(例如,如果我在css中向文本段落添加第一行缩进,单元格内容也会接收该缩进)
有没有一种方法可以生成单元格中没有段落的html表(使用docutils rst2html)?你知道吗
注意事项:
<p>
标记中创建的(例如<li><p>Something</p></li>
)。你知道吗
您可以使用自定义CSS覆盖
<p>
标记的可视间距。像这样的。你知道吗然而,我觉得奇怪的是,您的输出在表中生成了
<p>
标记,因为docutils并不是这样做的,假设rst2html5就是基于这些标记。我建议你联系那个图书馆的作者。你知道吗编辑:这是我使用Sphinx和reST示例的HTML输出:
相关问题 更多 >
编程相关推荐