Sphinx错误-警告“列表表”宽度与表(1)中的列数不匹配

时间:2018-08-28 20:00:23

标签: python-sphinx restructuredtext

我正在使用Sphinx,Python的Sphinx语法是:

.. list-table:: Frozen Delights!
    :widths: 15 10 30 20
    :header-rows: 1

    * - Treat
        - Quantity
        - Description
    * - Albatross
        - 2.99
        - On a stick!
    * - Crunchy Frog
        - 1.49
        - If we took the bones out, it wouldn't be
        crunchy, now would it?
    * - Gannet Ripple
        - 1.99
        - On a stick!

在尝试生成.rst文件WARNING "list-table" widths do not match the number of columns in table (1)时,我一直收到错误消息。我尝试了Sphinx文档中的其他几个示例以及其他几个示例,但似乎没有任何效果。

1 个答案:

答案 0 :(得分:0)

docutils documentation中给出的示例对我有用。

将您的示例与已发布的示例进行比较,并注意缩进,widths参数的数量以及长行的包装方式。

.. list-table:: Frozen Delights!
   :widths: 15 10 30
   :header-rows: 1

   * - Treat
     - Quantity
     - Description
   * - Albatross
     - 2.99
     - On a stick!
   * - Crunchy Frog
     - 1.49
     - If we took the bones out, it wouldn't be
       crunchy, now would it?
   * - Gannet Ripple
     - 1.99
     - On a stick!