简体   繁体   English

reStructuredText:如何在表中使用延续线?

[英]reStructuredText: how to use continuation lines in tables?

I have the following neat little table in reStructuredText: 我在reStructuredText中有以下整洁的小表:

======   =======   ======  =====================
Symbol   Meaning   Type    Example
======   =======   ======  =====================
   G     Era       Text    "GG" -> "AD"
   y     Year      Number  "yy" -> "03"
                           "yyyy" -> "2003"
   M     Month     Text    "M" -> "7"
                   or      "M" -> "12"
                   Number  "MM" -> "07"
                           "MMM" -> "Jul"
                           "MMMM" -> "December"
======   =======   ======  =====================

As per the Docutils documentation on simple tables I would expect the resulting HTML table that Spinx generates to be as layed out in the text, so "yy" and "yyyy" would be on different lines, as would be "M", "MM" and so on. 根据简单表上Docutils文档,我希望Spinx生成的结果HTML表与文本中的布局相同,因此“ yy”和“ yyyy”将在不同的行上,“ M”,“ MM “ 等等。 However the result is this: 但结果如下:

Sphinx生成的HTML表示例。包含日期格式字符串。

I have tried some alternatives like using pipes (|) at the beginning of the last column, empty lines, indentation. 我尝试了一些替代方法,例如在最后一列的开头使用管道(|),空行,缩进。 The closest I came was using an indent before "yyyy". 我最接近的是在“yyyy”之前使用缩进。 Then the "yyyy" is on the next line, but it is indented. 然后,“ yyyy”在下一行,但缩进了。 Of course I want it to be on the same indentation level as "yy". 当然,我希望它与“ yy”处于相同的缩进级别。

What you need is a line block : 你需要的是一个行块

======   =======   ======  =====================
Symbol   Meaning   Type    Example
======   =======   ======  =====================
   G     Era       Text    "GG" -> "AD"
   y     Year      Number  | "yy" -> "03"
                           | "yyyy" -> "2003"
   M     Month     Text    | "M" -> "7"
                   or      | "M" -> "12"
                   Number  | "MM" -> "07"
                           | "MMM" -> "Jul"
                           | "MMMM" -> "December"
======   =======   ======  =====================

Example output: 示例输出:

带有线块的RestructuredText表

(source) (资源)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM