Manual:$wgUseTidy

From MediaWiki.org
Jump to: navigation, search
This page is a translated version of the page Manual:$wgUseTidy and the translation is 38% complete.

Other languages:
English • ‎日本語 • ‎polski
Tidy: $wgUseTidy
Use tidy to make sure HTML output is sane.
導入されたバージョン: 1.3.0
廃止予定になったバージョン: 1.26.0 (Gerrit change 235401; git #2c6c954e)
除去されたバージョン: 使用中
可能な値: 真偽値
既定値: false
他の設定: アルファベット順 | 機能順

詳細[edit]

Use "HTML tidy" to make sure HTML output is sane.

HTML tidy is a free tool that fixes broken HTML. See w:HTML tidy and http://www.w3.org/People/Raggett/tidy/

You may wish to setup this tool, and set $wgUseTidy=true, to ensure that the wiki outputs reasonably clean and compliant HTML, even when malicious or foolish users add corrupt/badly formatted HTML to wiki pages.

Note that MediaWiki already does some built-in checks and corrections to user's HTML, and limits the range of html tags and attributes which can be used (unless you set $wgRawHtmlManual:$wgRawHtml=true Dangerous!) Limitations are described at meta:Help:HTML in wikitext. The logic for this is found in includes/Sanitizer.php. As such, you may decide that running HTML tidy over the output is not necessary.

注 注: HTML tidy will irreversibly and unexpectedly mangle standard HTML markup when it feels like it. For example, wikitext like [[Link|<div>Text</div>]] will not actually produce a clickable link. There are several dozen particular bugs identified that are likely never to be fixed (see タスク T4542 and its list of blockers). If you enable Tidy, you're in for a world of hurt.

設定[edit]

The location of the tidy configuration file can be set using $wgTidyConfManual:$wgTidyConf - before MediaWiki 1.10, this was required. In later versions, a working default is provided.

However, this may not always work. See $wgTidyInternalManual:$wgTidyInternal for some more installation information.

効果[edit]

Tidy is still required to mix wiki table and html table syntax, as well as simple wikicode and html-style markup.

コード Tidy なしのパーサー Tidy
入れ子タグの混合
{|
|| foo
<tr><td>bar</td></tr>
|}
<table>
<tr>
<td> foo
<p>&lt;tr&gt;&lt;td&gt;bar&lt;/td&gt;&lt;/tr&gt;</p>
</td></tr></table>
<table>
<tr><td>foo</td></tr>
<tr><td>bar</td></tr>
</table>
開始/終了タグの混合
'''foo</b>
<b>foo&lt;/b&gt;</b>
<b>foo</b>
定義リストの入れ子
; hi
:# one
<dl><dt> hi
<ol><li> one</li></ol>
</dt></dl>
<dl><dt>hi</dt><dd>
<ol><li>one</li></ol>
</dd></dl>

Tidy can correct most bad HTML, which can be bad user input like <table><tr></td></table> or conflicting or badly written extensions (and even some bugs in the core software). However, it does not resolve all strict XHTML validation issues, such as duplicate xml ID attribute values, or IDs starting with numbers.

関連項目[edit]