Html5Depurate/tr

From mediawiki.org
This page is a translated version of the page Html5Depurate and the translation is 22% complete.

Html5Depurate, potansiyel olarak geçersiz HTML'yi girdi olarak alan, HTML5 ayrıştırma algoritmasını kullanarak ayrıştıran ve ortaya çıkan belgeyi bir XHTML serileştirmesi kullanarak çıkaran bir web hizmetidir. Henri Sivonen ve Mozilla Vakfı'nın mükemmel validator.nu ayrıştırıcısını kullanabilmesi için Java ile yazılmıştır.

Üçüncü taraf kullanıcılar göz önüne alındığında, RemexHTML, HTML5Depurate yerine düzenli bir değiştirme için temel olarak yalnızca PHP5 HTML5 ayrıştırma kitaplığı kullanılmıştır.

Paket kurulumu

Ubuntu Trusty ve Debian Jessie için paketler apt.wikimedia.org adresinden edinilebilir. Bunlar aşağıdaki gibi kurulabilir. Jessie için:

apt-get install apt-transport-https
echo deb https://apt.wikimedia.org/wikimedia/ jessie-wikimedia main >> /etc/apt/sources.list.d/wikimedia.list
apt-get update
apt-get install html5depurate

For Trusty:

apt-get install apt-transport-https
echo deb https://apt.wikimedia.org/wikimedia/ trusty-wikimedia main >> /etc/apt/sources.list.d/wikimedia.list
apt-get update
apt-get install html5depurate

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.

Derleme

The source can be obtained with:

git clone https://gerrit.wikimedia.org/r/mediawiki/services/html5depurate

Install Maven, JDK 7 and jsvc. Compile using:

mvn package

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:

java -cp target/html5depurate-1.1-SNAPSHOT.jar \
  org.wikimedia.html5depurate.DepurateDaemon

To run it in the background, you can use jsvc, for example:

/usr/bin/jsvc \
  -cp $PWD/target/html5depurate-1.1-SNAPSHOT.jar \
  -pidfile /tmp/html5depurate.pid \
  -errfile /tmp/html5depurate.err \
  -outfile /tmp/html5depurate.out \
  -procname html5depurate \
  org.wikimedia.html5depurate.DepurateDaemon

Or check out the debian 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:

# Max POST size, in bytes.
maxPostSize = 100000000

# Host or IP and port on which Html5depurate will listen.
host = localhost
port = 4339

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 -Djava.util.logging.config.file=/path/to/logging.properties

Client configuration

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

$wgUseTidy = false;
$wgTidyConfig = array(
	'driver' => 'Html5Depurate'
);

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

$wgTidyConfig['url'] = 'http://localhost:4339/compat/document';

Maintainer notes