在重组文本中将长列表分成多列

Bar*_*Pye 4 restructuredtext python-sphinx

有没有办法在重组文本中将长列表分成多列?

来源:

* a
* b
* c
* d
* e
* a
* c
* a
* d
* e
* f
Run Code Online (Sandbox Code Playgroud)

结果:

* a   * e   * d
* b   * a   * e
* c   * c   * f
* d   * a
Run Code Online (Sandbox Code Playgroud)

目标是在 reST 指令中提供源列表,而不是使用某种其他语言来读取源列表,然后在 reST 中使用“.. raw::”指令写入结果文本。例如这个假设list-multicol指令:

.. list-multicol::
   :columns: 3

   * a
   * b
   * c
   * d
   * e
   * a
   * c
   * a
   * d
   * e
   * f
Run Code Online (Sandbox Code Playgroud)

平衡列(相同项目数 +/- 1)不超过页面或指定列数的选项的额外功劳。

Bar*_*Pye 5

显然,该hlist指令是这样做的。

http://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-hlist

这是示例:

.. hlist::
   :columns: 3

   * A list of
   * short items
   * that should be
   * displayed
   * horizontally
Run Code Online (Sandbox Code Playgroud)