Html5Depurate/zh

Html5Depurate是一个Web服务以可能无效的HTML作为输入，分析它使用HTML5的解析算法，并输出结果文件使用XHTML序列化. 这是一个提出更换整齐在MediaWiki是发展任务T89331部分.

这是用Java写的，所以它可以通过Henri Sivonen和Mozilla基金会用优秀的validator.nu分析器.

在第三方用户，考虑RemexHTML，PHP只有HTML5解析库已被用来代替作为一个整洁而不是HTML5Depurate置换的依据.

Package installation
Packages for Ubuntu Trusty and Debian Jessie are available from apt.wikimedia.org. These can be installed as follows. For Jessie:

For Trusty:

The service will automatically start on localhost:4339. The package is reasonably secure, since it sets up a new unprivileged user for the daemon, and uses a very restrictive Java security policy.

Note that the package uses Maven Central during its build process, so the source package does not contain all the relevant source files.

Compilation
The source can be obtained with

Install Maven, JDK 7 and jsvc. Compile using:

This will download all dependencies from Maven Central, compile, test, and generate a single .jar file which bundles all dependencies. The jar file will appear in the target directory, with a filename that depends on the current version. For testing as a foreground process, you can use something like:

Or check out the  branch for fully baked SysV init scripts.

Configuration
Configuration options may be specified in /etc/html5depurate/html5depurate.conf. Possible configuration options and their default values are documented below:

maxPostSize = 100000000
 * 1) Max POST size, in bytes.

host = localhost port = 4339
 * 1) Host or IP and port on which Html5depurate will listen.

It's advisable to also configure Java's logging service. For example, the Debian package uses the following logging.properties file:

handlers = java.util.logging.FileHandler .level = INFO

java.util.logging.FileHandler.pattern = /var/log/html5depurate/html5depurate.log java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter java.util.logging.FileHandler.append = true java.util.logging.SimpleFormatter.format = %1$tF %1$tT %4$s: %5$s %6$s%n

Then run Java with

Client configuration
MediaWiki can be configured to use this service by putting the following in LocalSettings.php:

To instruct Html5Depurate to provide backwards compatibility with Tidy as far as is possible, use the compat/document API endpoint:

Maintainer notes

 * https://github.com/wikimedia/html5depurate
 * https://github.com/wikimedia/html5depurate