Sphinx 字段列表 - url 换行符格式
Sphinx field list - url line break formatting
我正在使用 sphinx 生成项目文档。
我正在使用字段列表,引用很长的 url。
我的 reST 脚本如下:
**Operação**
^^^^^^^^^^^^
:Fonte: https://google.com.br
:Github: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
:Tópicos adicionais: lorem ipsum.
:Pós-processamento: \-
生成的html是:
如何将 URL 分成两行,以免用字段类别扼杀左列?
装扮 CSS 似乎是正确的方法。但是如果你想要一个只使用 reST 指令的 "quick fix" 最实用的似乎是:
- Truncating the URL。 (有选择地缩短 URL 的缺点。)
- 使用服装List Table。 (更改字段列表格式的缺点。)
**Operacao**
^^^^^^^^^^^^
:Fonte: `a short url`_
:Github: alongurl_
:Tópicos: `https://www.a_very_long_url/..truncated../file.html`_ lorem ipsum.
.. _a short url: http://google.com
.. _alongurl: http://google.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.. _https://www.a_very_long_url/..truncated../file.html: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
.. list-table::
:widths: 30
* - :Fonte: alongurl_
* - :Github: If we took the bones out, it wouldn't be crunchy, now would it?jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
* - :Tópicos: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
我考虑过编辑或替换 Hyperlinks References using Substitution Definitions,但显然 reST 不允许这样做。
您可以 define the HTML in an external file and include it, or use Raw Data Pass-Through 但是,在这种特定情况下,对于使用 CSS.
基本上应该实现的目标而言,这些似乎仍然不如 "workarounds"
此外,我想到了使用 Line Blocks (or similar) inside the List Table 作为手动将 URL 分隔成行的方法。但这似乎将 reST 标记语法推到了它的预期用途之外......
如果您足够了解 Element Hierarchy,可能会有一个非常聪明的方法,但我会通过对最终产品 HTML 到 [=46] 进行更改来使事情变得简单=] 而不是详细定制 reST.
我正在使用 sphinx 生成项目文档。
我正在使用字段列表,引用很长的 url。
我的 reST 脚本如下:
**Operação**
^^^^^^^^^^^^
:Fonte: https://google.com.br
:Github: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
:Tópicos adicionais: lorem ipsum.
:Pós-processamento: \-
生成的html是:
如何将 URL 分成两行,以免用字段类别扼杀左列?
装扮 CSS 似乎是正确的方法。但是如果你想要一个只使用 reST 指令的 "quick fix" 最实用的似乎是:
- Truncating the URL。 (有选择地缩短 URL 的缺点。)
- 使用服装List Table。 (更改字段列表格式的缺点。)
**Operacao**
^^^^^^^^^^^^
:Fonte: `a short url`_
:Github: alongurl_
:Tópicos: `https://www.a_very_long_url/..truncated../file.html`_ lorem ipsum.
.. _a short url: http://google.com
.. _alongurl: http://google.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.. _https://www.a_very_long_url/..truncated../file.html: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
.. list-table::
:widths: 30
* - :Fonte: alongurl_
* - :Github: If we took the bones out, it wouldn't be crunchy, now would it?jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
* - :Tópicos: https://github.com/123456789876543221/hello_world/987654321/random/path/lalalalalalallaa/12345678987654321.py
我考虑过编辑或替换 Hyperlinks References using Substitution Definitions,但显然 reST 不允许这样做。
您可以 define the HTML in an external file and include it, or use Raw Data Pass-Through 但是,在这种特定情况下,对于使用 CSS.
基本上应该实现的目标而言,这些似乎仍然不如 "workarounds"此外,我想到了使用 Line Blocks (or similar) inside the List Table 作为手动将 URL 分隔成行的方法。但这似乎将 reST 标记语法推到了它的预期用途之外......
如果您足够了解 Element Hierarchy,可能会有一个非常聪明的方法,但我会通过对最终产品 HTML 到 [=46] 进行更改来使事情变得简单=] 而不是详细定制 reST.