帮助:Lint 错误/Tidy font标签处理错误

From mediawiki.org
This page is a translated version of the page Help:Lint errors/tidy-font-bug and the translation is 94% complete.
Outdated translations are marked like this.
只有wiki上使用的一小部分字體標籤會受到此錯誤的影響 - 特別是只有具有顏色屬性和換行wikilinks的字體標籤。

下表說明了問題:

Wikitext Tidy Remex
<font color="green">[[Foo]]</font>
<a href=".."><font color="green">Foo</font></a>
<font color="green"><a href="..">Foo</a></font>

因此,使用Tidy,鏈接現在變為綠色而不是藍色/紅色(取決於頁面是否存在),而Remex和Parsoid不會這樣做。 此linter類別跟踪具有此行為的頁面,以便編輯可以根據所需的呈現對wiki文本進行適當的修復。

解决方案

要讓連結顯示為綠色,應在括號之間進行樣式設置:

[[Foo|<font color="green">Foo</font>]]

樣式應該優先使用‎<span>style屬性,因為‎<font>在HTML 5中已經過時了:

[[Foo|<span style="color:green;">Foo</span>]]

注意事项

但是,對於字體標記包裝鏈接或圖像標記的所有情況,Tidy不會始終如一地執行此操作。 https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/386016/6/tests/mocha/linter.js顯示了一堆wikitext片段以及Tidy所做的事情。

工具

以下工具可以幫助修復整潔的字體錯誤: