使用网格表时,Sphinx文档生成器不喜欢多行单元格

时间:2018-03-30 00:40:06

标签: python-sphinx restructuredtext ascii-art

在创建表格以通过Sphinx文档生成器显示某些信息时,我阅读了有关使用网格表样式的文档here。但是,我的gride表在格式化时不起作用。有什么想法吗?

+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| Element Selector                                                                                         | data-*      | data-neuro-* value | Combined                    |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-button | loMonthly          | data-button='loMonthly'     |
| div.lo.lo__all-offers > div.lo__sortable-header > button.lo__sortable-header--monthly.selected-sort.desc |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-button | loSortBtn          | data-button='loSortBtn'     |
|  div.lo.lo__all-offers > div.lo__sortable-header > button.lo__sortable-header--apr.desc                  |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-button | loInterest         | data-button='loInterest'    |
|  div.lo.lo__all-offers > div.lo__sortable-header > button.lo__sortable-header--interest-paid.desc        |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-button | loTerm             | data-button='loTerm'        |
| div.lo.lo__all-offers > div.lo__sortable-header > button.lo__sortable-header--term-length.desc           |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-region | loFees             | data-region='loFees'        |
| div.lo.lo__all-offers > div.lo__sortable-header > div.lo__sortable-header--fees                          |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-region | loCall             | data-region='loCall'        |
| div.lo.lo__all-offers > a > div > p                                                                      |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-button | LoanOptionBtn      | data-button='LoanOptionBtn' |
| div.lo__drawer-container > div > button                                                                  |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+
| #loanOfferSection > div.application-form-section__container > div > form >                               | data-region | CopyText           | data-region='CopyText'      |
| div.lo__drawer-container.show-drawer > div > div.lo__legal-copy                                          |             |                    |                             |
+----------------------------------------------------------------------------------------------------------+-------------+--------------------+-----------------------------+

我希望元素选择器单元格足够短,以至于我不必在生成文档时水平滚动,但我甚至无法查看它,因为我收到以下错误:&# 39;(ERROR / 3)格式错误的表格'当我运行make html来创建我的文档时。

1 个答案:

答案 0 :(得分:1)

你在第一行和第一列中有一个奇怪的隐形字符,在单词"元素"之前。删除那个不可见的字符,表格应该呈现。

但是,我不认为网格表支持列宽,除非您将每个单元格的内容包装到相对所需的宽度。使用csv表,您可以使用:widths:属性来指定每列中应显示的字符数,如下所示:

.. table:: my table description
   :widths: 40, 10, 15, 30