帮助:Lint 错误/应被删除的表格标签
例子:
{| ← 表格 1 从此处开始
| 一些文本
|-
{| ← 表格 2 从此处开始。你可以删掉这行
|- ← 表格 2 的一行。如果你愿意,你也可以删掉这行。
| 另一些文本
|} ← 这个闭合标签现在没用了,你应该同时删掉它。
|}
在这个例子中,第一个表格会在第二个表格开始时被闭合一次,这可能并不是编辑所期望的。绝大多数情况下,编辑应该调整 wikitext 并移除表格 2。虽然不需要删掉表格 2 的行标记,但我们推荐移除它。因为最后的表格闭合标签已经不需要了,所以也应该删掉它。 This may not be what editors intended. In most cases, editors should fix the wikitext and remove Table 2. While the following row tag need not be removed, we recommend removing it. Since the closing table tag is no longer needed, it should be removed as well.
可选的修复措施
<td> 标签。此时,应该在表格 2 的开头前加上一个 |
In that scenario, the fix is to add a | before the start of Table 2 which will fix the problem as well.
注意,有些情况下渲染结果不一定是有问题的。此时应该显式的闭合第一个表格。 In that case, it makes sense to explicitly close the first table.
所以,页面的修复措施是与页面内容相关的。
解释
这个 Linter 分类和 嵌套在另一个表中处于可寄养位置的表 有关(例如处于 <tr> 或 |- 中)。
RemexHTML 和 Parsoid 会同时保留两个表格标签,并渲染出两个临近的表格,这可能并不是编辑所期望的结果。在 wikitext 来源于模板的情况下,Linter 也会告诉你是哪一个模板产生了这些输出,但你需要自己去查看模板的源代码,来定位到产生相关表格标签的模板代码,并修复它,参见 修复示例。 In cases where the wikitext comes from a template, Linter will also tell you what template produced that output, but you will have to investigate the template source to identify the relevant piece of template code that produces that table tag and fix it. See example of a template fix.