【问题标题】:Sphinx Error - WARNING "list-table" widths do not match the number of columns in table (1)Sphinx 错误 - 警告“列表表”宽度与表中的列数不匹配 (1)
【发布时间】:2018-08-28 20:00:22
【问题描述】:

我正在使用 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 文档和其他几个示例中的其他几个示例,但似乎没有任何效果。

【问题讨论】:

    标签: python-sphinx restructuredtext


    【解决方案1】:

    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!
    

    【讨论】:

      【解决方案2】:

      我知道这并不能真正回答您最初的问题,但我遇到了同样的问题,对我来说唯一的解决方案是切换到 Sphinx 支持的其他格式:

      +------------+------------+-----------+------------+-----------+
      | Header 1   | Header 2   | Header 3  | Header 1   | Header 3  |
      +============+============+===========+============+===========+
      | body row 1 | column 2   | column 3  | body row 1 | column 3  |
      +------------+------------+-----------+------------+-----------+
      | body row 1 | column 2   | column 3  | body row 1 | column 3  |
      +------------+------------+-----------+------------+-----------+
      | body row 1 | column 2   | column 3  | body row 1 | column 3  |
      +------------+------------+-----------+------------+-----------+
      | body row 1 | column 2   | column 3  | body row 1 | column 3  |
      +------------+------------+-----------+------------+-----------+
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-06-25
        • 1970-01-01
        • 2012-03-24
        • 1970-01-01
        相关资源
        最近更新 更多